fix(ai-review comment): 顯示審查問題原因
This commit is contained in:
+14
-1
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user