test(fba): preserve verified fleet and fulfillment acceptance workflows
This commit is contained in:
@@ -3,6 +3,7 @@ import { resolve } from 'node:path'
|
||||
import { AcceptanceRun, parseArguments, validateExecutionOptions } from './admin-test-env-acceptance.mjs'
|
||||
import { createPicker, disablePicker, resolvePickerAccess } from './admin-test-env-modules/phase4-overseas-pda.mjs'
|
||||
import { pickAll, saveReceiptAndComplete } from './admin-test-env-modules/phase5-overseas-fulfillment.mjs'
|
||||
import { confirmFleetLoading } from './admin-test-env-modules/fleet-trip-fulfillment.mjs'
|
||||
|
||||
// Explicit retained fixture continuation, not a new fixture generator.
|
||||
const [sourcePath, containerNo, label, outputPath] = process.argv.slice(2)
|
||||
@@ -114,9 +115,14 @@ try {
|
||||
if (!picker?.token) throw new Error('PDA operator unavailable')
|
||||
result.pickerMembershipId = picker.membershipId
|
||||
save()
|
||||
const tripTask = await api('GET', `/api/pda/v1/last-leg/dispatches/${result.dispatchNo}`, undefined, picker.token)
|
||||
if (!tripTask.tripNo) throw new Error('Retained dispatch must be assigned to a qualified fleet trip before picking; prepare through the current fleet API')
|
||||
const trip = await api('GET', `${base}/fleet/trips/${encodeURIComponent(tripTask.tripNo)}`)
|
||||
if (dispatch.status !== 'READY_TO_DEPART' && !await pickAll(context, picker.token, result.dispatchNo)) throw new Error('PDA picking failed')
|
||||
const tripVersion = await confirmFleetLoading(context, 'mixed-container-outbound', { tripNo: tripTask.tripNo, stops: trip.trip.stops })
|
||||
result.departure = await api('POST', `/api/pda/v1/last-leg/dispatches/${result.dispatchNo}/depart`,
|
||||
{ idempotencyKey: `${context.marker}-DEPART`, remark: `${context.marker}-test-only` }, picker.token)
|
||||
{ recordVersion: tripVersion, idempotencyKey: `${context.marker}-DEPART`.slice(0,128), remark: `${context.marker}-test-only` }, picker.token)
|
||||
if (result.departure.status !== 'IN_TRANSIT' || !result.departure.dispatches?.some(item => item.dispatchNo === result.dispatchNo)) throw new Error('Whole-trip departure result missing retained dispatch')
|
||||
save()
|
||||
}
|
||||
const deliveries = result.transfer.deliveries
|
||||
|
||||
Reference in New Issue
Block a user