fix(test): align receiving pallets with FBA destinations

This commit is contained in:
2026-09-08 12:45:46 +08:00
parent 847df6a85f
commit 096ab8d48b
3 changed files with 32 additions and 7 deletions
@@ -5,7 +5,7 @@ import test from 'node:test'
import { fileURLToPath } from 'node:url'
import { normalizeModuleOrder } from '../admin-test-env-acceptance.mjs'
import { run } from './phase4-overseas-pda-operations.mjs'
import { auxiliaryPalletFbaWarehouseCode, run } from './phase4-overseas-pda-operations.mjs'
const here = path.dirname(fileURLToPath(import.meta.url))
const source = fs.readFileSync(path.join(here, 'phase4-overseas-pda-operations.mjs'), 'utf8')
@@ -58,6 +58,16 @@ test('P2 to P5 cover all frozen endpoints, replays and conflict boundaries witho
assert.match(source, /traceId=/)
})
test('auxiliary pallets use the authoritative inbound FBA code and never the business destination fallback', () => {
assert.equal(auxiliaryPalletFbaWarehouseCode('FBA', ' ABE3 '), 'ABE3')
assert.equal(auxiliaryPalletFbaWarehouseCode('OVERSEAS', 'ABE3'), null)
assert.equal(auxiliaryPalletFbaWarehouseCode('FBA', ''), null)
assert.match(receivingSource,
/destinationType: inbound\.destinationType,[\s\S]*fbaWarehouseCode: inbound\.destinationType === 'FBA' \? inbound\.fbaWarehouseCode : null/)
assert.match(source, /fbaWarehouseCode,\s*\n\s*remark:/)
assert.doesNotMatch(source, /createEmptyPallet\([^\n]*main\.destinationWarehouseCode/)
})
test('fixture failure still disables both picker accounts and removes all transient tokens', async () => {
const cleanups = []
const gaps = []