test(firstleg): package carrier node demo checks

This commit is contained in:
2026-09-01 12:02:57 +08:00
parent 53078b4281
commit 6eaf484fcd
5 changed files with 67 additions and 7 deletions
@@ -6,6 +6,8 @@ import { fileURLToPath } from 'node:url'
const here = dirname(fileURLToPath(import.meta.url))
const read = (name) => readFileSync(resolve(here, name), 'utf8')
const readFirstlegTest = (name) => readFileSync(resolve(here,
'../../firstleg/src/test/java/com/baiyue/firstleg/portschedule/service', name), 'utf8')
test('current-marker departure batch proves four documents photos customs and container-level confirm', () => {
const customs = read('phase3-customs.mjs')
@@ -48,3 +50,25 @@ test('outbound-created query supports automated or manual carrier then reaches P
assert.match(pda, /deploymentBlocker: true/)
assert.doesNotMatch(pda, /addCoverageGap\([^\n]*PICKUP_READY/)
})
test('demo package locks provider failure retry and refuses stray facts on failed calls', () => {
const scheduler = readFirstlegTest('CarrierScheduleQuerySchedulerTest.java')
const service = readFirstlegTest('CarrierScheduleQueryServiceTest.java')
assert.match(scheduler, /retryableProviderResultCannotAdvanceEvenWhenItCarriesStrayFacts/)
assert.match(scheduler, /verify\(service, never\(\)\)\.applyProviderObservation/)
assert.match(scheduler, /completeScheduledAttempt\(1L, "RETRYABLE_FAILURE", "HTTP_503", "unavailable"\)/)
assert.match(service, /retryableFailureUsesFifteenThenThirtyMinutesAndStopsAfterThreeCallsInTheSlot/)
assert.match(service, /containsExactly\(1, 2, 3\)/)
assert.match(service, /retryThatWouldReachTheNextSlotWaitsForTheSlotInstead/)
})
test('demo package exposes the stable Admin task, node, exception and history DTO contract', () => {
const nodes = read('phase4-carrier-nodes.mjs')
assert.match(nodes, /trackingType === 'CONTAINER_NO'/)
assert.match(nodes, /validContainerNo\(task\?\.trackingNo\)/)
assert.match(nodes, /Array\.isArray\(detail\?\.nodes\)/)
assert.match(nodes, /nodes\.every\(validNode\)/)
assert.match(nodes, /exceptions\.every\(validException\)/)
assert.match(nodes, /histories\.every\(validHistory\)/)
assert.match(nodes, /!Object\.hasOwn\(detail \|\| \{\}, 'attempts'\)/)
})