优化
This commit is contained in:
@@ -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'\]/)
|
||||
|
||||
Reference in New Issue
Block a user