test(fba): preserve verified fleet and fulfillment acceptance workflows

This commit is contained in:
2026-10-03 06:26:33 +08:00
parent c55bd7f4b6
commit d858357c5d
52 changed files with 4217 additions and 103 deletions
@@ -1,9 +1,26 @@
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import test from 'node:test'
import { bookingPayload } from './phase3-order-splitting.mjs'
const source = readFileSync(new URL('./phase3-order-splitting.mjs', import.meta.url), 'utf8')
test('fresh completed child runs retain distinct bill numbers despite identical long marker suffixes', () => {
const sourceOrder = { tenantId: '12', sourceOrderId: '34', channelCode: 'MATSON_CLX', warehouseId: '56' }
const agent = { id: '78', name: 'agent' }, carrier = { id: '90', name: 'carrier', carrierCode: 'MATSON' }
const markers = ['ADMIN-API-20261002030454498-COMPLETED-F40-CHILD',
'ADMIN-API-20261002034957394-COMPLETED-F40-CHILD']
const draft = (marker, sequence = 1, order = sourceOrder) => bookingPayload(marker, sequence, order, agent, carrier)
assert.equal(`${markers[0]}-1`.replace(/[^A-Za-z0-9]/g, '').slice(-18),
`${markers[1]}-1`.replace(/[^A-Za-z0-9]/g, '').slice(-18))
assert.notEqual(draft(markers[0]).billOfLadingNo, draft(markers[1]).billOfLadingNo)
assert.equal(draft(markers[0]).billOfLadingNo, draft(markers[0]).billOfLadingNo)
assert.notEqual(draft(markers[0]).billOfLadingNo, draft(markers[0], 2).billOfLadingNo)
assert.notEqual(draft(markers[0]).billOfLadingNo,
draft(markers[0], 1, { ...sourceOrder, sourceOrderId: '35' }).billOfLadingNo)
assert.match(draft(markers[0]).billOfLadingNo, /^BL-[a-f0-9]{18}$/)
})
test('each remainder uses a simulation linked to a released booking requirement', () => {
assert.match(source, /POST', CONTAINERS/)
assert.match(source, /POST', '\/api\/platform\/v1\/ocean-bookings'/)