From c456ca3601c12fbc6ff1d22e5af1e36502b57094 Mon Sep 17 00:00:00 2001 From: Chris Bystrek Date: Thu, 1 Dec 2016 13:18:50 -0600 Subject: [PATCH] test: refactor test-tls-destroy-whilst-write Update var to let/const and replace arbitrary timeout. PR-URL: https://github.com/nodejs/node/pull/10064 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Gibson Fahnestock --- test/parallel/test-tls-destroy-whilst-write.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/parallel/test-tls-destroy-whilst-write.js b/test/parallel/test-tls-destroy-whilst-write.js index 4f6ede968be408..b4f9766d998630 100644 --- a/test/parallel/test-tls-destroy-whilst-write.js +++ b/test/parallel/test-tls-destroy-whilst-write.js @@ -1,26 +1,26 @@ 'use strict'; -var common = require('../common'); +const common = require('../common'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var tls = require('tls'); -var stream = require('stream'); +const tls = require('tls'); +const stream = require('stream'); -var delay = new stream.Duplex({ +const delay = new stream.Duplex({ read: function read() { }, write: function write(data, enc, cb) { console.log('pending'); - setTimeout(function() { + setImmediate(function() { console.log('done'); cb(); - }, 200); + }); } }); -var secure = tls.connect({ +const secure = tls.connect({ socket: delay }); setImmediate(function() {