fix(ai-review comment): 顯示審查問題原因

This commit is contained in:
2026-06-22 10:27:33 +00:00
parent bbd7570a5b
commit f83a2034a8
7 changed files with 23 additions and 6 deletions
+14 -1
View File
@@ -212,7 +212,8 @@ describe('postFindingsReview', () => {
);
assert.match(reviewCalls[0].comments[0].body, /嚴重等級/);
assert.match(reviewCalls[0].comments[0].body, /.*Rex/s);
assert.match(reviewCalls[0].comments[0].body, /.*app\/a\.js:10/s);
assert.match(reviewCalls[0].comments[0].body, /.*/s);
assert.doesNotMatch(reviewCalls[0].comments[0].body, /.*app\/a\.js:10/s);
assert.match(reviewCalls[0].comments[0].body, /.*C/s);
});
@@ -242,4 +243,16 @@ describe('postFindingsReview', () => {
assert.match(reviewCalls[0].comments[0].body, /.*/s);
assert.match(reviewCalls[0].comments[0].body, /.*/s);
});
it('uses reviewer reason fields as the problem text instead of the location', async () => {
const reviewCalls = [];
await postFindingsReview([
{ level: 'warning', role: 'Leo', location: 'app/a.js:5', description: '這裡缺少空值檢查', suggestion: '先判斷 null 再使用' },
], {
postReview: async (args) => { reviewCalls.push(args); },
});
assert.match(reviewCalls[0].comments[0].body, /.*/s);
assert.doesNotMatch(reviewCalls[0].comments[0].body, /.*app\/a\.js:5/s);
});
});