From d3c85a48060b26c1479bf9034a4c5563d269779a Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 23 Jun 2017 15:04:07 -0700 Subject: [PATCH] test: refactor test-tls-invoked-queued * use common.mustCall()/common.mustNotCall() as appropriate * reorder require() statements per test writing guide * add comment PR-URL: https://github.com/nodejs/node/pull/13893 Reviewed-By: Refael Ackermann Reviewed-By: Richard Lau Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- test/parallel/test-tls-invoke-queued.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/parallel/test-tls-invoke-queued.js b/test/parallel/test-tls-invoke-queued.js index 2a8037c8d74119..6bbf2369ff18a0 100644 --- a/test/parallel/test-tls-invoke-queued.js +++ b/test/parallel/test-tls-invoke-queued.js @@ -1,31 +1,31 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -const tls = require('tls'); +const assert = require('assert'); const fs = require('fs'); - +const tls = require('tls'); let received = ''; const server = tls.createServer({ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`), cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`) -}, function(c) { - c._write('hello ', null, function() { - c._write('world!', null, function() { +}, common.mustCall(function(c) { + c._write('hello ', null, common.mustCall(function() { + c._write('world!', null, common.mustCall(function() { c.destroy(); - }); - c._write(' gosh', null, common.noop); - }); + })); + // Data on next _write() will be written but callback will not be invoked + c._write(' gosh', null, common.mustNotCall()); + })); server.close(); -}).listen(0, common.mustCall(function() { +})).listen(0, common.mustCall(function() { const c = tls.connect(this.address().port, { rejectUnauthorized: false }, common.mustCall(function() {