test(admin): follow real loading start sequence
This commit is contained in:
@@ -1,9 +1,23 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import { readFileSync } from 'node:fs'
|
||||
import test from 'node:test'
|
||||
|
||||
import { selectCustomsFlow } from './phase3-customs.mjs'
|
||||
import { buildFinalizeResource } from './phase3-loading-finalize.mjs'
|
||||
|
||||
function source(name) {
|
||||
return readFileSync(new URL(name, import.meta.url), 'utf8')
|
||||
}
|
||||
|
||||
function assertOrder(value, snippets) {
|
||||
let cursor = -1
|
||||
for (const snippet of snippets) {
|
||||
const next = value.indexOf(snippet)
|
||||
assert.ok(next > cursor, `${snippet} must appear after the previous production step`)
|
||||
cursor = next
|
||||
}
|
||||
}
|
||||
|
||||
test('pairs customs source fixture with the matching loading container', () => {
|
||||
const resources = {
|
||||
orchestrationFixtures: {
|
||||
@@ -50,3 +64,26 @@ test('records LOADED and clears the reason only after a real LOADED reread', ()
|
||||
assert.equal(result.finalizeSucceeded, true)
|
||||
assert.equal(result.notCleanedReason, null)
|
||||
})
|
||||
|
||||
test('container loading follows push, claim, real pick, completed sequence', () => {
|
||||
const value = source('./phase3-container-loading.mjs')
|
||||
assert.match(value, /containerDetail\?\.planStatus === 'WAIT_LOADING'/)
|
||||
assertOrder(value, [
|
||||
"pushed?.status === 'EDITING'",
|
||||
"claimedPlan?.status === 'EDITING'",
|
||||
"const pickResponse = await request",
|
||||
"finalPlan?.status === 'COMPLETED'",
|
||||
])
|
||||
})
|
||||
|
||||
test('bridge loading starts through a real PDA batch before preload confirmation', () => {
|
||||
const value = source('./phase3-loading.mjs')
|
||||
assertOrder(value, [
|
||||
"pushedLoadingPlan?.status === 'EDITING'",
|
||||
"claimedPlan?.status === 'EDITING'",
|
||||
"const canonicalPick = await request",
|
||||
"pickedPlan?.status === 'COMPLETED'",
|
||||
"const confirming = await request",
|
||||
])
|
||||
assert.doesNotMatch(value, /关联柜次计划进入 LOADING/)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user