test(ai-review): 補使用量統計與 resolve 安全與邊界測試
This commit is contained in:
@@ -281,6 +281,30 @@ describe('postFindingsReview', () => {
|
||||
assert.match(reviewCalls[0].comments[0].body, /建議.*C/s);
|
||||
});
|
||||
|
||||
it('appends the usage section to the review body when provided', async () => {
|
||||
const reviewCalls = [];
|
||||
await postFindingsReview([
|
||||
{ level: 'warning', role: 'Leo', location: 'app/b.js:20', suggestion: 'W', is_new: true },
|
||||
], {
|
||||
postReview: async (args) => { reviewCalls.push(args); },
|
||||
usageSection: '## 🤖 AI 助理使用量\n\n本次:120 token',
|
||||
});
|
||||
|
||||
assert.match(reviewCalls[0].body, /## AI Code Review 統計/);
|
||||
assert.match(reviewCalls[0].body, /## 🤖 AI 助理使用量\n\n本次:120 token$/);
|
||||
});
|
||||
|
||||
it('omits the usage section when not provided', async () => {
|
||||
const reviewCalls = [];
|
||||
await postFindingsReview([
|
||||
{ level: 'warning', role: 'Leo', location: 'app/b.js:20', suggestion: 'W', is_new: true },
|
||||
], {
|
||||
postReview: async (args) => { reviewCalls.push(args); },
|
||||
});
|
||||
|
||||
assert.doesNotMatch(reviewCalls[0].body, /AI 助理使用量/);
|
||||
});
|
||||
|
||||
it('separates old and new findings in default review statistics', async () => {
|
||||
const reviewCalls = [];
|
||||
await postFindingsReview([
|
||||
|
||||
Reference in New Issue
Block a user