2026-08-11 19:35:28 +08:00
|
|
|
import { describe, expect, it } from 'vitest'
|
2026-08-11 19:59:15 +08:00
|
|
|
import { financeBusinessTypeLabel, financeDirectionLabel, financeDocumentTypeLabel, financeOperationActionLabel, financeOperationResultLabel, financeSourceTypeLabel, financeStatusLabel, financeStatusTone } from './status'
|
2026-08-11 19:35:28 +08:00
|
|
|
|
|
|
|
|
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('收款')
|
2026-08-17 16:45:46 +08:00
|
|
|
expect(financeBusinessTypeLabel('RECONCILIATION_CREATED')).toBe('生成对账单')
|
|
|
|
|
expect(financeBusinessTypeLabel('SETTLEMENT_ISSUED')).toBe('结算单生效')
|
|
|
|
|
expect(financeBusinessTypeLabel('PAYMENT')).toBe('付款')
|
|
|
|
|
expect(financeBusinessTypeLabel('VOID')).toBe('作废')
|
|
|
|
|
expect(financeBusinessTypeLabel('NEW_BUSINESS')).toBe('未知业务类型')
|
2026-08-11 19:35:28 +08:00
|
|
|
expect(financeDocumentTypeLabel('SETTLEMENT')).toBe('结算单')
|
|
|
|
|
expect(financeOperationActionLabel('APPROVE')).toBe('审核通过')
|
2026-08-19 09:14:35 +08:00
|
|
|
expect(financeOperationActionLabel('FEE_SOURCE_REVIEW_APPROVE')).toBe('审核通过')
|
2026-08-17 16:45:46 +08:00
|
|
|
expect(financeOperationActionLabel('RECONCILIATION_ADJUST')).toBe('调整对账单')
|
|
|
|
|
expect(financeOperationActionLabel('SETTLEMENT_PAYMENT_CREATE')).toBe('登记收付款')
|
2026-08-11 19:35:28 +08:00
|
|
|
expect(financeOperationResultLabel('SUCCESS')).toBe('操作成功')
|
2026-08-11 19:59:15 +08:00
|
|
|
expect(financeDirectionLabel('RECEIVABLE')).toBe('应收')
|
|
|
|
|
expect(financeDirectionLabel('PAYABLE')).toBe('应付')
|
|
|
|
|
expect(financeDirectionLabel('NEW_DIRECTION')).toBe('未知方向')
|
2026-08-17 16:45:46 +08:00
|
|
|
expect(financeSourceTypeLabel('NEW_SOURCE')).toBe('未知来源类型')
|
|
|
|
|
expect(financeDocumentTypeLabel('NEW_DOCUMENT')).toBe('未知单据类型')
|
|
|
|
|
expect(financeOperationActionLabel('NEW_ACTION')).toBe('未知操作')
|
2026-08-11 19:35:28 +08:00
|
|
|
})
|
|
|
|
|
})
|