优化
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import { readFileSync } from 'node:fs'
|
||||
import test from 'node:test'
|
||||
|
||||
const source = readFileSync(new URL('./phase3-evidence-gate.mjs', import.meta.url), 'utf8')
|
||||
|
||||
test('evidence gate requires stable PDA identity and server LOADING before any evidence request', () => {
|
||||
for (const field of ['taskId', 'inboundId', 'loadingPlanId', 'containerBookingId', 'warehouseId']) {
|
||||
assert.match(source, new RegExp(`${field}`), `${field} must be part of the preflight identity`)
|
||||
}
|
||||
assert.match(source, /pda-loading\/tasks\?loadingPlanId=/)
|
||||
assert.match(source, /task\?\.id\) === taskId/)
|
||||
assert.match(source, /task\?\.loadingPlanId\) === loadingPlanId/)
|
||||
assert.match(source, /task\?\.containerBookingId\) === containerBookingId/)
|
||||
assert.match(source, /taskItem\?\.inboundId\) === inboundId/)
|
||||
assert.match(source, /processStatus === 'LOADING'/)
|
||||
assert.match(source, /if \(!serverLoading\)[\s\S]*return/)
|
||||
assert.match(source, /AWAITING_REVIEW 不作为证据开放条件/)
|
||||
const gate = source.slice(source.indexOf('const taskResponse'), source.indexOf('const path ='))
|
||||
assert.doesNotMatch(gate, /loading\/evidence/)
|
||||
assert.match(source, /const path = `\/api\/platform\/inbounds\/\$\{inboundId\}\/loading\/evidence/)
|
||||
})
|
||||
Reference in New Issue
Block a user