mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-10 03:14:58 -04:00
Added more unit tests to increase code coverage
This commit is contained in:
@@ -179,4 +179,25 @@ describe('Update content', () => {
|
||||
|
||||
});
|
||||
|
||||
test("It should handle fetch errors gracefully", async () => {
|
||||
|
||||
global.fetch.mockImplementationOnce(() =>
|
||||
Promise.resolve({
|
||||
ok: false,
|
||||
status: 500,
|
||||
json: () => Promise.resolve({})
|
||||
})
|
||||
);
|
||||
|
||||
window.NotifyModules.start();
|
||||
|
||||
const textbox = document.getElementById('template_content');
|
||||
helpers.triggerEvent(textbox, 'input');
|
||||
|
||||
jest.runAllTimers();
|
||||
|
||||
expect(document.querySelector('[data-module="update-status"]')).not.toBeNull();
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user