Skip to content

Commit 74aed0b

Browse files
Trottaddaleax
authored andcommitted
test: refactor test-tls-invoked-queued
* 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]>
1 parent a767367 commit 74aed0b

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

test/parallel/test-tls-invoke-queued.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -21,32 +21,32 @@
2121

2222
'use strict';
2323
const common = require('../common');
24-
const assert = require('assert');
2524

2625
if (!common.hasCrypto) {
2726
common.skip('missing crypto');
2827
return;
2928
}
30-
const tls = require('tls');
3129

30+
const assert = require('assert');
3231
const fs = require('fs');
33-
32+
const tls = require('tls');
3433

3534
let received = '';
3635

3736
const server = tls.createServer({
3837
key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
3938
cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
40-
}, function(c) {
41-
c._write('hello ', null, function() {
42-
c._write('world!', null, function() {
39+
}, common.mustCall(function(c) {
40+
c._write('hello ', null, common.mustCall(function() {
41+
c._write('world!', null, common.mustCall(function() {
4342
c.destroy();
44-
});
45-
c._write(' gosh', null, common.noop);
46-
});
43+
}));
44+
// Data on next _write() will be written but callback will not be invoked
45+
c._write(' gosh', null, common.mustNotCall());
46+
}));
4747

4848
server.close();
49-
}).listen(0, common.mustCall(function() {
49+
})).listen(0, common.mustCall(function() {
5050
const c = tls.connect(this.address().port, {
5151
rejectUnauthorized: false
5252
}, common.mustCall(function() {

0 commit comments

Comments
 (0)