Skip to content

Commit afe8307

Browse files
committed
add messages to test assertions
1 parent 9905cfb commit afe8307

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

test/parallel/test-net-socket-not-duplicates-destroy-soon-listeners.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,21 @@ const assert = require('assert');
33
const net = require('net');
44

55
const socket = new net.Socket();
6-
socket.on('error', () => {});
6+
socket.on('error', () => {
7+
// noop
8+
});
79
socket.connect({ host: 'non-existing.domain', port: 1234 });
810
socket.destroySoon();
9-
socket.connect({ host: 'non-existing.domain', port: 1234 });
1011
socket.destroySoon();
1112
const finishListenersCount = socket.listeners('finish').length;
1213
const connectListenersCount = socket.listeners('connect').length;
13-
assert.equal(finishListenersCount, 1);
14-
assert.equal(connectListenersCount, 1);
14+
assert.equal(
15+
finishListenersCount,
16+
1,
17+
'"finish" event listeners should not be duplicated for multiple "Socket.destroySoon" calls'
18+
);
19+
assert.equal(
20+
connectListenersCount,
21+
1,
22+
'"connect" event listeners should not be duplicated for multiple "Socket.destroySoon" calls'
23+
);

0 commit comments

Comments
 (0)