Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add mustCall to setTimeout #9984

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
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
14 changes: 7 additions & 7 deletions test/parallel/test-net-keepalive.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
'use strict';
var common = require('../common');
var assert = require('assert');
var net = require('net');
let common = require('../common');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not const instead of let?

let assert = require('assert');
let net = require('net');

var serverConnection;
var clientConnection;
var echoServer = net.createServer(function(connection) {
serverConnection = connection;
setTimeout(function() {
setTimeout(common.mustCall(function() {
// make sure both connections are still open
assert.equal(serverConnection.readyState, 'open');
assert.equal(clientConnection.readyState, 'open');
assert.strictEqual(serverConnection.readyState, 'open');
assert.strictEqual(clientConnection.readyState, 'open');
serverConnection.end();
clientConnection.end();
echoServer.close();
}, common.platformTimeout(100));
},1), common.platformTimeout(100));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a space before the 1 here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: A space before 1

connection.setTimeout(0);
assert.notEqual(connection.setKeepAlive, undefined);
// send a keepalive packet after 50 ms
Expand Down