From 7a38e4934110c99c4add34c85f1ea43d69cfed44 Mon Sep 17 00:00:00 2001 From: Devon Rifkin Date: Thu, 1 Dec 2016 09:49:49 -0600 Subject: [PATCH] test: refactor test-tls-timeout-server-2 * Use `common.mustCall` for all callbacks * Use `const` instead of `var` PR-URL: https://github.com/nodejs/node/pull/9876 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- test/parallel/test-tls-timeout-server-2.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/parallel/test-tls-timeout-server-2.js b/test/parallel/test-tls-timeout-server-2.js index a054f41f623455..1613e9fc4e06d6 100644 --- a/test/parallel/test-tls-timeout-server-2.js +++ b/test/parallel/test-tls-timeout-server-2.js @@ -1,32 +1,32 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); +const assert = require('assert'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var tls = require('tls'); +const tls = require('tls'); -var fs = require('fs'); +const fs = require('fs'); -var options = { +const options = { key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'), cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem') }; -var server = tls.createServer(options, function(cleartext) { - var s = cleartext.setTimeout(50, function() { +const server = tls.createServer(options, common.mustCall(function(cleartext) { + const s = cleartext.setTimeout(50, function() { cleartext.destroy(); server.close(); }); assert.ok(s instanceof tls.TLSSocket); -}); +})); -server.listen(0, function() { +server.listen(0, common.mustCall(function() { tls.connect({ host: '127.0.0.1', port: this.address().port, rejectUnauthorized: false }); -}); +}));