adjusted tests to properly use mockRejectedValue for async rejections

This commit is contained in:
Aster Fialla
2026-02-24 21:08:04 -05:00
parent 5050f98e8f
commit d226238e14
6 changed files with 14 additions and 37 deletions

View File

@@ -32,7 +32,7 @@ describe('utils', () => {
test('throws error if fetch returns error', async() => {
// Arrange
global.fetch = jest.fn().mockImplementation(() =>{throw Error('error');});
global.fetch = jest.fn().mockRejectedValue(new Error('error'));
// Act & Assert
await expect(utils.checkImageFormatValidity(attachmentUrl)).rejects.toThrow(`${enums.err.PROPIC_CANNOT_LOAD}: error`);
})