Skip to content

Commit

Permalink
test: refactor test-tls-invoked-queued
Browse files Browse the repository at this point in the history
* use common.mustCall()/common.mustNotCall() as appropriate
* reorder require() statements per test writing guide
* add comment

PR-URL: #13893
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
Trott authored and addaleax committed Jun 29, 2017
1 parent 4141b57 commit 7a721b0
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions test/parallel/test-tls-invoke-queued.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,32 @@

'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() {
Expand Down

0 comments on commit 7a721b0

Please sign in to comment.