fix(ai-review): 避免建問題模式阻擋失效與連結累積
This commit is contained in:
@@ -97,3 +97,40 @@ test('resultFilesToCommit 在建問題模式無嚴重問題時只提交 exclusio
|
||||
['.gitea/ai-review/exclusions.json'],
|
||||
);
|
||||
});
|
||||
|
||||
test('resolveOldIssueLinkComments 只標註舊追蹤 issue 連結', async () => {
|
||||
const edited = [];
|
||||
const fakeGitea = {
|
||||
async whoAmI() {
|
||||
return { login: 'bot' };
|
||||
},
|
||||
async listIssueComments() {
|
||||
return [
|
||||
{
|
||||
id: 1,
|
||||
user: { login: 'bot' },
|
||||
body: '<!-- ai-code-review -->\n## 🔍 AI Code Review|已建立追蹤問題\nold',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
user: { login: 'bot' },
|
||||
body: '<!-- ai-code-review -->\n## 📋 變更摘要(送審 git diff)\nkeep',
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
user: { login: 'someone' },
|
||||
body: '<!-- ai-code-review -->\n## 🔍 AI Code Review|已建立追蹤問題\nkeep',
|
||||
},
|
||||
];
|
||||
},
|
||||
async editIssueComment(ctx, commentId, body) {
|
||||
edited.push({ ctx, commentId, body });
|
||||
},
|
||||
};
|
||||
|
||||
await review.resolveOldIssueLinkComments({ ctx: { token: 'hidden' }, gitea: fakeGitea });
|
||||
|
||||
assert.equal(edited.length, 1);
|
||||
assert.equal(edited[0].commentId, 1);
|
||||
assert.match(edited[0].body, /^> 〔已過時〕/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user