From b612003290f2f29dd13fea944741d5b44408c84e Mon Sep 17 00:00:00 2001 From: cjihrig Date: Thu, 28 Apr 2016 11:04:40 -0400 Subject: [PATCH] test: refactor large event emitter tests This commit splits several large event emitter tests into smaller block scoped tests. This keeps the tests more isolated. This commit also replaces var with const, assert.equal() with assert.stictEqual(), and other small enhancements. PR-URL: https://github.com/nodejs/node/pull/6446 Reviewed-By: Santiago Gimeno Reviewed-By: James M Snell --- .../test-event-emitter-remove-listeners.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-event-emitter-remove-listeners.js b/test/parallel/test-event-emitter-remove-listeners.js index 5ee1b2a4d03269..912eefc9f4bf1e 100644 --- a/test/parallel/test-event-emitter-remove-listeners.js +++ b/test/parallel/test-event-emitter-remove-listeners.js @@ -1,13 +1,13 @@ 'use strict'; const common = require('../common'); const assert = require('assert'); -const EventEmitter = require('events'); +const events = require('events'); function listener1() {} function listener2() {} { - const ee = new EventEmitter(); + const ee = new events.EventEmitter(); ee.on('hello', listener1); ee.on('removeListener', common.mustCall((name, cb) => { assert.strictEqual(name, 'hello'); @@ -18,7 +18,7 @@ function listener2() {} } { - const ee = new EventEmitter(); + const ee = new events.EventEmitter(); ee.on('hello', listener1); ee.on('removeListener', common.fail); ee.removeListener('hello', listener2); @@ -26,7 +26,7 @@ function listener2() {} } { - const ee = new EventEmitter(); + const ee = new events.EventEmitter(); ee.on('hello', listener1); ee.on('hello', listener2); ee.once('removeListener', common.mustCall((name, cb) => { @@ -46,7 +46,7 @@ function listener2() {} } { - const ee = new EventEmitter(); + const ee = new events.EventEmitter(); function remove1() { common.fail('remove1 should not have been called'); @@ -67,7 +67,7 @@ function listener2() {} } { - const ee = new EventEmitter(); + const ee = new events.EventEmitter(); ee.on('hello', listener1); ee.on('hello', listener2); ee.once('removeListener', common.mustCall((name, cb) => { @@ -87,7 +87,7 @@ function listener2() {} } { - const ee = new EventEmitter(); + const ee = new events.EventEmitter(); const listener3 = common.mustCall(() => { ee.removeListener('hello', listener4); }, 2); @@ -106,7 +106,7 @@ function listener2() {} } { - const ee = new EventEmitter(); + const ee = new events.EventEmitter(); ee.once('hello', listener1); ee.on('removeListener', common.mustCall((eventName, listener) => {