Files
X-Financial/web/tests/finance-dashboard-ranking.test.mjs
caoxiaozhu 15006a05a7 feat: 数字员工财务报告体系与定时提醒及看板快照调度
- 新增数字员工财务报告生成、邮件投递与渲染调度器
- 引入员工画像扫描调度与定时提醒任务
- 完善财务看板快照、排行口径与部门人员占比计算
- 优化数字员工工作看板仪表盘与技能目录
- 增强前端总览页图表、工作台摘要与顶部导航栏交互
- 新增差旅申请规划推动提醒与报销创建会话状态管理
- 补充财务报告、看板调度、数字员工工作记录测试覆盖
2026-06-03 09:25:23 +08:00

54 lines
2.2 KiB
JavaScript

import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import test from 'node:test'
import { fileURLToPath } from 'node:url'
import { departmentRangeOptions } from '../src/data/metrics.js'
const overviewView = readFileSync(
fileURLToPath(new URL('../src/views/OverviewView.vue', import.meta.url)),
'utf8'
)
const overviewViewModel = readFileSync(
fileURLToPath(new URL('../src/composables/useOverviewView.js', import.meta.url)),
'utf8'
)
const analyticsService = readFileSync(
fileURLToPath(new URL('../src/services/analytics.js', import.meta.url)),
'utf8'
)
const barChart = readFileSync(
fileURLToPath(new URL('../src/components/charts/BarChart.vue', import.meta.url)),
'utf8'
)
test('finance dashboard ranking range options support month quarter year and all', () => {
assert.deepEqual(departmentRangeOptions, ['本月', '本季度', '本年', '全部'])
assert.match(analyticsService, /department_employee_mix/)
assert.match(analyticsService, /departmentEmployeeMix/)
assert.match(analyticsService, /department_range/)
})
test('finance dashboard renders shared ranking filters and department employee mix chart', () => {
assert.match(overviewView, /<h3>部门报销排行/)
assert.match(overviewView, /aria-label="部门排行时间范围"/)
assert.match(overviewView, /<h3>个人报销排行/)
assert.match(overviewView, /aria-label="个人排行时间范围"/)
assert.doesNotMatch(overviewView, /个人报销排行(本月)/)
assert.match(overviewView, /<h3>高额单据/)
assert.doesNotMatch(overviewView, /本月高额单据/)
assert.match(overviewView, /class="top-claim-split"/)
assert.match(overviewView, /departmentEmployeeLegend/)
assert.match(overviewView, /departmentEmployeeCenterValue/)
assert.match(overviewViewModel, /financeDepartmentEmployeeMix/)
assert.match(overviewViewModel, /departmentEmployeeLegend/)
assert.match(overviewViewModel, /employeeCount/)
})
test('finance ranking bar chart can display ranking metadata', () => {
assert.match(barChart, /rank-meta/)
assert.match(barChart, /item\.meta/)
assert.match(overviewViewModel, /meta: `\$\{Number\(item\.employeeCount/)
assert.match(overviewViewModel, /meta: `\$\{item\.department/)
})