Skip to content

Commit

Permalink
test: clean up test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
saikumarrs committed Nov 7, 2024
1 parent 0d9dd95 commit 601e31b
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@ describe('Errors - utilities', () => {
describe('dispatchErrorEvent', () => {
it('should dispatch an error event', () => {
const dispatchEvent = jest.fn();
const originalDispatchEvent = globalThis.dispatchEvent;

globalThis.dispatchEvent = dispatchEvent;
const error = new Error('Test error');
dispatchErrorEvent(error);
expect(dispatchEvent).toHaveBeenCalledWith(new ErrorEvent('error', { error }));

// Cleanup
globalThis.dispatchEvent = originalDispatchEvent;
});
});
});

0 comments on commit 601e31b

Please sign in to comment.