import { readFileSync } from 'node:fs' import { resolve } from 'node:path' import { describe, expect, it } from 'vitest' const page = readFileSync(resolve(process.cwd(), 'src/modules/finance/pages/FinanceReceivableStatisticsView.vue'), 'utf8') describe('receivable statistics page', () => { it('renders only the approved CNY derived metrics and current-filter actions', () => { for (const label of ['统计月份', '应收单位', '应收总额', '已收合计', '余额未收', '打印', '导出Excel']) expect(page).toContain(label) expect(page).toContain("exportType: 'FINANCE_RECEIVABLE_STATISTICS'") expect(page).toContain('window.print()') expect(page).toContain('aria-label="统计月份"') expect(page).toContain('aria-label="应收单位"') for (const removed of ['统计月份', '应收单位', '#before-results', '应收款明细', '仅统计CNY正式应收结算单']) expect(page).not.toContain(removed) expect(page).toContain('displayCustomerName(row)') expect(page).toContain('/^客户\\s*\\d+$/.test(snapshot)') expect(page).toContain("return masterName || '—'") for (const excluded of ['FBA直发', 'FBA专线', '零头减免', 'USD', '>编辑<']) expect(page).not.toContain(excluded) }) it('keeps query reset, loading, empty, error and permission states explicit', () => { expect(page).toContain('function reset()') expect(page).toContain('无权访问应收款统计表') expect(page).toContain('