Files
admin-web/src/modules/appointment-calendar/batch.test-support.ts
T

12 lines
1.5 KiB
TypeScript

import type { FbaAppointmentBatchContext } from './batchApi'
export function batchContext(number = 'AP-001', key = 'FBA_APPOINTMENT:1'): FbaAppointmentBatchContext {
const appointment: FbaAppointmentBatchContext['appointment'] = { id: '1', appointmentNo: number, batchKey: key, version: 3, appointmentStatus: 'PENDING', originWarehouseId: 'origin-1', fbaWarehouseCode: 'ONT8', selectedCount: 2, replacementAppointmentNos: [], replacementBatchKeys: [], items: [
{ id: 'item-1', customerId: 'customer-a', sourceKey: 'ORDER:1', destinationKey: 'FBA:ONT8', inboundCode: 'IN-A', fbaWarehouseCode: 'ONT8', packageCount: 70, shipmentReferences: ['FBA-A'] },
{ id: 'item-2', customerId: 'customer-b', sourceKey: 'BOOKING:2', destinationKey: 'FBA:ONT8', inboundCode: 'IN-B', fbaWarehouseCode: 'ONT8', packageCount: 30, shipmentReferences: ['FBA-B'] },
] }
return { appointment, originalSourceRefs: appointment.items.map(item => ({ customerId: item.customerId, sourceKey: item.sourceKey, destinationKey: item.destinationKey! })), currentBatches: [appointment], sources: [
{ customerId: 'customer-a', sourceKey: 'ORDER:1', destinationKey: 'FBA:ONT8', packageCount: 70, originalPackages: 100, sourceVersion: 'source-a-v2', cargoVerificationVersion: 4, shipmentReferences: ['FBA-A'] },
{ customerId: 'customer-b', sourceKey: 'BOOKING:2', destinationKey: 'FBA:ONT8', packageCount: 30, originalPackages: null, sourceVersion: null, cargoVerificationVersion: 2, shipmentReferences: ['FBA-B'] },
], allowedActions: ['VERIFY_CARGO', 'SPLIT', 'MERGE'], blockReasons: [] }
}