Files
admin-web/src/modules/finance/pages/FinanceReceivableStatisticsView.test.ts
T

29 lines
1.6 KiB
TypeScript

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 ['<span>统计月份</span>', '<span>应收单位</span>', '#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('<LoadErrorState')
expect(page).toContain('当前月份暂无应收数据')
expect(page).toContain(':loading="loading"')
})
})