test(firstleg): cover phase3 outbound contracts

This commit is contained in:
2026-08-08 22:42:49 +08:00
parent 66d1aa0d3d
commit 9b88fb4b9e
12 changed files with 810 additions and 50 deletions
@@ -0,0 +1,28 @@
function resource(context, key) {
const value = context.createdResources?.[key]
if (!value) return { available: false }
return {
available: true,
marker: value.marker || context.marker,
tenantId: value.tenantId || null,
inboundId: value.inboundId || null,
orderId: value.orderId || null,
loadingPlanId: value.loadingPlanId || value.preloadPlanId || null,
containerBookingId: value.containerBookingId || null,
oceanBookingId: value.oceanBookingId || (key === 'oceanBooking' ? value.id : null),
truckAppointmentId: value.appointmentId || (key === 'truckAppointment' ? value.id : null),
finalStatus: value.finalStatus || null,
}
}
export function registerPendingContract(context, spec) {
const fixtures = Object.fromEntries(spec.fixtures.map((key) => [key, resource(context, key)]))
context.addCoverageGap(spec.module, spec.scenario, spec.name, spec.reason, spec.category, {
fixture: fixtures,
activation: {
state: 'pending-public-api',
contractSource: spec.contractSource,
assertions: spec.assertions,
},
})
}