fix: show dropship outbound measurements

This commit is contained in:
2026-09-18 15:23:43 +08:00
parent f64dedfb52
commit e10d0534ae
5 changed files with 30 additions and 4 deletions
@@ -1,6 +1,6 @@
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { overseasHttp } from '@/shared/api/overseasHttp'
import { cancelOutbound, createOneClickDropshipOutbound, getOutbound, listOutbounds } from './outbounds'
import { cancelOutbound, createOneClickDropshipOutbound, getOutbound, listOneClickOutboundCandidates, listOutbounds } from './outbounds'
vi.mock('@/shared/api/overseasHttp', () => ({ overseasHttp: { get: vi.fn(), post: vi.fn() } }))
@@ -28,4 +28,16 @@ describe('outbound overseas API', () => {
await createOneClickDropshipOutbound('customer-1', payload)
expect(overseasHttp.post).toHaveBeenCalledWith('/platform/v1/last-leg/outbound-orders/one-click-dropship', payload, { params: { customerId: 'customer-1' } })
})
it('normalizes one-click candidate measurements returned as decimal strings', async () => {
vi.mocked(overseasHttp.get).mockResolvedValue({ code: '200', data: [{
inventoryPositionId: '99', availablePackages: 4,
grossWeightKg: '40.000', volumeWeightKg: '80.000', volumeCbm: '4.0000',
}] })
const [candidate] = await listOneClickOutboundCandidates(undefined, { warehouseId: 'warehouse-1' })
expect(candidate).toMatchObject({
inventoryPositionId: '99', availablePackages: 4,
grossWeightKg: 40, volumeWeightKg: 80, volumeCbm: 4,
})
})
})