75 lines
3.6 KiB
TypeScript
75 lines
3.6 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { financeArapStatusOptions, financeBillStatusOptions, financeBusinessTypeLabel, financeDirectionLabel, 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(financeBusinessTypeLabel('RECONCILIATION_CREATED')).toBe('生成对账单')
|
|
expect(financeBusinessTypeLabel('SETTLEMENT_ISSUED')).toBe('结算单生效')
|
|
expect(financeBusinessTypeLabel('PAYMENT')).toBe('付款')
|
|
expect(financeBusinessTypeLabel('SUPPLIER_DIRECT_PAID')).toBe('供应商线下直付')
|
|
expect(financeBusinessTypeLabel('SUPPLIER_ON_ACCOUNT_PAYMENT')).toBe('供应商账期付款')
|
|
expect(financeBusinessTypeLabel('VOID')).toBe('作废')
|
|
expect(financeBusinessTypeLabel('NEW_BUSINESS')).toBe('未知业务类型')
|
|
expect(financeDocumentTypeLabel('SETTLEMENT')).toBe('结算单')
|
|
expect(financeOperationActionLabel('APPROVE')).toBe('审核通过')
|
|
expect(financeOperationActionLabel('FEE_SOURCE_REVIEW_APPROVE')).toBe('审核通过')
|
|
expect(financeOperationActionLabel('RECONCILIATION_ADJUST')).toBe('调整对账单')
|
|
expect(financeOperationActionLabel('SETTLEMENT_PAYMENT_CREATE')).toBe('登记收付款')
|
|
expect(financeOperationResultLabel('SUCCESS')).toBe('操作成功')
|
|
expect(financeDirectionLabel('RECEIVABLE')).toBe('应收')
|
|
expect(financeDirectionLabel('PAYABLE')).toBe('应付')
|
|
expect(financeDirectionLabel('NEW_DIRECTION')).toBe('未知方向')
|
|
expect(financeSourceTypeLabel('NEW_SOURCE')).toBe('未知来源类型')
|
|
expect(financeDocumentTypeLabel('NEW_DOCUMENT')).toBe('未知单据类型')
|
|
expect(financeOperationActionLabel('NEW_ACTION')).toBe('未知操作')
|
|
})
|
|
|
|
it('uses review-status values for the customer AR/AP review filter', () => {
|
|
expect(financeArapStatusOptions).toEqual([
|
|
{ label: '草稿', value: 'DRAFT' },
|
|
{ label: '待审核', value: 'PENDING' },
|
|
{ label: '已审核', value: 'APPROVED' },
|
|
{ label: '已驳回', value: 'REJECTED' },
|
|
])
|
|
})
|
|
|
|
it('uses the complete reconciliation statement lifecycle for statement filters', () => {
|
|
expect(financeBillStatusOptions).toEqual([
|
|
{ label: '草稿', value: 'DRAFT' },
|
|
{ label: '待审核', value: 'PENDING_REVIEW' },
|
|
{ label: '已审核', value: 'APPROVED' },
|
|
{ label: '已驳回', value: 'REJECTED' },
|
|
{ label: '已出账', value: 'ISSUED' },
|
|
{ label: '部分结清', value: 'PARTIALLY_PAID' },
|
|
{ label: '已结清', value: 'PAID' },
|
|
{ label: '已作废', value: 'VOIDED' },
|
|
])
|
|
})
|
|
})
|