test(ai-review): 補行號定位、誤報裁決邊界、統計與 appendExclusions 測試
This commit is contained in:
@@ -307,6 +307,22 @@ describe('postFindingsReview', () => {
|
||||
assert.equal(reviewCalls[0].body, reviewCalls[0].body.trimEnd());
|
||||
});
|
||||
|
||||
it('counts both new and old findings in the summary but only inline-comments new ones', async () => {
|
||||
const reviewCalls = [];
|
||||
await postFindingsReview([
|
||||
{ level: 'critical', role: 'Rex', location: 'app/a.js:10', suggestion: 'old crit', is_new: false },
|
||||
{ level: 'warning', role: 'Leo', location: 'app/b.js:20', suggestion: 'new warn', is_new: true },
|
||||
{ level: 'info', role: 'Maya', location: 'app/c.js:30', suggestion: 'new info', is_new: true },
|
||||
], { postReview: async (a) => { reviewCalls.push(a); } });
|
||||
|
||||
const body = reviewCalls[0].body;
|
||||
assert.match(body, /\| 新問題 \| 0 筆 \| 1 筆 \| 1 筆 \| 0 筆 \|/);
|
||||
assert.match(body, /\| 舊問題 \| 1 筆 \| 0 筆 \| 0 筆 \| 0 筆 \|/);
|
||||
// 舊問題 app/a.js 不產生行內 comment;只有新問題被標註
|
||||
assert.ok(!reviewCalls[0].comments.some(c => c.path === 'app/a.js'));
|
||||
assert.deepEqual(reviewCalls[0].comments.map(c => c.path), ['app/b.js', 'app/c.js']);
|
||||
});
|
||||
|
||||
it('separates old and new findings in default review statistics', async () => {
|
||||
const reviewCalls = [];
|
||||
await postFindingsReview([
|
||||
|
||||
Reference in New Issue
Block a user