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', () => {
|
2026-08-12 09:25:55 +08:00
|
|
|
|
expect(settlement).toContain('customerName(detail.customerId)')
|
2026-08-11 19:35:28 +08:00
|
|
|
|
expect(settlement).toContain('activeCustomers.value.map')
|
|
|
|
|
|
expect(settlement).not.toContain('{{ selected.customerId }}')
|
|
|
|
|
|
})
|
|
|
|
|
|
|
2026-08-12 17:29:35 +08:00
|
|
|
|
it('uses optional all-customer filters without a customer-selection blocker', () => {
|
|
|
|
|
|
for (const source of [settlement, statements, arap]) {
|
|
|
|
|
|
expect(source).toContain("placeholder: '全部客户'")
|
|
|
|
|
|
expect(source).not.toContain('全客户查询暂不可用')
|
|
|
|
|
|
expect(source).not.toContain('empty-text="请选择客户查询')
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
2026-08-11 19:35:28 +08:00
|
|
|
|
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
|
|
|
|
|
2026-08-12 09:25:55 +08:00
|
|
|
|
it('exposes frozen G3 controls without unavailable placeholders', () => {
|
2026-08-11 19:59:15 +08:00
|
|
|
|
expect(settlement).not.toContain('生成{{ title }}')
|
|
|
|
|
|
expect(settlement).not.toContain('接口尚未提供,暂不可操作')
|
2026-08-12 09:25:55 +08:00
|
|
|
|
expect(statements).toContain('生成对账单')
|
|
|
|
|
|
expect(statements).toContain('createReconciliationStatement')
|
|
|
|
|
|
expect(statements).toContain('actionReconciliationStatement')
|
|
|
|
|
|
expect(statements).toContain('<template #toolbar-actions>')
|
|
|
|
|
|
expect(statements).toContain('aria-label="更多对账单操作"')
|
|
|
|
|
|
expect(statements).toContain('adjustmentLines: selected.map')
|
2026-08-11 19:59:15 +08:00
|
|
|
|
expect(statements).not.toContain('disabled title="接口尚未提供')
|
|
|
|
|
|
})
|
2026-08-11 19:35:28 +08:00
|
|
|
|
})
|