fix(test): select container-backed PDA fixtures

This commit is contained in:
2026-08-24 16:40:25 +08:00
parent 6aca41427c
commit 8e12dd9a38
2 changed files with 5 additions and 2 deletions
@@ -26,6 +26,7 @@ test('PDA module covers the complete receiving lifecycle and excludes outbound d
assert.match(source, /requestId=/)
assert.match(source, /traceId=/)
assert.match(source, /PENDING_ASSIGNMENT/)
assert.match(source, /nonBlank\(item\?\.containerNo\)/)
assert.match(source, /expectedCartons/)
})
@@ -4,6 +4,7 @@ const OPTIONS = { scenario: SCENARIO, deploymentBlocker: true }
function id(value) { return value == null ? '' : String(value) }
function longId(value) { return /^\d+$/.test(id(value)) && id(value) !== '0' }
function nonBlank(value) { return typeof value === 'string' && value.trim().length > 0 }
function records(page) { return Array.isArray(page?.records) ? page.records : [] }
function query(path, params) {
const search = new URLSearchParams()
@@ -39,7 +40,8 @@ async function findUnplannedOrder(context) {
const planned = new Set(records(plans.data).map((item) => id(item?.sourceOrderId)).filter(Boolean))
const orders = await overseas(context, 'GET', `查询客户${customerId}待规划尾程单`, query('/api/platform/v1/last-leg/orders', { customerId, currentStatus: 'PENDING_ASSIGNMENT', page: 1, size: 200 }))
if (!success(orders.response)) continue
const order = records(orders.data).find((item) => longId(item?.id) && !planned.has(id(item.id)))
const order = records(orders.data).find((item) => longId(item?.id) && nonBlank(item?.containerNo)
&& !planned.has(id(item.id)))
if (order) return { customerId, order }
}
return null
@@ -123,7 +125,7 @@ export async function run(context) {
const source = await findUnplannedOrder(context)
if (!source) {
context.addCoverageGap(MODULE, SCENARIO, 'PDA入仓来源尾程单',
'所有ACTIVE客户均无尚未转换、状态为PENDING_ASSIGNMENT的尾程单;请先运行三期装柜完成事件链', 'fixture-unavailable')
'所有ACTIVE客户均无尚未转换、状态为PENDING_ASSIGNMENT且具有柜号的尾程单;请先运行三期装柜完成事件链', 'fixture-unavailable')
return
}
const { customerId, order } = source