2026-09-04 15:06:36 +08:00
|
|
|
import assert from 'node:assert/strict'
|
|
|
|
|
import test from 'node:test'
|
|
|
|
|
import { readFileSync } from 'node:fs'
|
|
|
|
|
|
|
|
|
|
function source(name) {
|
|
|
|
|
return readFileSync(new URL(name, import.meta.url), 'utf8')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
test('measurement HTTP acceptance preserves whole-ticket slot identities across confirmations', () => {
|
|
|
|
|
const measurement = source('./inbound-measurement.mjs')
|
|
|
|
|
assert.match(measurement, /逐张确认后回查整票库位块/)
|
|
|
|
|
assert.match(measurement, /扩容只追加且既有槽身份不漂移/)
|
|
|
|
|
assert.match(measurement, /asId\(verified\.guide\?\.blockId\) === previous\.blockId/)
|
|
|
|
|
assert.match(measurement, /verified\.slots\.length >= previous\.slots\.length && priorSlotsStable/)
|
|
|
|
|
assert.match(measurement, /asId\(current\.reservationId\) === asId\(prior\.reservationId\)/)
|
|
|
|
|
assert.match(measurement, /asId\(current\.locationId\) === asId\(prior\.locationId\)/)
|
|
|
|
|
})
|
|
|
|
|
|
2026-09-04 15:36:56 +08:00
|
|
|
test('smart-loading HTTP acceptance covers by-booking reads and bidirectional quantity changes', () => {
|
2026-09-04 15:06:36 +08:00
|
|
|
const loading = source('./phase3-loading.mjs')
|
|
|
|
|
assert.match(loading, /计划详情由服务端返回权威总箱数和剩余箱数/)
|
|
|
|
|
assert.match(loading, /authoritativeRemaining === authoritativeTotal - assignedPackageCount/)
|
2026-09-04 15:36:56 +08:00
|
|
|
assert.match(loading, /计划已有明细后按柜次读取智能装柜详情/)
|
|
|
|
|
assert.match(loading, /按柜次详情返回同一计划及权威箱数且数量守恒/)
|
2026-09-04 15:06:36 +08:00
|
|
|
assert.match(loading, /packageCount: authoritativeTotal \+ 1/)
|
2026-09-04 15:36:56 +08:00
|
|
|
assert.match(loading, /调整箱数超过服务端权威总箱数返回A0422/)
|
|
|
|
|
assert.match(loading, /未拣动态增量明细允许向下调整数量/)
|
|
|
|
|
assert.match(loading, /Number\(decreasedItem\?\.remainingPackageCount\) === authoritativeTotal - 1/)
|
|
|
|
|
assert.match(loading, /向下调整验证后恢复两箱供已拣下限校验/)
|
|
|
|
|
assert.match(loading, /packageCount: Number\(pickedDynamicPlanItem\?\.minPackageCount\) - 1/)
|
2026-09-04 15:06:36 +08:00
|
|
|
assert.match(loading, /Number\(afterOverAuthority\?\.version\) === Number\(reassignedPlan\?\.version\)/)
|
|
|
|
|
assert.match(loading, /Number\(afterOverAuthorityItem\?\.remainingPackageCount\) === authoritativeRemaining/)
|
|
|
|
|
})
|