test(ai-review): 補 usageSection 結構、resolveMissingLineNumbers 例外與誤報混合平行測試

This commit is contained in:
Jeffery
2026-06-23 15:44:44 +08:00
parent 5685ac1729
commit 0f7ec5c3db
2 changed files with 42 additions and 0 deletions
+14
View File
@@ -307,6 +307,20 @@ describe('postFindingsReview', () => {
assert.equal(reviewCalls[0].body, reviewCalls[0].body.trimEnd());
});
it('appends usageSection verbatim after the stats block without altering structure', async () => {
const reviewCalls = [];
const usageSection = '## 🤖 AI 助理使用量\n\n| x | y |\n| - | - |\n| 1 | 2 |';
await postFindingsReview([
{ level: 'warning', role: 'Leo', location: 'app/b.js:20', suggestion: 'W', is_new: true },
], { postReview: async (args) => { reviewCalls.push(args); }, usageSection });
const body = reviewCalls[0].body;
// 統計區塊在前、usageSection 原樣接在後(中間一個空行);不交錯、不被竄改
assert.ok(body.startsWith('## AI Code Review 統計'));
assert.ok(body.endsWith(usageSection));
assert.match(body, /## AI Code Review 統計[\s\S]*\n\n## 🤖 AI 助理使用量/);
});
it('counts both new and old findings in the summary but only inline-comments new ones', async () => {
const reviewCalls = [];
await postFindingsReview([