test: align phase five dev acceptance flows

This commit is contained in:
2026-09-02 03:32:35 +08:00
parent f3be06a3e0
commit a4a4306154
13 changed files with 106 additions and 103 deletions
@@ -84,8 +84,23 @@ export async function run(context) {
step(context, 'DRAFT 补齐完整订舱资料', complete, !failed(complete), `bookingId=${bookingId}, HTTP=${complete.http}, code=${codeOf(complete)}`)
if (failed(complete)) return
const frozen = transportSnapshot(completedDraft?.oceanBooking || data)
const documentForm = new FormData()
documentForm.append('expectedVersion', String(completeVersion))
documentForm.append('documentType', 'BOOKING_CONFIRMATION')
documentForm.append('file', new Blob([`${context.marker}-BOOKING_CONFIRMATION`], { type: 'text/plain' }),
`booking-confirmation-${suffix}.txt`)
const documentResponse = await context.requestMultipart('POST', `${BASE}/${bookingId}/documents/upload`,
documentForm, context.token, { 'Idempotency-Key': `${context.marker}-ocean-booking-document`.slice(0, 128) })
const document = context.apiSuccess(MODULE, '放舱前上传当前有效订舱确认文件', documentResponse, '', OPTIONS)
const documentVersion = Number(document?.bookingVersion)
context.assert(MODULE, '订舱确认文件归属当前订舱且递增版本', documentResponse,
Boolean(document?.document?.id) && id(document?.document?.oceanBookingId) === bookingId
&& document?.document?.documentType === 'BOOKING_CONFIRMATION' && document?.document?.valid === true
&& Number.isInteger(documentVersion) && documentVersion > completeVersion,
`documentId=${id(document?.document?.id) || 'missing'}, bookingVersion=${document?.bookingVersion ?? 'missing'}`, OPTIONS)
if (!Number.isInteger(documentVersion) || documentVersion <= completeVersion) return
const finalRelease = await request(context, 'POST', `${BASE}/${bookingId}/release`,
{ expectedVersion: completeVersion, reason: context.marker },
{ expectedVersion: documentVersion, reason: context.marker },
{ 'Idempotency-Key': `${context.marker}-ocean-final-release`.slice(0, 128) })
const released = payload(finalRelease)
step(context, '完整 DRAFT 放舱为 RELEASED 且冻结五项运输事实', finalRelease,