Files
admin-web/src/modules/finance/pages/FinancePresentation.test.ts
T
2026-08-11 19:59:15 +08:00

40 lines
2.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { readFileSync } from 'node:fs'
import { resolve } from 'node:path'
import { describe, expect, it } from 'vitest'
const settlement = readFileSync(resolve(process.cwd(), 'src/modules/finance/pages/FinanceFormalSettlementPage.vue'), 'utf8')
const statements = readFileSync(resolve(process.cwd(), 'src/modules/finance/pages/FinanceCustomerStatementsView.vue'), 'utf8')
const arap = readFileSync(resolve(process.cwd(), 'src/modules/finance/pages/FinanceCustomerArapView.vue'), 'utf8')
const manual = readFileSync(resolve(process.cwd(), 'src/modules/finance/pages/FinanceManualPage.vue'), 'utf8')
describe('finance presentation governance', () => {
it('shows customer names instead of internal customer IDs in formal settlements', () => {
expect(settlement).toContain('customerName(selected.customerId)')
expect(settlement).toContain('activeCustomers.value.map')
expect(settlement).not.toContain('{{ selected.customerId }}')
})
it('translates source codes and provides reason placeholders', () => {
expect(arap).toContain('financeSourceTypeLabel(detail.sourceType)')
expect(arap).toContain('financeOperationActionLabel(log.action)')
expect(arap).toContain('financeOperationResultLabel(log.result)')
expect(arap).toContain('financeDirectionLabel(row.direction)')
expect(arap).toContain('financeDirectionLabel(detail.direction)')
expect(arap).not.toContain("detail.direction === 'RECEIVABLE' ? '应收' : '应付'")
expect(arap).toContain('请填写驳回原因')
expect(arap).toContain('请说明参与或排除结算的原因')
})
it('does not expose the uploaded voucher file ID in the form', () => {
expect(manual).toContain('凭证已上传,创建失败时可直接重试')
expect(manual).not.toContain('凭证 fileId:')
})
it('hides unavailable generation controls instead of rendering disabled buttons', () => {
expect(settlement).not.toContain('生成{{ title }}')
expect(settlement).not.toContain('接口尚未提供,暂不可操作')
expect(statements).not.toContain('生成对账单')
expect(statements).not.toContain('disabled title="接口尚未提供')
})
})