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 <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
  • Loading branch information
matsuda-koushi authored and italoacasas committed Feb 14, 2017
1 parent 8547871 commit e9f6bc6
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 e9f6bc6

Please sign in to comment.