test(admin): complete phase3 producer fixtures

This commit is contained in:
2026-08-11 18:07:59 +08:00
parent 47c1c7922f
commit 8a65f18fce
4 changed files with 67 additions and 4 deletions
@@ -39,7 +39,8 @@ export async function run(context) {
context.apiSuccess(MODULE, '创建隔离海运订舱', createResponse, `key=${key}`, OPTIONS)
context.assert(MODULE, '订舱 DTO 字段、DRAFT 和9类关联字段完整', createResponse, Boolean(bookingId) && detail?.oceanBooking?.status === 'DRAFT' && detail?.parties?.length === 3 && detail?.containerRequirements?.length === 1, `bookingId=${bookingId || 'missing'}, parties=${detail?.parties?.length ?? 'n/a'}, requirements=${detail?.containerRequirements?.length ?? 'n/a'}`, OPTIONS)
if (!bookingId) return
context.createdResources.oceanBooking = { id: bookingId, customerId: '10001', marker: context.marker, finalStatus: 'RELEASED' }
context.createdResources.oceanBooking = { id: bookingId, customerId: '10001', marker: context.marker,
containerBookingId: null, loadingPlanId: null, finalStatus: 'DRAFT' }
const replay = await createBooking(context, suffix, key)
context.assert(MODULE, '创建 Idempotency-Key 重放返回同一订舱', replay, String(data(replay)?.oceanBooking?.id) === bookingId, `first=${bookingId}, replay=${id(data(replay)?.oceanBooking?.id)}`, OPTIONS)
const path = `${BASE}/${bookingId}`
@@ -84,6 +85,12 @@ export async function run(context) {
fd?.oceanBooking?.status === 'RELEASED' && fd.histories?.length >= 5 && fd.histories.every((h) => h.operatorName)
&& (!containerFlow || fd?.containerAllocations?.some?.((item) => id(item?.containerBookingId) === id(containerFlow.containerBookingId))),
`status=${fd?.oceanBooking?.status || 'missing'}, histories=${fd?.histories?.length ?? 'n/a'}, allocations=${fd?.containerAllocations?.length ?? 'n/a'}`, OPTIONS)
context.createdResources.oceanBooking = {
id: bookingId, customerId: id(fd?.oceanBooking?.customerId), marker: context.marker,
containerBookingId: containerFlow ? id(containerFlow.containerBookingId) : null,
loadingPlanId: containerFlow ? id(containerFlow.loadingPlanId) : null,
finalStatus: fd?.oceanBooking?.status || null,
}
const missingDetail = await request(context, 'GET', `${BASE}/999999999999999999`)
step(context, '不存在订舱详情安全失败', missingDetail, failure(missingDetail), `HTTP=${missingDetail.http}, code=${codeOf(missingDetail)}`)
}