Skip to content

Commit 06a8243

Browse files
edsadritaloacasas
authored andcommitted
test: improve test-event-emitter-modify-in-emit
* use let instead of var * use assert.strictEqual instead of assert.equal * swap assertions arguments to match the standard PR-URL: #10600 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 75aa605 commit 06a8243

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

test/parallel/test-event-emitter-modify-in-emit.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ require('../common');
33
const assert = require('assert');
44
const events = require('events');
55

6-
var callbacks_called = [];
6+
let callbacks_called = [];
77

88
const e = new events.EventEmitter();
99

@@ -25,35 +25,35 @@ function callback3() {
2525
}
2626

2727
e.on('foo', callback1);
28-
assert.equal(1, e.listeners('foo').length);
28+
assert.strictEqual(e.listeners('foo').length, 1);
2929

3030
e.emit('foo');
31-
assert.equal(2, e.listeners('foo').length);
31+
assert.strictEqual(e.listeners('foo').length, 2);
3232
assert.deepStrictEqual(['callback1'], callbacks_called);
3333

3434
e.emit('foo');
35-
assert.equal(0, e.listeners('foo').length);
35+
assert.strictEqual(e.listeners('foo').length, 0);
3636
assert.deepStrictEqual(['callback1', 'callback2', 'callback3'],
3737
callbacks_called);
3838

3939
e.emit('foo');
40-
assert.equal(0, e.listeners('foo').length);
40+
assert.strictEqual(e.listeners('foo').length, 0);
4141
assert.deepStrictEqual(['callback1', 'callback2', 'callback3'],
4242
callbacks_called);
4343

4444
e.on('foo', callback1);
4545
e.on('foo', callback2);
46-
assert.equal(2, e.listeners('foo').length);
46+
assert.strictEqual(e.listeners('foo').length, 2);
4747
e.removeAllListeners('foo');
48-
assert.equal(0, e.listeners('foo').length);
48+
assert.strictEqual(e.listeners('foo').length, 0);
4949

5050
// Verify that removing callbacks while in emit allows emits to propagate to
5151
// all listeners
5252
callbacks_called = [];
5353

5454
e.on('foo', callback2);
5555
e.on('foo', callback3);
56-
assert.equal(2, e.listeners('foo').length);
56+
assert.strictEqual(2, e.listeners('foo').length);
5757
e.emit('foo');
5858
assert.deepStrictEqual(['callback2', 'callback3'], callbacks_called);
59-
assert.equal(0, e.listeners('foo').length);
59+
assert.strictEqual(0, e.listeners('foo').length);

0 commit comments

Comments
 (0)