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,13 +1,29 @@
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import test from 'node:test'
import { missingRequiredStateFixtures, normalizeStateRequirements } from './manual-state-matrix.mjs'
import { attachDeliveredOrderFixture, missingRequiredStateFixtures, normalizeStateRequirements } from './manual-state-matrix.mjs'
import { normalizeModuleOrder, parseArguments } from '../admin-test-env-acceptance.mjs'
const entry = readFileSync(new URL('../admin-test-env-acceptance.mjs', import.meta.url), 'utf8')
const source = readFileSync(new URL('./manual-state-matrix.mjs', import.meta.url), 'utf8')
const loadingSource = readFileSync(new URL('./manual-state-loading-pda.mjs', import.meta.url), 'utf8')
test('DELIVERED 必须回查本轮已签收但根未完成的正式订单', async () => {
const matrix = { pages: { unifiedOrders: { fixtures: {} } } }
const context = { marker: 'run-1', createdResources: { phase5OverseasFulfillment: { marker: 'run-1',
orderCompletionProof: { customerId: '7', rootOrderId: '99', rootDelivered: true, expectedCompleted: false } } },
request: async (method, path) => {
assert.equal(method, 'GET')
assert.equal(path, '/api/platform/v1/orders/99?tenantId=7')
return { body: { data: { summary: { orderId: '99', mainStatus: 'DELIVERED' } } } }
}, apiSuccess: (_m, _n, response) => response.body.data,
assert: (_m, _n, _r, valid) => assert.equal(valid, true) }
await attachDeliveredOrderFixture(context, matrix)
assert.equal(matrix.pages.unifiedOrders.fixtures.DELIVERED.id, '99')
context.createdResources.phase5OverseasFulfillment.marker = 'old'
await assert.rejects(attachDeliveredOrderFixture(context, matrix), /本轮/)
})
test('default full acceptance includes the retained manual state matrix after lifecycle modules', () => {
assert.match(entry, /'manual-state-matrix'/)
assert.ok(entry.indexOf("'phase3-order-splitting'") < entry.indexOf("'manual-state-matrix'"))
@@ -31,6 +47,13 @@ test('focused matrix execution injects real container lifecycle prerequisites an
'service-center-flow',
'phase3-outbound-dispatch',
'phase3-container-documents',
'phase3-carrier-schedule-queries',
'phase4-carrier-pickup-ready',
'phase4-tail-order-controls',
'phase4-overseas-pda',
'phase4-overseas-pda-operations',
'phase4-overseas-dispatch',
'phase5-overseas-fulfillment',
'manual-state-matrix',
]
assert.deepEqual(normalizeModuleOrder(['order-inbound-status-fixtures', 'manual-state-matrix']), expected)
@@ -57,6 +80,13 @@ test('focused splitting and manual groups resolve producers before consumers wit
'service-center-flow',
'phase3-outbound-dispatch',
'phase3-container-documents',
'phase3-carrier-schedule-queries',
'phase4-carrier-pickup-ready',
'phase4-tail-order-controls',
'phase4-overseas-pda',
'phase4-overseas-pda-operations',
'phase4-overseas-dispatch',
'phase5-overseas-fulfillment',
'manual-state-matrix',
]
assert.deepEqual(normalizeModuleOrder([
@@ -92,10 +122,10 @@ test('fixture-unavailable statuses stay supported without becoming hard requirem
assert.deepEqual(matrix.pages.inbounds.supportedStatuses,
['WAIT_MEASURE', 'MEASURE_REJECTED', 'WAIT_PRICING', 'FEE_CONFIRMING', 'INBOUNDING', 'VOIDED'])
assert.deepEqual(matrix.pages.inbounds.requiredStatuses, ['WAIT_MEASURE'])
assert.deepEqual(matrix.pages.unifiedOrders.requiredStatuses, ['WAIT_SPLIT', 'LOADING', 'LOADED'])
assert.deepEqual(matrix.pages.unifiedOrders.requiredStatuses, ['WAIT_SPLIT', 'LOADING', 'LOADED', 'DELIVERED'])
assert.equal(matrix.pages.inbounds.coverageGaps.WAIT_PRICING.category, 'fixture-unavailable')
assert.equal(matrix.pages.unifiedOrders.coverageGaps.DELIVERED.category, 'fixture-unavailable')
assert.deepEqual(missingRequiredStateFixtures(matrix), [])
assert.equal(matrix.pages.unifiedOrders.coverageGaps, undefined)
assert.deepEqual(missingRequiredStateFixtures(matrix), ['unifiedOrders:DELIVERED'])
assert.match(source, /gap\.category, \{ marker: context\.marker, page, status, blocking: false \}/)
})