Browse Source

test: improve coverage on removeListeners functions

PR-URL: https://github.com/nodejs/node/pull/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>
v6
matsuda-koushi 8 years ago
committed by James M Snell
parent
commit
7d2dc90aeb
  1. 6
      test/parallel/test-event-emitter-remove-all-listeners.js
  2. 8
      test/parallel/test-event-emitter-remove-listeners.js

6
test/parallel/test-event-emitter-remove-all-listeners.js

@ -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
test/parallel/test-event-emitter-remove-listeners.js

@ -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);
}

Loading…
Cancel
Save