优化
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { formatOverseasDateTime, inventoryBusinessTypeLabel, lastMileOrderReference, relabelBusinessStatusLabel, toLastMileOrderListItem } from './lastMilePresentation'
|
||||
import { formatOverseasDateTime, inventoryBusinessTypeLabel, lastMileOrderReference, lastMileStatusLabel, packageDifferenceText, relabelBusinessStatusLabel, toLastMileOrderListItem } from './lastMilePresentation'
|
||||
|
||||
describe('last-mile order presentation adapter', () => {
|
||||
it('formats overseas timestamps with zero-padded seconds', () => {
|
||||
@@ -85,6 +85,30 @@ describe('last-mile order presentation adapter', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('maps warehouse transfer receiving quantities and formats differences', () => {
|
||||
const transfer = toLastMileOrderListItem({
|
||||
id: '4', customerId: '100', orderNo: 'WT-1', orderType: 'WAREHOUSE_TRANSFER',
|
||||
packageCount: 10, receivedPackageCount: 12, packageDifference: 2,
|
||||
})
|
||||
expect(transfer).toMatchObject({ cartons: 10, cartonDifference: 2 })
|
||||
expect(packageDifferenceText(2)).toBe('+2')
|
||||
expect(packageDifferenceText(-2)).toBe('-2')
|
||||
expect(packageDifferenceText(0)).toBe('0')
|
||||
expect(packageDifferenceText('—')).toBe('—')
|
||||
|
||||
const ordinary = toLastMileOrderListItem({ id: '5', customerId: '100', orderNo: 'LM-1', orderType: 'FIRST_LEG', packageCount: 10 })
|
||||
expect(ordinary).toMatchObject({ cartons: 10, cartonDifference: '—' })
|
||||
})
|
||||
|
||||
it.each([
|
||||
['PENDING_REVIEW', '待审核'],
|
||||
['WAIT_PDA_RECEIVING', '入库测量中'],
|
||||
['WAIT_CUSTOMER_CONFIRMATION', '待客户确认实测'],
|
||||
['INBOUND_COMPLETED', '入库完成'],
|
||||
])('maps warehouse transfer status %s to %s', (status, expected) => {
|
||||
expect(lastMileStatusLabel(status)).toBe(expected)
|
||||
})
|
||||
|
||||
it.each([
|
||||
['RELABEL_APPLICATION', '换标下单'],
|
||||
['WAREHOUSE_TRANSFER', '仓储转运'],
|
||||
@@ -108,7 +132,7 @@ describe('last-mile order presentation adapter', () => {
|
||||
it.each([
|
||||
['PENDING_PROCESSING', '待处理'],
|
||||
['PROCESSING', '处理中'],
|
||||
['CUSTOMER_CONFIRM_PENDING', '待处理'],
|
||||
['CUSTOMER_CONFIRM_PENDING', '换标完成'],
|
||||
['READY_FOR_OUTBOUND', '换标完成'],
|
||||
['COMPLETED', '换标完成'],
|
||||
])('collapses internal relabel node %s into business status %s', (status, expected) => {
|
||||
|
||||
Reference in New Issue
Block a user