test(firstleg): cover phase3 outbound contracts
This commit is contained in:
@@ -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,
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user