27 lines
1.3 KiB
TypeScript
27 lines
1.3 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { customsCaseStatusOptions, customsHistoryActionLabel, customsStatusLabel } from './status'
|
|
|
|
describe('customs status labels', () => {
|
|
it('matches the backend customs case state machine', () => {
|
|
expect(customsCaseStatusOptions).toEqual([
|
|
{ value: 'DOCUMENTS_PENDING', label: '待补资料' },
|
|
{ value: 'REVIEWING', label: '审核中' },
|
|
{ value: 'SUPPLEMENT_REQUIRED', label: '需补件' },
|
|
{ value: 'READY_TO_SUBMIT', label: '待提交代理' },
|
|
{ value: 'RECEIPT_PENDING', label: '待回执' },
|
|
{ value: 'RECEIPT_AVAILABLE', label: '已有回执' },
|
|
{ value: 'CLEARANCE_COMPLETED', label: '已放行' },
|
|
{ value: 'CANCELLED', label: '已取消' },
|
|
])
|
|
})
|
|
|
|
it('localizes status transitions and does not expose backend codes', () => {
|
|
expect(customsStatusLabel('READY_TO_SUBMIT')).toBe('待提交代理')
|
|
expect(customsStatusLabel(null)).toBe('—')
|
|
expect(customsStatusLabel('FUTURE_STATUS')).toBe('未知状态')
|
|
expect(customsHistoryActionLabel('REVIEW_DOCUMENT_RETURN')).toBe('退回补件')
|
|
expect(customsHistoryActionLabel('SUBMIT_AGENT_BATCH')).toBe('提交报关代理')
|
|
expect(customsHistoryActionLabel('FUTURE_ACTION')).toBe('状态更新')
|
|
})
|
|
})
|