Files
knowledge-governance/web/src/QAMonthly.test.tsx
T
姚章浩 8835a473dd
build / build (push) Successful in 1m1s
style(qa-ops): 补删质量与月明细冗余提示
2026-10-18 20:22:39 +08:00

46 lines
1.6 KiB
TypeScript

import { renderToStaticMarkup } from 'react-dom/server'
import { describe, it, expect } from 'vitest'
import { QAMonthlyView } from './QAMonthly'
import { monthlyFixture } from './qaMonthly.fixture'
import { parseQAMonthly } from './qaMonthly'
describe('personal monthly view', () => {
it('shows a partial month as progress, escapes source names and does not imply eligibility', () => {
const html = renderToStaticMarkup(
<QAMonthlyView
data={parseQAMonthly(monthlyFixture)}
loading={false}
error=""
onRetry={() => {}}
onPage={() => {}}
/>
)
for (const text of ['本源零记录', '当月进度', '姓名未同步', '当前通讯录', '未关联']) expect(html).toContain(text)
expect(html).not.toContain('<script>')
for (const text of [
'不是考核名单',
'本次读取:',
'0 仅表示本源未关联到提问',
'成功/失败不是答案正确性结论',
'上方全名册指标不随人员筛选变化',
])
expect(html).not.toContain(text)
expect(html).toContain('qa-ops-page-bar')
expect(html).not.toContain('达标率')
expect(html).not.toContain('绩效合格')
})
it('does not display stale rows or fake zeros on errors', () => {
const html = renderToStaticMarkup(
<QAMonthlyView
data={parseQAMonthly(monthlyFixture)}
loading={false}
error="统计不可用"
onRetry={() => {}}
onPage={() => {}}
/>
)
expect(html).toContain('统计不可用')
expect(html).not.toContain('<table')
expect(html).not.toContain('共 0')
})
})