33 lines
1.5 KiB
TypeScript
33 lines
1.5 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import {
|
|
unifiedOrderFulfillmentRoleLabel,
|
|
unifiedOrderFulfillmentStatusLabel,
|
|
unifiedOrderHistoryActionLabel,
|
|
unifiedOrderLoadingStatusLabel,
|
|
unifiedOrderReviewStatusLabel,
|
|
unifiedOrderStatusLabel,
|
|
} from './status'
|
|
|
|
describe('unified order status labels', () => {
|
|
it('maps order, review and loading statuses to domain-specific Chinese', () => {
|
|
expect(unifiedOrderStatusLabel('WAIT_SPLIT')).toBe('待分柜')
|
|
expect(unifiedOrderReviewStatusLabel('APPROVED')).toBe('审核通过')
|
|
expect(unifiedOrderLoadingStatusLabel('LOADED')).toBe('已配载')
|
|
expect(unifiedOrderHistoryActionLabel('DECLARATION_UPDATE')).toBe('客户申报资料变更')
|
|
})
|
|
|
|
it('never exposes unknown backend enums', () => {
|
|
expect(unifiedOrderStatusLabel('NEW_ORDER_STATE')).toBe('未知状态')
|
|
expect(unifiedOrderReviewStatusLabel('NEW_REVIEW_STATE')).toBe('未知状态')
|
|
expect(unifiedOrderLoadingStatusLabel('NEW_LOADING_STATE')).toBe('未知状态')
|
|
expect(unifiedOrderHistoryActionLabel('NEW_ACTION')).toBe('状态更新')
|
|
expect(unifiedOrderFulfillmentRoleLabel('NEW_ROLE')).toBe('未知类型')
|
|
expect(unifiedOrderFulfillmentStatusLabel('NEW_FRAGMENT_STATE', 'REMAINDER')).toBe('未知状态')
|
|
})
|
|
|
|
it('uses the fragment role when a fulfillment status is absent', () => {
|
|
expect(unifiedOrderFulfillmentStatusLabel(null, 'ACTIVE_REMAINDER')).toBe('当前余量')
|
|
expect(unifiedOrderFulfillmentStatusLabel(undefined, 'COMPLETED_FRAGMENT')).toBe('已完成分片')
|
|
})
|
|
})
|