diff --git a/src/modules/overseas-business/api/platformOverseasBusiness.test.ts b/src/modules/overseas-business/api/platformOverseasBusiness.test.ts index e28a4baa..084ef4e6 100644 --- a/src/modules/overseas-business/api/platformOverseasBusiness.test.ts +++ b/src/modules/overseas-business/api/platformOverseasBusiness.test.ts @@ -36,6 +36,24 @@ const looseboardSummary = { describe('platform overseas business API adapter', () => { beforeEach(() => vi.clearAllMocks()) + it('loads the six-table procurement projection without requiring legacy facts', async () => { + overseas.get.mockResolvedValue(envelope({ + customerView: { order: { ...purchaseSummary, status: 'RECEIVING', version: '1', purchaseQuantity: '10' }, boxes: [], shipments: [], fees: [] }, + purchaseFacts: {}, physical: { dispositions: [], receipts: [], cartons: [] }, + transport: { overseasCargo: [], domesticCargo: [], shipments: [] }, + controls: { notes: [], remaining: [], closures: [], closureItems: [] }, + fees: [], feeCorrections: [], operations: [], actions: [], reviewHistory: [], internalRemark: null, + files: [{ id: '901', fileId: '9007199254740995', sizeBytes: '123' }], + })) + const detail = await getOverseasPurchase('OP-1', '10001') + expect(detail.customerView.order.version).toBe(1) + expect(detail.customerView.order.purchaseQuantity).toBe(10) + expect(detail.files[0]).toMatchObject({ id: '901', fileId: '9007199254740995', sizeBytes: 123 }) + expect(detail.physical.receipts).toEqual([]) + expect(detail.actions).toEqual([]) + expect(overseas.get).toHaveBeenCalledTimes(1) + }) + it('normalizes wire integer strings before building replayable procurement commands', async () => { overseas.get.mockResolvedValue(envelope({ customerView: { order: { ...purchaseSummary, version: '0', purchaseQuantity: '1' }, boxes: [{ quantity: '1' }], shipments: [{ quantity: '1' }], fees: [{ version: '2' }] },