feat(ai): 优化拆解重跑与结果展示
This commit is contained in:
32
apps/web/lib/ai-decompose-report.test.ts
Normal file
32
apps/web/lib/ai-decompose-report.test.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
|
||||
import { formatReportRequirementLabel } from './ai-decompose-report';
|
||||
|
||||
const requirements = [
|
||||
{
|
||||
id: 'rea-17823017283970',
|
||||
code: 'REQ0010',
|
||||
title: '支持主题拖拽排序',
|
||||
description: '用户可以调整主题顺序',
|
||||
},
|
||||
];
|
||||
|
||||
test('formatReportRequirementLabel resolves internal requirement id to code and title', () => {
|
||||
assert.equal(
|
||||
formatReportRequirementLabel('rea-17823017283970', requirements),
|
||||
'REQ0010 支持主题拖拽排序',
|
||||
);
|
||||
});
|
||||
|
||||
test('formatReportRequirementLabel resolves requirement code to code and title', () => {
|
||||
assert.equal(
|
||||
formatReportRequirementLabel('REQ0010', requirements),
|
||||
'REQ0010 支持主题拖拽排序',
|
||||
);
|
||||
});
|
||||
|
||||
test('formatReportRequirementLabel falls back to raw id when requirement is unknown', () => {
|
||||
assert.equal(formatReportRequirementLabel('rea-missing', requirements), 'rea-missing');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user