Browse Source

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 <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
v4.x
Chris Bystrek 8 years ago
committed by Myles Borins
parent
commit
cff80a5c0e
  1. 14
      test/parallel/test-tls-destroy-whilst-write.js

14
test/parallel/test-tls-destroy-whilst-write.js

@ -1,26 +1,26 @@
'use strict'; 'use strict';
var common = require('../common'); const common = require('../common');
if (!common.hasCrypto) { if (!common.hasCrypto) {
common.skip('missing crypto'); common.skip('missing crypto');
return; return;
} }
var tls = require('tls'); const tls = require('tls');
var stream = require('stream'); const stream = require('stream');
var delay = new stream.Duplex({ const delay = new stream.Duplex({
read: function read() { read: function read() {
}, },
write: function write(data, enc, cb) { write: function write(data, enc, cb) {
console.log('pending'); console.log('pending');
setTimeout(function() { setImmediate(function() {
console.log('done'); console.log('done');
cb(); cb();
}, 200); });
} }
}); });
var secure = tls.connect({ const secure = tls.connect({
socket: delay socket: delay
}); });
setImmediate(function() { setImmediate(function() {

Loading…
Cancel
Save