This commit is contained in:
2026-09-30 17:13:11 +08:00
parent babc7de4b6
commit 32fb9ec7b3
26 changed files with 1484 additions and 70 deletions
@@ -1,6 +1,7 @@
import test from 'node:test'
import { relabelOutboundMarksMatch, inventoryQuantitySnapshot, inventorySnapshot, dispatchInventorySources, inventorySourcesPresent, dispatchStockConservation, verifyDepartureReadiness, verifyPartialOrderCompletion, verifyFulfillmentRootStatus,
completeReturnedException, verifyCustomerSignedDocuments, createSignedDocumentIsolationCustomer } from './phase5-overseas-fulfillment.mjs'
completeReturnedException, verifyCustomerSignedDocuments, createSignedDocumentIsolationCustomer,
dispatchDestinationConservation } from './phase5-overseas-fulfillment.mjs'
import assert from 'node:assert/strict'
import { readFile } from 'node:fs/promises'
import { fileURLToPath } from 'node:url'
@@ -9,6 +10,28 @@ import { parseArguments } from '../admin-test-env-acceptance.mjs'
const source = await readFile(fileURLToPath(new URL('./phase5-overseas-fulfillment.mjs', import.meta.url)), 'utf8')
const entry = await readFile(fileURLToPath(new URL('../admin-test-env-acceptance.mjs', import.meta.url)), 'utf8')
test('route equals actual item destinations and frozen selected candidates, then conserves split deliveries',()=>{
const fixture={planPalletIds:['10','11','12'],destinationWarehouseCodes:['ONT8','LAX9']}
const detail={route:'ONT8,LAX9',items:[{planPalletId:'10',fbaWarehouseCode:'ONT8'},
{planPalletId:'11',destinationWarehouseCode:'LAX9'},{planPalletId:'12',fbaWarehouseCode:'ONT8'}]}
const deliveries=[{destinationWarehouseCode:'LAX9'},{destinationWarehouseCode:'ONT8'}]
assert.equal(dispatchDestinationConservation(detail,fixture),true)
assert.equal(dispatchDestinationConservation(detail,fixture,deliveries),true)
for(const mutate of [
value=>value.detail.route='ONT8',value=>value.detail.route='ONT8,LAX9,OTHER',
value=>value.detail.route='ONT8,ONT8,LAX9',value=>value.detail.items[1].destinationWarehouseCode='OTHER',
value=>value.detail.items[1].planPalletId='99',value=>value.detail.items[1].planPalletId='10',
value=>value.fixture.destinationWarehouseCodes.push('UNSELECTED'),value=>value.deliveries.pop(),
value=>value.deliveries.push({destinationWarehouseCode:'OTHER'}),
value=>value.deliveries.push({destinationWarehouseCode:'ONT8'}),
]) {
const value=structuredClone({detail,fixture,deliveries});mutate(value)
assert.equal(dispatchDestinationConservation(value.detail,value.fixture,value.deliveries),false)
}
assert.match(source,/dispatchDestinationConservation\(beforeEdit.data,source.dispatch\)/)
assert.match(source,/dispatchDestinationConservation\(beforeEdit.data,source.dispatch,deliveries\)/)
})
test('phase-five fulfillment is a registered default HTTP module after the real phase-four dispatch fixture', () => {
assert.match(entry, /CONFIGURED_MODULES[^\n]*'phase4-overseas-dispatch', 'phase5-overseas-fulfillment'/)
assert.match(entry, /'phase5-overseas-fulfillment', \['phase4-overseas-dispatch'\]/)