mirror of https://github.com/nodejs/node.git
test: refactor test-net-reconnect-error
* var -> const/let * assert.equal() -> assert.strictEqual() PR-URL: https://github.com/nodejs/node/pull/9903 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>pull/10401/head
parent
283321e6e4
commit
3c8a3a594e
|
@ -1,13 +1,13 @@
|
|||
'use strict';
|
||||
var common = require('../common');
|
||||
var net = require('net');
|
||||
var assert = require('assert');
|
||||
var N = 20;
|
||||
var client_error_count = 0;
|
||||
var disconnect_count = 0;
|
||||
const common = require('../common');
|
||||
const net = require('net');
|
||||
const assert = require('assert');
|
||||
const N = 20;
|
||||
let client_error_count = 0;
|
||||
let disconnect_count = 0;
|
||||
|
||||
// Hopefully nothing is running on common.PORT
|
||||
var c = net.createConnection(common.PORT);
|
||||
const c = net.createConnection(common.PORT);
|
||||
|
||||
c.on('connect', function() {
|
||||
console.error('CLIENT connected');
|
||||
|
@ -17,7 +17,7 @@ c.on('connect', function() {
|
|||
c.on('error', function(e) {
|
||||
console.error('CLIENT error: ' + e.code);
|
||||
client_error_count++;
|
||||
assert.equal('ECONNREFUSED', e.code);
|
||||
assert.strictEqual('ECONNREFUSED', e.code);
|
||||
});
|
||||
|
||||
c.on('close', function() {
|
||||
|
@ -27,6 +27,6 @@ c.on('close', function() {
|
|||
});
|
||||
|
||||
process.on('exit', function() {
|
||||
assert.equal(N + 1, disconnect_count);
|
||||
assert.equal(N + 1, client_error_count);
|
||||
assert.strictEqual(N + 1, disconnect_count);
|
||||
assert.strictEqual(N + 1, client_error_count);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue