This commit is contained in:
2026-08-11 18:43:56 +08:00
parent 6456278ec8
commit 6622815d6c
37 changed files with 739 additions and 205 deletions
+21
View File
@@ -0,0 +1,21 @@
import { describe, expect, it } from 'vitest'
import { oceanBookingStatusLabel, oceanBookingStatusOptions } from './status'
describe('ocean booking status labels', () => {
it('translates every backend status for selectors and badges', () => {
expect(oceanBookingStatusOptions).toEqual([
{ value: 'DRAFT', label: '草稿' },
{ value: 'SUBMITTED', label: '已提交' },
{ value: 'CONFIRMED', label: '已确认' },
{ value: 'RELEASED', label: '已放舱' },
{ value: 'FAILED', label: '订舱失败' },
{ value: 'CHANGE_PENDING', label: '变更中' },
{ value: 'CANCELLED', label: '已取消' },
])
})
it('does not leak unknown backend enum values to users', () => {
expect(oceanBookingStatusLabel('NEW_BACKEND_STATUS')).toBe('未知状态')
expect(oceanBookingStatusLabel(null)).toBe('未设置')
})
})