优化
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { inventoryProductName, toInventoryListItem } from './inventoryPresentation'
|
||||
|
||||
describe('overseas inventory presentation adapter', () => {
|
||||
it('maps the latest singular balance DTO fields without inventing position data', () => {
|
||||
const row = toInventoryListItem({
|
||||
id: '2089652067743272963',
|
||||
customerId: '990018',
|
||||
customerName: 'Acceptance Customer',
|
||||
overseasWarehouseId: '990018000000000001',
|
||||
overseasWarehouseName: 'Acceptance US Warehouse',
|
||||
inboundOrderId: '2089652066950549505',
|
||||
inboundOrderNo: 'LIP2089652067021852673',
|
||||
inboundCode: 'ACCEPT-20260818-R4-IN-03B',
|
||||
skuCode: 'SKU-ACCEPT-1',
|
||||
productNameZh: '验收商品',
|
||||
productNameEn: 'Acceptance Product',
|
||||
totalPackages: 20,
|
||||
availablePackages: 18,
|
||||
holdPackages: 2,
|
||||
allocatedPackages: 0,
|
||||
pickedPackages: 0,
|
||||
inTransitPackages: 0,
|
||||
receivingPackages: 0,
|
||||
procurementPackages: 0,
|
||||
updatedAt: '2026-08-18T17:54:11',
|
||||
})
|
||||
|
||||
expect(row).toMatchObject({
|
||||
id: '2089652067743272963',
|
||||
customerId: '990018',
|
||||
sku: 'SKU-ACCEPT-1',
|
||||
productName: '验收商品',
|
||||
location: '—',
|
||||
onHand: 20,
|
||||
available: 18,
|
||||
held: 2,
|
||||
status: '存在暂扣',
|
||||
})
|
||||
})
|
||||
|
||||
it('falls back to the English product name only when the Chinese name is absent', () => {
|
||||
expect(inventoryProductName({
|
||||
id: '1', customerId: '2', overseasWarehouseId: '3', inboundOrderId: '4', inboundCode: 'IN-1',
|
||||
productNameEn: 'English Product', totalPackages: 0, availablePackages: 0, holdPackages: 0,
|
||||
allocatedPackages: 0, pickedPackages: 0, inTransitPackages: 0, receivingPackages: 0,
|
||||
procurementPackages: 0,
|
||||
})).toBe('English Product')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user