AutomergeFailureComment Testing Implemented

This commit is contained in:
I584999 2024-12-30 09:12:13 -05:00
parent 679a0a8a71
commit e03b4117a3
2 changed files with 6 additions and 16 deletions

View file

@ -2002,7 +2002,7 @@ const options: RenovateOptions[] = [
description: description:
'If an error occurs while automerging, a comment will be created to signal the user. Only used if `automergeFailureComment=on-error`.', 'If an error occurs while automerging, a comment will be created to signal the user. Only used if `automergeFailureComment=on-error`.',
type: 'string', type: 'string',
default: 'none', default: 'never',
}, },
{ {
name: 'ignoreTests', name: 'ignoreTests',

View file

@ -2990,22 +2990,12 @@ describe('modules/platform/github/index', () => {
it('should handle GraphQL errors with automergeFailureComment', async () => { it('should handle GraphQL errors with automergeFailureComment', async () => {
const scope = await mockScope({ automergeFailureComment: 'on-error' }); const scope = await mockScope({ automergeFailureComment: 'on-error' });
initRepoMock(scope, 'some/repo');
scope scope
.get('/repos/some/repo/issues/42/comments?per_page=100') .post('/repos/some/repo/issues/123/comments')
.reply(200, []) .reply(200)
.post('/repos/some/repo/issues/42/comments') .post('/graphql')
.reply(200); .reply(200, graphqlAutomergeErrorResp);
await github.initRepo({ repository: 'some/repo' }); await expect(github.createPr(prConfigComment)).toResolve();
scope.post('/graphql').reply(200, graphqlAutomergeErrorResp);
const pr = await github.createPr(prConfigComment);
expect(pr).toMatchObject({ number: 123 });
expect(httpMock.getTrace()).toMatchObject([
graphqlGetRepo,
restCreatePr,
restAddLabels,
graphqlAutomerge,
]);
}); });
it('should handle REST API errors', async () => { it('should handle REST API errors', async () => {