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, }, }) }