Skip to content

Commit

Permalink
test: improve coverage on removeListeners functions
Browse files Browse the repository at this point in the history
PR-URL: nodejs#11140
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Italo A. Casas <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
  • Loading branch information
matsuda-koushi authored and krydos committed Feb 25, 2017
1 parent 292f605 commit 9e6230f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/parallel/test-event-emitter-remove-all-listeners.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,9 @@ function listener() {}
const ee = new events.EventEmitter();
assert.deepStrictEqual(ee, ee.removeAllListeners());
}

{
const ee = new events.EventEmitter();
ee._events = undefined;
assert.strictEqual(ee, ee.removeAllListeners());
}
8 changes: 8 additions & 0 deletions test/parallel/test-event-emitter-remove-listeners.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,11 @@ assert.throws(() => {

ee.removeListener('foo', null);
}, /^TypeError: "listener" argument must be a function$/);

{
const ee = new EventEmitter();
const listener = () => {};
ee._events = undefined;
const e = ee.removeListener('foo', listener);
assert.strictEqual(e, ee);
}

0 comments on commit 9e6230f

Please sign in to comment.