fix: validate transfer rejection and align dispatch HTTP contracts
This commit is contained in:
@@ -2,6 +2,7 @@ import test from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import { readFile } from 'node:fs/promises'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { dispatchBusinessSnapshot } from './phase4-overseas-dispatch.mjs'
|
||||
|
||||
const moduleUrl = new URL('./phase4-overseas-dispatch.mjs', import.meta.url)
|
||||
const source = await readFile(fileURLToPath(moduleUrl), 'utf8')
|
||||
@@ -27,11 +28,11 @@ test('module uses marker-owned completed PDA pallets and never borrows historica
|
||||
assert.doesNotMatch(source, /candidates\[0\]/)
|
||||
})
|
||||
|
||||
test('module proves draft idempotency, lock isolation, stale replay conflict and readback', () => {
|
||||
test('module proves draft idempotency, lock isolation, editable pre-arrange replay and readback', () => {
|
||||
assert.match(source, /相同草稿快照重复保存/)
|
||||
assert.match(source, /同草稿重复锁定托盘幂等成功/)
|
||||
assert.match(source, /其他草稿锁定同一托盘返回A0409/)
|
||||
assert.match(source, /已转换正式锁的旧草稿载荷再次预排返回A0409/)
|
||||
assert.match(source, /出库前同草稿重复预排复用原排车且业务快照不漂移/)
|
||||
assert.match(source, /重复释放草稿幂等成功/)
|
||||
assert.match(source, /排车详情按记录自身客户范围加载托盘明细/)
|
||||
assert.match(source, /response\?\.http === 409.*codeOf\(response\) === 'A0409'/s)
|
||||
@@ -65,3 +66,15 @@ test('module prefers marker-owned relabel pallets and proves only new FBA carton
|
||||
assert.doesNotMatch(branch, /\breturn\b/)
|
||||
assert.match(source, /Object.assign\(relabel, \{/)
|
||||
})
|
||||
|
||||
test('dispatch replay snapshot ignores regenerated item ids but detects business drift', () => {
|
||||
const a = { id: '1', dispatchNo: 'DS-1', status: 'PENDING_DEPARTURE', packageCount: 2,
|
||||
palletCount: 1, items: [{ id: '10', planPalletId: '20', warehousePalletId: '30', packageCount: 2 }] }
|
||||
const replay = { ...a, items: [{ ...a.items[0], id: '11' }] }
|
||||
assert.equal(dispatchBusinessSnapshot(a), dispatchBusinessSnapshot(replay))
|
||||
for (const changed of [{ ...replay, id: '2' }, { ...replay, packageCount: 4 },
|
||||
{ ...replay, items: [{ ...a.items[0], warehousePalletId: '31' }] }]) {
|
||||
assert.notEqual(dispatchBusinessSnapshot(a), dispatchBusinessSnapshot(changed))
|
||||
}
|
||||
assert.doesNotMatch(source, /item\?\.cartonMarks/)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user