Narrow browser listeners before invocation
This commit is contained in:
parent
de4f990492
commit
3ad5dcf496
1 changed files with 6 additions and 2 deletions
|
|
@ -16,8 +16,12 @@ test('reports and cleans up', () => {
|
||||||
|
|
||||||
expect(error).toEqual(expect.any(Function))
|
expect(error).toEqual(expect.any(Function))
|
||||||
expect(rejection).toEqual(expect.any(Function))
|
expect(rejection).toEqual(expect.any(Function))
|
||||||
;(error as EventListener)(new Event('error'))
|
if (typeof error !== 'function' || typeof rejection !== 'function') {
|
||||||
;(rejection as EventListener)(new Event('unhandledrejection'))
|
throw new TypeError('event listeners were not registered')
|
||||||
|
}
|
||||||
|
|
||||||
|
error(new Event('error'))
|
||||||
|
rejection(new Event('unhandledrejection'))
|
||||||
|
|
||||||
expect(beacon.mock.calls).toEqual([
|
expect(beacon.mock.calls).toEqual([
|
||||||
[
|
[
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue