mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
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 <refack@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
062c414f5c
commit
fda25665be
@ -21,32 +21,32 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
const assert = require('assert');
|
|
||||||
|
|
||||||
if (!common.hasCrypto) {
|
if (!common.hasCrypto) {
|
||||||
common.skip('missing crypto');
|
common.skip('missing crypto');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const tls = require('tls');
|
|
||||||
|
|
||||||
|
const assert = require('assert');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
const tls = require('tls');
|
||||||
|
|
||||||
let received = '';
|
let received = '';
|
||||||
|
|
||||||
const server = tls.createServer({
|
const server = tls.createServer({
|
||||||
key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
|
key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
|
||||||
cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
|
cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
|
||||||
}, function(c) {
|
}, common.mustCall(function(c) {
|
||||||
c._write('hello ', null, function() {
|
c._write('hello ', null, common.mustCall(function() {
|
||||||
c._write('world!', null, function() {
|
c._write('world!', null, common.mustCall(function() {
|
||||||
c.destroy();
|
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();
|
server.close();
|
||||||
}).listen(0, common.mustCall(function() {
|
})).listen(0, common.mustCall(function() {
|
||||||
const c = tls.connect(this.address().port, {
|
const c = tls.connect(this.address().port, {
|
||||||
rejectUnauthorized: false
|
rejectUnauthorized: false
|
||||||
}, common.mustCall(function() {
|
}, common.mustCall(function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user