test: align manual booking list dependencies

This commit is contained in:
2026-08-14 23:14:11 +08:00
parent 32e9b69556
commit 5bb8f4db6d
6 changed files with 87 additions and 8 deletions
@@ -4,13 +4,19 @@ import test from 'node:test'
const source = readFileSync(new URL('./manual-state-ocean-trucking.mjs', import.meta.url), 'utf8')
test('retains every ocean booking and truck appointment list status through real APIs', () => {
test('retains only public ocean booking list states while hidden states stay detail-only', () => {
assert.match(source, /const OCEAN_BASE = ['"]\/api\/platform\/v1\/ocean-bookings['"]/)
assert.doesNotMatch(source, /\/api\/platform\/v1\/first-leg\/ocean-bookings/)
for (const status of ['DRAFT','SUBMITTED','CONFIRMED','RELEASED','FAILED','CHANGE_PENDING','CANCELLED',
'PENDING_DISPATCH','DISPATCHED','PICKUP_IN_PROGRESS','ARRIVED_WAREHOUSE','LOADING','DEPARTED',
'COMPLETED','RESCHEDULED','EXCEPTION']) assert.match(source, new RegExp(`['"]${status}['"]`))
assert.match(source, /change-request/)
assert.match(source, /const OCEAN_LIST_STATUSES = \['CONFIRMED', 'CHANGE_PENDING', 'RELEASED', 'CANCELLED'\]/)
assert.match(source, /const OCEAN_HIDDEN_STATUSES = \['DRAFT', 'SUBMITTED', 'FAILED'\]/)
assert.match(source, /hiddenFixtures/)
assert.match(source, /code\(listResponse\) === 'A0400'/)
assert.match(source, /后台样本仅通过详情契约验证/)
assert.doesNotMatch(source, /code\(listResponse\) !== 'A0400'\) return/)
const draftPayload = source.slice(source.indexOf('function oceanPayload'), source.indexOf('async function createOcean'))
for (const field of ['billOfLadingNo', 'vesselName', 'voyageNo', 'estimatedSailingAt', 'estimatedArrivalAt']) {
assert.doesNotMatch(draftPayload, new RegExp(`${field}:`))