Skip to content

Commit

Permalink
test: remove superfluous checks in test-net-reconnect-error
Browse files Browse the repository at this point in the history
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 authored and MylesBorins committed Mar 9, 2020
1 parent 74edcc5 commit da7349d
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions test/sequential/test-net-reconnect-error.js
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);
});

0 comments on commit da7349d

Please sign in to comment.