diff --git a/src/__tests__/action.test.js b/src/__tests__/action.test.js index 585111b5..a58dcb82 100644 --- a/src/__tests__/action.test.js +++ b/src/__tests__/action.test.js @@ -226,7 +226,7 @@ describe('action', () => { }); it('fails if user cannot be assigned and failsIfUsersCannotBeAssigned flag is true', async () => { - const requestMock = jest.fn(() => Promise.resolve({ status: 404 })); + const requestMock = jest.fn(() => Promise.reject({ status: 404 })); const octokitMock = getOctokitMock({ requestMock }); await expect( diff --git a/src/utils.js b/src/utils.js index a13b658a..bd40de1c 100644 --- a/src/utils.js +++ b/src/utils.js @@ -184,11 +184,11 @@ const checkIfUsersCanBeAssigned = async ( ); requests.push(request); } - const responses = await Promise.all(requests); + const responses = await Promise.allSettled(requests); const result = { isSuccess: true, assigneeErrors: [] }; for (let i = 0; i < assignees.length; i++) { const { status } = responses[i]; - if (status != 204) { + if (status === 'rejected') { result.isSuccess = false; result.assigneeErrors.push(assignees[i]); }