安排大交通问题修复
This commit is contained in:
1 parent
40230ce33d
commit
1797c713af
20 files changed
+280
-22
No files matched your search
@@ -65,7 +65,7 @@ function fixture(type, { occupied = 1, rows = occupied + 2, onSelection = () =>
|
||||
const match = /^([a-zA-Z_]+)(\d+)$/.exec(control.name);
|
||||
if (match && [0, occupied].includes(Number(match[2]))) control.name = control.id = `${match[1]}${Number(match[2]) === 0 ? occupied : 0}`;
|
||||
}
|
||||
onPost(savedForm);
|
||||
onPost(savedForm, body);
|
||||
return { completed: true, http_status: 200 };
|
||||
};
|
||||
window.testFreshPage = () => ({ document: { querySelector: (selector) => {
|
||||
@@ -168,8 +168,86 @@ for (const type of ['vehicle', 'transport', 'other']) {
|
||||
});
|
||||
}
|
||||
|
||||
for (const type of ['transport', 'other']) {
|
||||
test(`${type} creates in a departure-default row and preserves existing rows, spare rows and filing`, async () => {
|
||||
for (const occupied of [0, 1, 6, 10]) for (const quantity of ['0', '1']) {
|
||||
let submitted;
|
||||
const f = fixture(type, { occupied, rows: occupied + 5, sort: true, onPost(_form, body) { submitted = body; } });
|
||||
for (let index = occupied; index < occupied + 5; index++) {
|
||||
f.fields.get(`riqi${index}`).value = index % 2 ? '2026-09-01' : '2026-9-1';
|
||||
f.fields.get(`shuliang${index}`).value = quantity;
|
||||
}
|
||||
const preserved = f.form.elements.filter(c => !new RegExp(`^[a-zA-Z_]+${occupied}$`).test(c.name))
|
||||
.map(c => [c.name, c.value]);
|
||||
const before = f.form.elements.map(c => c.value);
|
||||
const preflight = await f.api.preflightLifecycleOperation(f.operation);
|
||||
assert.equal(preflight.status, 'lifecycle_preflight_ready', JSON.stringify(preflight));
|
||||
assert.deepEqual(f.form.elements.map(c => c.value), before, 'preflight must not clear default dates');
|
||||
const result = await f.api.liveSubmitLifecycleOperation(f.operation);
|
||||
assert.equal(result.status, 'lifecycle_completed', JSON.stringify(result));
|
||||
assert.equal(f.posts(), 1); assert.equal(f.selections(), 1);
|
||||
assert.equal(f.fields.get(`riqi${occupied}`).value, '2026-09-05');
|
||||
assert.equal(f.fields.get(`shuliang${occupied}`).value, '12');
|
||||
for (const [name, value] of preserved) assert.equal(f.fields.get(name).value, value, name);
|
||||
const body = new URLSearchParams(submitted);
|
||||
assert.equal(body.get(`riqi${occupied}`), '2026-09-05');
|
||||
for (const [name, value] of preserved) {
|
||||
if (!['SubmitButton', 'ap_qt'].includes(name)) assert.equal(body.get(name), value, `submitted ${name}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test(`${type} rejects drafts and unverified dates even with other default-date rows available`, async () => {
|
||||
const changes = [
|
||||
f => { f.fields.get('riqi2').value = '2026-09-02'; },
|
||||
f => { f.fields.get('riqi2').value = 'invalid'; },
|
||||
f => { f.fields.get('chufari').value = ''; },
|
||||
f => { f.form.elements = f.form.elements.filter(c => c.name !== 'chufari'); },
|
||||
f => { for (const name of ['chufari', 'riqi1', 'riqi2']) f.fields.get(name).value = '2026-2-30'; },
|
||||
...['danwei2', 'danweiid2', 'shuoming2', 'beizhu2', 'danjia2', 'jine2', 'yf2', 'sh2', 'shenhe2', 'shuliang2'].map(name =>
|
||||
f => { f.fields.get(name).value = '19'; })
|
||||
];
|
||||
for (const change of changes) {
|
||||
const f = fixture(type);
|
||||
f.fields.get('riqi1').value = f.fields.get('riqi2').value = '2026-9-1';
|
||||
change(f);
|
||||
const before = f.form.elements.map(c => c.value);
|
||||
const result = await f.api.liveSubmitLifecycleOperation(f.operation);
|
||||
assert.equal(result.status, 'lifecycle_preflight_blocked', JSON.stringify(result));
|
||||
assert.equal(f.posts(), 0); assert.equal(f.selections(), 0);
|
||||
assert.deepEqual(f.form.elements.map(c => c.value), before);
|
||||
}
|
||||
});
|
||||
|
||||
test(`${type} guards other default dates through native selection, validation and preflight changes`, async () => {
|
||||
for (const callback of ['onSelection', 'onValidate']) {
|
||||
const f = fixture(type, { [callback](fields) { fields.get('riqi2').value = '2026-09-02'; } });
|
||||
f.fields.get('riqi1').value = f.fields.get('riqi2').value = '2026-9-1';
|
||||
const result = await f.api.liveSubmitLifecycleOperation(f.operation);
|
||||
assert.notEqual(result.status, 'lifecycle_completed', JSON.stringify(result));
|
||||
assert.equal(f.posts(), 0);
|
||||
}
|
||||
const f = fixture(type);
|
||||
f.fields.get('riqi1').value = f.fields.get('riqi2').value = '2026-9-1';
|
||||
const preflight = await f.api.preflightLifecycleOperation(f.operation);
|
||||
f.fields.get('riqi2').value = '2026-09-02';
|
||||
const result = await f.api.liveSubmitLifecycleOperation(f.operation, { expected_before_hash: preflight.preflight.form_payload_sha256 });
|
||||
assert.notEqual(result.status, 'lifecycle_completed');
|
||||
assert.equal(f.posts(), 0); assert.equal(f.selections(), 0);
|
||||
});
|
||||
}
|
||||
|
||||
test('vehicle still rejects an unsaved date equal to departure', async () => {
|
||||
const f = fixture('vehicle'); f.fields.get('riqi1').value = '2026-9-1';
|
||||
const result = await f.api.liveSubmitLifecycleOperation(f.operation);
|
||||
assert.equal(result.status, 'lifecycle_preflight_blocked');
|
||||
assert.ok(result.blockers.includes('arrangement_slot_occupied:riqi0'));
|
||||
assert.equal(f.posts(), 0); assert.equal(f.selections(), 0);
|
||||
});
|
||||
|
||||
test('other create keeps omitted quantity and shared filing, and verifies them after sorted requery', async () => {
|
||||
const f = fixture('other', { sort: true }); delete f.operation.data.arrangement.quantity;
|
||||
f.fields.get('riqi1').value = f.fields.get('riqi2').value = '2026-9-1';
|
||||
const result = await f.api.liveSubmitLifecycleOperation(f.operation);
|
||||
assert.equal(result.status, 'lifecycle_completed', JSON.stringify(result));
|
||||
assert.equal(f.fields.get('shuliang1').value, '1');
|
||||
@@ -182,6 +260,16 @@ test('other create keeps omitted quantity and shared filing, and verifies them a
|
||||
}
|
||||
});
|
||||
|
||||
test('other preserves omitted zero quantity in a default-date row', async () => {
|
||||
const f = fixture('other'); delete f.operation.data.arrangement.quantity;
|
||||
f.fields.get('riqi1').value = f.fields.get('riqi2').value = '2026-9-1';
|
||||
f.fields.get('shuliang1').value = '0';
|
||||
const result = await f.api.liveSubmitLifecycleOperation(f.operation);
|
||||
assert.equal(result.status, 'lifecycle_completed', JSON.stringify(result));
|
||||
assert.equal(f.fields.get('shuliang1').value, '0');
|
||||
assert.equal(f.fields.get('riqi1').value, '2026-09-05');
|
||||
});
|
||||
|
||||
test('other create may fill blank filing fields, blocks conflicting filing and preserves realized state', async () => {
|
||||
const f = fixture('other'); f.fields.get('beianhao').value = ''; f.operation.data.arrangement.filing = { number: 'NEW' };
|
||||
assert.equal((await f.api.liveSubmitLifecycleOperation(f.operation)).status, 'lifecycle_completed');
|
||||
|
||||
@@ -151,6 +151,7 @@ test('hotel create matches the new record after ERP sorts rows and uses persiste
|
||||
test('no free row, unsaved drafts, financial state and incomplete rows fail before any POST', async () => {
|
||||
const cases = [
|
||||
fixture({ occupied: 3, rows: 3 }),
|
||||
(() => { const f = fixture(); f.fields.get('riqi1').value = f.fields.get('chufari').value; return f; })(),
|
||||
...['danwei1', 'riqi1', 'jianshu1', 'yf1', 'sh1', 'beizhu1', 'danjia1'].map((name) => { const f = fixture(); f.fields.get(name).value = 'unexpected'; return f; }),
|
||||
(() => { const f = fixture(); f.form.elements = f.form.elements.filter((control) => control.name !== 'id1'); return f; })()
|
||||
];
|
||||
|
||||
@@ -1374,7 +1374,7 @@ test('passenger explicit server success is terminal without a post-save row requ
|
||||
assert.doesNotMatch(passengerBranch, /passengerRequery|verifyLifecycleOperation/);
|
||||
assert.doesNotMatch(background, /attemptAutomaticPassengerReconciliation/);
|
||||
assert.match(background, /名单已取得 ERP 明确成功响应,按业务规则确认录入成功/);
|
||||
assert.match(platformApp, /REQUIRED_EXTENSION_VERSION = '0\.5\.188'/);
|
||||
assert.match(platformApp, /REQUIRED_EXTENSION_VERSION = '0\.5\.189'/);
|
||||
});
|
||||
|
||||
test('uncertain lifecycle writes can only converge through a read-only plugin requery', async () => {
|
||||
@@ -1584,7 +1584,7 @@ test('lifecycle execution keeps the MV3 worker alive until the durable task sett
|
||||
assert.match(background, /arrangement_resource_candidate_data_missing/);
|
||||
});
|
||||
|
||||
test('extension 0.5.188 keeps reload dormant unless its durable execution state is fully idle', async () => {
|
||||
test('extension 0.5.189 keeps reload dormant unless its durable execution state is fully idle', async () => {
|
||||
const [background, bridge] = await Promise.all([
|
||||
readFile(new URL('../chrome-extension/ltjt-order-assistant/background.js', import.meta.url), 'utf8'),
|
||||
readFile(new URL('../chrome-extension/ltjt-order-assistant/business-bridge.js', import.meta.url), 'utf8')
|
||||
@@ -2037,7 +2037,7 @@ test('delete guard distinguishes independent, shared child, and shared parent ro
|
||||
for (const operation of operations) assert.equal(plans.validateOperation(operation).ok, true, plans.validateOperation(operation).blockers.join('; '));
|
||||
|
||||
const mapping = JSON.parse(await readFile(new URL('../mappings/lifecycle.mapping.json', import.meta.url), 'utf8'));
|
||||
assert.equal(mapping.current_extension_version, '0.5.188');
|
||||
assert.equal(mapping.current_extension_version, '0.5.189');
|
||||
assert.equal(
|
||||
mapping.updates.order_update_independent.field_mapped_pending_live_validation['pax.child_no_bed'],
|
||||
'ertrenshu'
|
||||
@@ -2421,10 +2421,10 @@ test('schema and browser adapters contain the v2 safety fields and no confirm ov
|
||||
assert.match(inpage, /`ys_danweiid\$\{index\}`, resolvedCustomerId/);
|
||||
assert.doesNotMatch(inpage, /product_customer_source_region|sourceRegionCheck|source_reference/);
|
||||
assert.doesNotMatch(teamBatchInpage, /product_customer_source_region|sourceRegionCheck/);
|
||||
assert.equal(extensionManifest.version, '0.5.188');
|
||||
assert.match(inpage, /version: '0\.5\.188'/);
|
||||
assert.match(teamBatchInpage, /version: '0\.5\.188'/);
|
||||
assert.match(platformApp, /REQUIRED_EXTENSION_VERSION = '0\.5\.188'/);
|
||||
assert.equal(extensionManifest.version, '0.5.189');
|
||||
assert.match(inpage, /version: '0\.5\.189'/);
|
||||
assert.match(teamBatchInpage, /version: '0\.5\.189'/);
|
||||
assert.match(platformApp, /REQUIRED_EXTENSION_VERSION = '0\.5\.189'/);
|
||||
assert.match(inpage, /function strictIsoDate\(value\)/);
|
||||
assert.match(inpage, /const startDate = strictIsoDate\(current\('riqi'\)\)/);
|
||||
assert.match(inpage, /const endDate = strictIsoDate\(current\('riqis'\)\)/);
|
||||
|
||||
Reference in new issue
Block a user