Files
baiyue-firstleg/scripts/admin-test-env-modules/manual-state-ocean-trucking-contract.test.mjs
T

24 lines
1.2 KiB
JavaScript
Raw Normal View History

2026-08-12 20:36:11 +08:00
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import test from 'node:test'
const source = readFileSync(new URL('./manual-state-ocean-trucking.mjs', import.meta.url), 'utf8')
2026-08-18 16:39:39 +08:00
test('manual matrix retains only DRAFT and RELEASED ocean booking states', () => {
assert.match(source, /const OCEAN_LIST_STATUSES = \['DRAFT', 'RELEASED'\]/)
assert.match(source, /containerRequirements:/)
assert.doesNotMatch(source, /change-request|\/cancel/)
assert.doesNotMatch(source, /realContainerBookingId|containerNo:\s*`MAN-/)
assert.match(source, /status === 'DRAFT'/)
assert.match(source, /status === 'RELEASED'/)
})
test('truck matrix remains independent while retaining its own lifecycle', () => {
for (const status of ['DRAFT', 'PENDING_DISPATCH', 'DISPATCHED', 'PICKUP_IN_PROGRESS',
'ARRIVED_WAREHOUSE', 'LOADING', 'DEPARTED', 'COMPLETED', 'RESCHEDULED', 'EXCEPTION', 'CANCELLED']) {
assert.match(source, new RegExp(`['\"]${status}['\"]`))
2026-08-14 12:50:37 +08:00
}
2026-08-12 20:36:11 +08:00
assert.match(source, /page=1&size=100&status=/)
assert.match(source, /category=TRUCKING&status=ACTIVE/)
assert.match(source, /carrierId: id\(carrier\.id\), carrierName: carrier\.name/)
2026-08-12 20:36:11 +08:00
})