60 lines
3.5 KiB
JavaScript
60 lines
3.5 KiB
JavaScript
import assert from 'node:assert/strict'
|
|
import { readFile } from 'node:fs/promises'
|
|
import test from 'node:test'
|
|
import { fileURLToPath } from 'node:url'
|
|
import { normalizeModuleOrder } from '../admin-test-env-acceptance.mjs'
|
|
|
|
const source = await readFile(fileURLToPath(new URL('./phase4-tail-order-controls.mjs', import.meta.url)), 'utf8')
|
|
|
|
test('tail order controls execute after current producer and before overseas PDA', () => {
|
|
const modules = normalizeModuleOrder(['phase4-overseas-pda'])
|
|
const controls = modules.indexOf('phase4-tail-order-controls')
|
|
assert.ok(controls > modules.indexOf('phase4-carrier-pickup-ready'))
|
|
assert.ok(controls < modules.indexOf('phase4-overseas-pda'))
|
|
})
|
|
|
|
test('module covers the public tail-order write surface before PDA receiving', () => {
|
|
for (const path of ['/receiving-warehouse', '/destination', '/pallet-merge-required', '/fees', '/export',
|
|
'/hold', '/manual-nodes', '/api/platform/v1/last-leg/inbound-plans', '/manual']) {
|
|
assert.ok(source.includes(path), `missing ${path}`)
|
|
}
|
|
for (const evidence of [
|
|
'接柜仓变更同键同载荷重放', '接柜仓变更同键异载荷返回A0409', '接柜仓变更旧版本返回A0409',
|
|
'整柜恢复原公共接柜仓', '单票变更FBA目的仓', '批量变更FBA目的仓',
|
|
'单票开启PDA合托提示', '批量开启PDA合托分组', '批量取消PDA合托分组',
|
|
'尾程费用详情可追溯', '导出本轮尾程订单CSV',
|
|
'暂扣命令同键同载荷重放', '暂扣同键异载荷返回A0409', '暂扣尾程订单不能生成人工计划',
|
|
'解除本轮单票尾程暂扣', '保存尾程八个人工节点快照', '人工节点同键同载荷重放',
|
|
'人工节点同键异载荷返回A0409', '人工节点读取固定为MANUAL且不回退柜级节点',
|
|
'人工计划按订单稳定接柜仓回读当前主档并冻结入仓码、托数和操作标志', '人工计划同键异载荷返回A0409',
|
|
]) assert.ok(source.includes(evidence), `missing ${evidence}`)
|
|
assert.match(source, /nodes\.data\?\.nodes\?\.length === 8/)
|
|
assert.match(source, /creationMode === 'MANUAL'/)
|
|
assert.match(source, /requestOverseasBinary\('GET'/)
|
|
assert.match(source, /palletMergeBatchId/)
|
|
})
|
|
|
|
test('receiving warehouse verification reuses public master data and restores the original assignment', () => {
|
|
assert.match(source, /tenantId=0&page=1&size=200&capabilityCode=RECEIVING&warehouseType=OVERSEAS&status=ACTIVE/)
|
|
assert.match(source, /id\(row\.id\) !== originalWarehouseId/)
|
|
assert.match(source, /overseasWarehouseId: originalWarehouseId, expectedVersion: Number\(changed\.data\.assignmentVersion\)/)
|
|
assert.doesNotMatch(source, /request\('POST', '\/api\/platform\/v1\/warehouse-admin'/)
|
|
})
|
|
|
|
test('module is marker-owned and never borrows historical tail orders', () => {
|
|
assert.match(source, /matrix\?\.marker !== context\.marker/)
|
|
assert.match(source, /containerNo: producer\.containerNo/)
|
|
assert.match(source, /customerId\) === id\(producer\.tenantId\)/)
|
|
assert.match(source, /禁止借历史尾程订单/)
|
|
assert.doesNotMatch(source, /records\([^)]*\)\[0\]/)
|
|
})
|
|
|
|
test('manual plans preserve long identifiers and are retained for PDA consumption', () => {
|
|
assert.match(source, /orderId: id\(order\.id\)/)
|
|
assert.doesNotMatch(source, /plannedWarehouse(?:Id|Code|Name):/)
|
|
assert.match(source, /!order\.overseasWarehouseId/)
|
|
assert.match(source, /planNos: plans/)
|
|
assert.match(source, /MANUAL_PLANS_READY/)
|
|
assert.match(source, /remain as the marker-owned prerequisites consumed by overseas PDA receiving/)
|
|
})
|