优化
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { financeBusinessTypeLabel, financeDocumentTypeLabel, financeOperationActionLabel, financeOperationResultLabel, financeSourceTypeLabel, financeStatusLabel, financeStatusTone } from './status'
|
||||
|
||||
describe('finance status presentation', () => {
|
||||
it.each([
|
||||
['DRAFT', '草稿'],
|
||||
['PENDING_REVIEW', '待审核'],
|
||||
['ISSUED', '已出账'],
|
||||
['REJECTED', '已驳回'],
|
||||
['PARTIALLY_PAID', '部分结清'],
|
||||
['PAID', '已结清'],
|
||||
['VOIDED', '已作废'],
|
||||
['AVAILABLE', '待结算'],
|
||||
['LOCKED', '结算锁定'],
|
||||
['BILLED', '已入账'],
|
||||
['RECORDED', '已登记'],
|
||||
['CONFIRMED', '已确认'],
|
||||
['ACTIVE', '正常'],
|
||||
['DISABLED', '停用'],
|
||||
])('maps %s to %s', (status, label) => {
|
||||
expect(financeStatusLabel(status)).toBe(label)
|
||||
})
|
||||
|
||||
it.each([undefined, null, '', 'NEW_BACKEND_STATUS', 1])('never exposes unknown status %s', (status) => {
|
||||
expect(financeStatusLabel(status)).toBe('未知状态')
|
||||
expect(financeStatusTone(status)).toBe('info')
|
||||
})
|
||||
|
||||
it('translates source and ledger codes without exposing unknown values', () => {
|
||||
expect(financeSourceTypeLabel('CONTAINER_COST')).toBe('整柜成本')
|
||||
expect(financeBusinessTypeLabel('RECEIPT')).toBe('收款')
|
||||
expect(financeDocumentTypeLabel('SETTLEMENT')).toBe('结算单')
|
||||
expect(financeOperationActionLabel('APPROVE')).toBe('审核通过')
|
||||
expect(financeOperationResultLabel('SUCCESS')).toBe('操作成功')
|
||||
expect(financeSourceTypeLabel('NEW_SOURCE')).toBe('其他来源')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user