2026-08-11 19:35:28 +08:00
|
|
|
|
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')
|
2026-08-11 19:59:15 +08:00
|
|
|
|
const statements = readFileSync(resolve(process.cwd(), 'src/modules/finance/pages/FinanceCustomerStatementsView.vue'), 'utf8')
|
2026-08-11 19:35:28 +08:00
|
|
|
|
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)')
|
2026-08-11 19:59:15 +08:00
|
|
|
|
expect(arap).toContain('financeDirectionLabel(row.direction)')
|
|
|
|
|
|
expect(arap).toContain('financeDirectionLabel(detail.direction)')
|
|
|
|
|
|
expect(arap).not.toContain("detail.direction === 'RECEIVABLE' ? '应收' : '应付'")
|
2026-08-11 19:35:28 +08:00
|
|
|
|
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:')
|
|
|
|
|
|
})
|
2026-08-11 19:59:15 +08:00
|
|
|
|
|
|
|
|
|
|
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="接口尚未提供')
|
|
|
|
|
|
})
|
2026-08-11 19:35:28 +08:00
|
|
|
|
})
|