mirror of https://github.com/nodejs/node.git
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: https://github.com/nodejs/node/pull/32120 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com>pull/32120/head
parent
4c6ef4b7e2
commit
1b35e8402f
|
@ -24,7 +24,6 @@ const common = require('../common');
|
||||||
const net = require('net');
|
const net = require('net');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const N = 20;
|
const N = 20;
|
||||||
let clientErrorCount = 0;
|
|
||||||
let disconnectCount = 0;
|
let disconnectCount = 0;
|
||||||
|
|
||||||
const c = net.createConnection(common.PORT);
|
const c = net.createConnection(common.PORT);
|
||||||
|
@ -32,7 +31,6 @@ const c = net.createConnection(common.PORT);
|
||||||
c.on('connect', common.mustNotCall('client should not have connected'));
|
c.on('connect', common.mustNotCall('client should not have connected'));
|
||||||
|
|
||||||
c.on('error', common.mustCall((e) => {
|
c.on('error', common.mustCall((e) => {
|
||||||
clientErrorCount++;
|
|
||||||
assert.strictEqual(e.code, 'ECONNREFUSED');
|
assert.strictEqual(e.code, 'ECONNREFUSED');
|
||||||
}, N + 1));
|
}, N + 1));
|
||||||
|
|
||||||
|
@ -40,8 +38,3 @@ c.on('close', common.mustCall(() => {
|
||||||
if (disconnectCount++ < N)
|
if (disconnectCount++ < N)
|
||||||
c.connect(common.PORT); // reconnect
|
c.connect(common.PORT); // reconnect
|
||||||
}, N + 1));
|
}, N + 1));
|
||||||
|
|
||||||
process.on('exit', function() {
|
|
||||||
assert.strictEqual(disconnectCount, N + 1);
|
|
||||||
assert.strictEqual(clientErrorCount, N + 1);
|
|
||||||
});
|
|
||||||
|
|
Loading…
Reference in New Issue