This commit is contained in:
2026-10-27 18:30:33 +08:00
parent fbb7d4fe24
commit 8e97fd6a9f
@@ -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' }] },