Skip to content

Commit

Permalink
return null after warning
Browse files Browse the repository at this point in the history
  • Loading branch information
js-jankisalvi committed Nov 30, 2023
1 parent 2cdac29 commit d163bc1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1062,13 +1062,15 @@ describe('ServiceNow service', () => {
},
}));

await service.closeIncident({ incidentId: 'xyz', correlationId: null });
const res = await service.closeIncident({ incidentId: 'xyz', correlationId: null });

expect(requestMock).toHaveBeenCalledTimes(1);
expect(logger.warn.mock.calls[0]).toMatchInlineSnapshot(`
Array [
"[ServiceNow][CloseIncident] No incident found with incidentId: xyz.",
]
`);
Array [
"[ServiceNow][CloseIncident] No incident found with incidentId: xyz.",
]
`);
expect(res).toBeNull();
});

test('it should log warning if found incident is closed', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ export const createExternalService: ServiceFactory = ({
logger.warn(
`[ServiceNow][CloseIncident] No incident found with incidentId: ${incidentId}.`
);

return null;
}
}
} else if (correlationId) {
Expand Down

0 comments on commit d163bc1

Please sign in to comment.