-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d821ee3
commit 7bd0cc9
Showing
7 changed files
with
400 additions
and
8 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
packages/analytics-js-common/__tests__/utilities/errors.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { dispatchErrorEvent } from '../../src/utilities/errors'; | ||
|
||
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; | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.