Files
baiyue-firstleg/scripts/admin-test-env-modules/manual-state-loading-pda-contract.test.mjs
T
2026-08-12 20:36:11 +08:00

28 lines
1.4 KiB
JavaScript

import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import test from 'node:test'
const source = readFileSync(new URL('./manual-state-loading-pda.mjs', import.meta.url), 'utf8')
test('retains all clickable container, loading-list and PDA workflow states through public APIs', () => {
for (const status of ['WAIT_LOADING', 'EDITING', 'LOADING', 'COMPLETED',
'UNASSIGNED', 'IN_PROGRESS', 'AWAITING_REVIEW']) assert.match(source, new RegExp(`['"]${status}['"]`))
for (const endpoint of ['/ocean-bookings', '/smart-loading', '/push-preload', '/inventory-snapshot',
'/batch', '/complete', '/loading-plans', '/loading-lists']) assert.match(source, new RegExp(endpoint))
assert.match(source, /requiredStatuses/)
assert.match(source, /detailPath/)
assert.match(source, /loading-plans\/\$\{fixture\.id\}/)
assert.match(source, /loading-lists\/\$\{listFixture\.id\}/)
assert.match(source, /prepareInbound/)
assert.match(source, /\.\/orders\.mjs/)
assert.match(source, /\.\/inbound-measurement\.mjs/)
})
test('does not mutate historical fixtures or remove retained records', () => {
assert.doesNotMatch(source, /\bDELETE\b/)
assert.doesNotMatch(source, /createdResources\?\.phase3ContainerLoading/)
assert.doesNotMatch(source, /orchestrationFixtures\?\./)
assert.match(source, /fixtureMarker/)
assert.match(source, /context\.marker = originalMarker/)
})