fix(審查流程): 修正 bot 跳過、JSON 驗證與排除比對邊界
This commit is contained in:
+10
-2
@@ -197,17 +197,25 @@ describe('gitea', () => {
|
||||
assert.equal(await getFileContentAtRef('missing.js', 'ref'), '');
|
||||
});
|
||||
|
||||
it('shouldSkipBotCommit returns true when either sha or branch head is bot commit', async () => {
|
||||
it('shouldSkipBotCommit returns true when either sha or branch head is a bot success commit, but not failure', async () => {
|
||||
mock.method(axios, 'get', async (url) => {
|
||||
if (url.includes('/git/commits/sha-bot')) {
|
||||
return { data: { message: 'chore: update ai-review findings [ai-review-bot][failure]' } };
|
||||
}
|
||||
if (url.includes('/git/commits/sha-success')) {
|
||||
return { data: { message: 'chore: update ai-review findings [ai-review-bot][success]' } };
|
||||
}
|
||||
if (url.includes('/branches/feat%2Ftest')) {
|
||||
return { data: { commit: { id: 'sha-bot' } } };
|
||||
}
|
||||
if (url.includes('/branches/feat%2Fsuccess')) {
|
||||
return { data: { commit: { id: 'sha-success' } } };
|
||||
}
|
||||
return { data: { message: 'regular commit' } };
|
||||
});
|
||||
await assert.equal(await shouldSkipBotCommit({ sha: 'sha-bot', branch: 'feat/test' }), true);
|
||||
await assert.equal(await shouldSkipBotCommit({ sha: 'sha-bot', branch: 'feat/test' }), false);
|
||||
await assert.equal(await shouldSkipBotCommit({ sha: 'sha-success', branch: 'feat/success' }), true);
|
||||
await assert.equal(await shouldSkipBotCommit({ sha: 'sha-success', branch: 'feat/test' }), true);
|
||||
assert.equal(getBotReviewOutcome('chore: update ai-review findings [ai-review-bot][failure]'), 'failure');
|
||||
assert.equal(getBotReviewOutcome('chore: update ai-review findings [ai-review-bot][success]'), 'success');
|
||||
assert.equal(getBotReviewOutcome('chore: update ai-review findings [ai-review-bot]'), 'unknown');
|
||||
|
||||
Reference in New Issue
Block a user