diff --git a/test/parallel/test-event-emitter-num-args.js b/test/parallel/test-event-emitter-num-args.js index d1027befa3f4ad..53ac0f79c20333 100644 --- a/test/parallel/test-event-emitter-num-args.js +++ b/test/parallel/test-event-emitter-num-args.js @@ -4,15 +4,20 @@ const assert = require('assert'); const events = require('events'); const e = new events.EventEmitter(); -const num_args_emited = []; +const num_args_emitted = []; e.on('numArgs', function() { const numArgs = arguments.length; - console.log('numArgs: ' + numArgs); - num_args_emited.push(numArgs); + num_args_emitted.push(numArgs); }); -console.log('start'); +e.on('foo', function() { + num_args_emitted.push(arguments.length); +}); + +e.on('foo', function() { + num_args_emitted.push(arguments.length); +}); e.emit('numArgs'); e.emit('numArgs', null); @@ -21,6 +26,8 @@ e.emit('numArgs', null, null, null); e.emit('numArgs', null, null, null, null); e.emit('numArgs', null, null, null, null, null); +e.emit('foo', null, null, null, null); + process.on('exit', function() { - assert.deepStrictEqual([0, 1, 2, 3, 4, 5], num_args_emited); + assert.deepStrictEqual([0, 1, 2, 3, 4, 5, 4, 4], num_args_emitted); }); diff --git a/test/parallel/test-event-emitter-remove-all-listeners.js b/test/parallel/test-event-emitter-remove-all-listeners.js index 38f9b7101eb775..d7865b09abe9f5 100644 --- a/test/parallel/test-event-emitter-remove-all-listeners.js +++ b/test/parallel/test-event-emitter-remove-all-listeners.js @@ -77,3 +77,8 @@ function listener() {} ee.removeAllListeners('baz'); assert.strictEqual(ee.listeners('baz').length, 0); } + +{ + const ee = new events.EventEmitter(); + assert.deepStrictEqual(ee, ee.removeAllListeners()); +} diff --git a/test/parallel/test-event-emitter-remove-listeners.js b/test/parallel/test-event-emitter-remove-listeners.js index ff5ee5dc242e0f..03bde6c3d7c4c9 100644 --- a/test/parallel/test-event-emitter-remove-listeners.js +++ b/test/parallel/test-event-emitter-remove-listeners.js @@ -116,6 +116,12 @@ function listener2() {} ee.emit('hello'); } +{ + const ee = new EventEmitter(); + + assert.deepStrictEqual(ee, ee.removeListener('foo', () => {})); +} + // Verify that the removed listener must be a function assert.throws(() => { const ee = new EventEmitter(); diff --git a/test/parallel/test-event-emitter-special-event-names.js b/test/parallel/test-event-emitter-special-event-names.js index d71d819d3031b2..7ff781f0f90c5a 100644 --- a/test/parallel/test-event-emitter-special-event-names.js +++ b/test/parallel/test-event-emitter-special-event-names.js @@ -7,6 +7,8 @@ const assert = require('assert'); const ee = new EventEmitter(); const handler = () => {}; +assert.deepStrictEqual(ee.eventNames(), []); + assert.strictEqual(ee._events.hasOwnProperty, undefined); assert.strictEqual(ee._events.toString, undefined);