Browse Source

test: refactor test-net-keepalive.js

- Replace require() vars with const.
- Replace assert.equal() with assert.strictEqual().
- Add common.mustCall() to the setTimeout() callback.

PR-URL: https://github.com/nodejs/node/pull/9995
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
v7.x
Kyle Corsi 8 years ago
committed by Jeremiah Senkpiel
parent
commit
ca38f70dea
  1. 14
      test/parallel/test-net-keepalive.js

14
test/parallel/test-net-keepalive.js

@ -1,20 +1,20 @@
'use strict'; 'use strict';
var common = require('../common'); const common = require('../common');
var assert = require('assert'); const assert = require('assert');
var net = require('net'); const net = require('net');
var serverConnection; var serverConnection;
var clientConnection; var clientConnection;
var echoServer = net.createServer(function(connection) { var echoServer = net.createServer(function(connection) {
serverConnection = connection; serverConnection = connection;
setTimeout(function() { setTimeout(common.mustCall(function() {
// make sure both connections are still open // make sure both connections are still open
assert.equal(serverConnection.readyState, 'open'); assert.strictEqual(serverConnection.readyState, 'open');
assert.equal(clientConnection.readyState, 'open'); assert.strictEqual(clientConnection.readyState, 'open');
serverConnection.end(); serverConnection.end();
clientConnection.end(); clientConnection.end();
echoServer.close(); echoServer.close();
}, common.platformTimeout(100)); }, 1), common.platformTimeout(100));
connection.setTimeout(0); connection.setTimeout(0);
assert.notEqual(connection.setKeepAlive, undefined); assert.notEqual(connection.setKeepAlive, undefined);
// send a keepalive packet after 50 ms // send a keepalive packet after 50 ms

Loading…
Cancel
Save