This commit is contained in:
2026-10-21 21:30:24 +08:00
parent 234216b3eb
commit 5356a8c898
28 changed files with 1543 additions and 45 deletions
@@ -3,10 +3,21 @@ import { readFileSync } from 'node:fs'
import test from 'node:test'
import { fileURLToPath } from 'node:url'
import { run } from './phase4-overseas-finance-cross-region.mjs'
import { run, selectCurrentInboundPlan } from './phase4-overseas-finance-cross-region.mjs'
const source = readFileSync(fileURLToPath(new URL('./phase4-overseas-finance-cross-region.mjs', import.meta.url)), 'utf8')
test('inbound fees cannot select historical plans or another customer under a fixed account', () => {
const current = { planId: '4001', planNo: 'CURRENT', customerId: '2001' }
const old = { planId: '3999', planNo: 'OLD', customerId: '2001' }
const pda = { marker: 'RUN', customerId: '2001', generatedPlanIds: ['4001'] }
assert.equal(selectCurrentInboundPlan([old, current], pda, 'RUN'), current)
assert.equal(selectCurrentInboundPlan([old], pda, 'RUN'), null)
assert.equal(selectCurrentInboundPlan([current], pda, 'OTHER'), null)
assert.equal(selectCurrentInboundPlan([{ ...current, customerId: '2002' }], pda, 'RUN'), null)
assert.equal(selectCurrentInboundPlan([current], { ...pda, generatedPlanIds: [] }, 'RUN'), null)
})
function response(data, code = '200', http = 200, region) {
return {
http,
@@ -40,7 +51,7 @@ function fixture() {
truck: { orderNo: 'TK-1', customerId: '1201' },
looseboard: { orderNo: 'LB-1', customerId: '1301' },
},
phase4OverseasPda: { customerId: '2001', overseasWarehouseId: '9001' },
phase4OverseasPda: { marker, generatedPlanIds: ['4001'], customerId: '2001', overseasWarehouseId: '9001' },
},
async request(...args) {
const route = /\/(?:last-leg|overseas-warehouse-resources)(?:\/|\?|$)/.test(String(args[1]));