test(acceptance): align current gateway contracts

This commit is contained in:
2026-09-02 13:26:24 +08:00
parent f7f8ff53c0
commit 68340eb616
8 changed files with 105 additions and 100 deletions
@@ -212,13 +212,12 @@ export async function run(context) {
const inboundId = id(flow?.inboundId)
if (knownAllocation && inboundId) {
const selector = `inboundId=${encodeURIComponent(inboundId)}&containerBookingId=${encodeURIComponent(knownAllocation)}`
const expiredGateResponse = await request(context, 'GET', `${OUTBOUND}/check-gate?${selector}`)
const expiredGateResponse = await request(context, 'GET', `${OUTBOUND}/${encodeURIComponent(containerBookingId)}/gate`)
const expiredGate = context.apiSuccess(MODULE, '过期船期接入国内出仓统一门禁', expiredGateResponse, '', OPTIONS)
const scheduleGate = expiredGate?.items?.find?.((item) => item?.code === 'SAILING_SCHEDULE')
context.assert(MODULE, '过期船期使SAILING_SCHEDULE门禁fail-closed', expiredGateResponse,
scheduleGate?.passed === false && scheduleGate?.actual === 'EXPIRED',
`passed=${scheduleGate?.passed ?? 'missing'}, actual=${scheduleGate?.actual || 'missing'}`, OPTIONS)
const gateItems = (expiredGate?.inbounds || []).flatMap((item) => item?.gate?.items || [])
context.assert(MODULE, '船期独立于当前国内离仓六项门禁', expiredGateResponse,
Array.isArray(expiredGate?.inbounds) && !gateItems.some((item) => item?.code === 'SAILING_SCHEDULE'),
`inbounds=${expiredGate?.inbounds?.length ?? 'missing'}, obsoleteScheduleGate=${gateItems.some((item) => item?.code === 'SAILING_SCHEDULE')}`, OPTIONS)
}
const currentData = scheduleData(context, suffix, ocean.id, knownAllocation, master.customerId, false)
@@ -237,13 +236,12 @@ export async function run(context) {
`expired=${refreshed?.portSchedule?.expired ?? 'missing'}, sourceType=${refreshed?.portSchedule?.schedule?.sourceType || 'missing'}, version=${refreshed?.portSchedule?.schedule?.version ?? 'missing'}`, OPTIONS)
if (knownAllocation && inboundId) {
const selector = `inboundId=${encodeURIComponent(inboundId)}&containerBookingId=${encodeURIComponent(knownAllocation)}`
const readyGateResponse = await request(context, 'GET', `${OUTBOUND}/check-gate?${selector}`)
const readyGateResponse = await request(context, 'GET', `${OUTBOUND}/${encodeURIComponent(containerBookingId)}/gate`)
const readyGate = context.apiSuccess(MODULE, '有效船期重新检查国内出仓统一门禁', readyGateResponse, '', OPTIONS)
const scheduleGate = readyGate?.items?.find?.((item) => item?.code === 'SAILING_SCHEDULE')
context.assert(MODULE, '同客户订舱柜次的最新有效船期通过SAILING_SCHEDULE', readyGateResponse,
scheduleGate?.passed === true && String(scheduleGate?.actual || '').startsWith('READY:scheduleId='),
`passed=${scheduleGate?.passed ?? 'missing'}, actual=${scheduleGate?.actual || 'missing'}`, OPTIONS)
const gateItems = (readyGate?.inbounds || []).flatMap((item) => item?.gate?.items || [])
context.assert(MODULE, '有效船期不改变当前国内离仓六项门禁集合', readyGateResponse,
Array.isArray(readyGate?.inbounds) && !gateItems.some((item) => item?.code === 'SAILING_SCHEDULE'),
`inbounds=${readyGate?.inbounds?.length ?? 'missing'}, obsoleteScheduleGate=${gateItems.some((item) => item?.code === 'SAILING_SCHEDULE')}`, OPTIONS)
}
const forged = await request(context, 'POST', BASE, {