Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
test: remove superfluous checks in test-net-reconnect-error
The process.on('exit', ...) checks duplicate the work of
`common.mustCall()` and are superfluous. Remove them.

Signed-off-by: Rich Trott <rtrott@gmail.com>

PR-URL: #32120
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
  • Loading branch information
Trott committed Mar 8, 2020
commit 1b35e8402f890a7b7c9b701a0d2f61cf39a0fc7c
7 changes: 0 additions & 7 deletions test/sequential/test-net-reconnect-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,17 @@ const common = require('../common');
const net = require('net');
const assert = require('assert');
const N = 20;
let clientErrorCount = 0;
let disconnectCount = 0;

const c = net.createConnection(common.PORT);

c.on('connect', common.mustNotCall('client should not have connected'));

c.on('error', common.mustCall((e) => {
clientErrorCount++;
assert.strictEqual(e.code, 'ECONNREFUSED');
}, N + 1));

c.on('close', common.mustCall(() => {
if (disconnectCount++ < N)
c.connect(common.PORT); // reconnect
}, N + 1));

process.on('exit', function() {
assert.strictEqual(disconnectCount, N + 1);
assert.strictEqual(clientErrorCount, N + 1);
});