返回 oh-my-ppt
content-credibility.test.ts
根目录 / tests / unit / thinking / content-credibility.test.ts
1 import { describe, expect, it } from 'vitest'
2 import { findUnsupportedPrecisionClaims } from '../../../src/main/thinking/content-credibility'
3
4 describe('thinking content credibility', () => {
5 it('flags unsupported exact metrics when no sources exist', () => {
6 const issues = findUnsupportedPrecisionClaims({
7 hasSources: false,
8 markdown: [
9 '# Thinking Brief',
10 '',
11 '## Page 1: 性能跃迁',
12 '- Role: data',
13 '- Objective: 说明性能变化',
14 '',
15 '- 单token推理成本下降70%',
16 '- HumanEval基准从67%提升至89%',
17 '- 工程侧应关注推理效率和部署复杂度'
18 ].join('\n')
19 })
20
21 expect(issues).toHaveLength(2)
22 expect(issues.map((issue) => issue.text)).toEqual([
23 '- 单token推理成本下降70%',
24 '- HumanEval基准从67%提升至89%'
25 ])
26 })
27
28 it('allows structural numbers and sourced exact metrics', () => {
29 expect(
30 findUnsupportedPrecisionClaims({
31 hasSources: false,
32 markdown: [
33 '# Thinking Brief',
34 '',
35 '## Topic',
36 '2026 AI模型的进化',
37 '',
38 '## Setting',
39 '技术分享会,时长约10分钟',
40 '',
41 '## Page Count',
42 '9'
43 ].join('\n')
44 })
45 ).toHaveLength(0)
46
47 expect(
48 findUnsupportedPrecisionClaims({
49 hasSources: true,
50 markdown: '- 单token推理成本下降70%'
51 })
52 ).toHaveLength(0)
53 })
54 })
55
55 lines TYPESCRIPT