44 lines
2.5 KiB
JavaScript
44 lines
2.5 KiB
JavaScript
import assert from 'node:assert/strict'
|
|
import { readFileSync } from 'node:fs'
|
|
import { dirname, resolve } from 'node:path'
|
|
import test from 'node:test'
|
|
import { fileURLToPath } from 'node:url'
|
|
|
|
const here = dirname(fileURLToPath(import.meta.url))
|
|
const read = (name) => readFileSync(resolve(here, name), 'utf8')
|
|
|
|
test('current-marker departure batch proves four documents photos customs and container-level confirm', () => {
|
|
const customs = read('phase3-customs.mjs')
|
|
const outbound = read('phase3-outbound-dispatch.mjs')
|
|
for (const type of ['DESTINATION_CLEARANCE', 'CUSTOMS_DECLARATION', 'DELIVERY_ORDER', 'PICKUP_ORDER']) {
|
|
assert.match(customs, new RegExp(type))
|
|
}
|
|
for (const evidence of ['首次上传', '回显', '下载', '更新', '完成']) assert.match(customs, new RegExp(evidence))
|
|
assert.match(customs, /photos\.length >= 5/)
|
|
assert.match(customs, /四类整柜资料必须完成后才允许进入出仓确认/)
|
|
assert.match(outbound, /CUSTOMS_CLEARANCE/)
|
|
assert.match(outbound, /拖车与独立船期仅作聚合参考且不参与出仓门禁/)
|
|
assert.match(outbound, /\$\{BASE\}\/\$\{encodeURIComponent\(containerBookingId\)\}\/confirm/)
|
|
assert.match(outbound, /confirm-dispatch 幂等重放/)
|
|
assert.match(outbound, /相同 Idempotency-Key 不同请求拒绝/)
|
|
assert.match(outbound, /实际DEPARTED_WAREHOUSE节点产生后撤销精确返回A0409/)
|
|
assert.doesNotMatch(outbound, /\/confirm-dispatch|\/reverse-dispatch|\/check-gate\?/)
|
|
})
|
|
|
|
test('outbound-created query supports automated or manual carrier then reaches PICKUP_READY PDA candidate', () => {
|
|
const query = read('phase3-carrier-schedule-queries.mjs')
|
|
const nodes = read('phase4-carrier-nodes.mjs')
|
|
const pda = read('phase4-overseas-pda.mjs')
|
|
assert.match(query, /出仓自动建任务兼容自动船司与未知船司人工处理/)
|
|
assert.match(query, /manualCarrier && task\?\.status === 'MANUAL_REQUIRED'/)
|
|
assert.match(nodes, /'DISCHARGED_FROM_VESSEL', 'PICKUP_READY'/)
|
|
assert.match(nodes, /const pickupReadyIndex = STANDARD_NODES\.indexOf\('PICKUP_READY'\)/)
|
|
assert.match(nodes, /createdResources\.phase4CarrierPickupReady/)
|
|
assert.match(pda, /targetContainerNo[\s\S]*phase3Loading\?\.containerNo/)
|
|
assert.match(pda, /id\(carrierQuery\?\.trackingNo\) === targetContainerNo/)
|
|
assert.match(pda, /seen\.has\(targetContainerNo\)/)
|
|
assert.match(pda, /targetCorrelated/)
|
|
assert.match(pda, /deploymentBlocker: true/)
|
|
assert.doesNotMatch(pda, /addCoverageGap\([^\n]*PICKUP_READY/)
|
|
})
|