Browse Source

test: refactor test-tls-env-extra-ca

* Use `common.mustCall()` to guarantee callback invocations
* Order modules according to test writing guide

PR-URL: https://github.com/nodejs/node/pull/13886
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
v6
Rich Trott 8 years ago
parent
commit
062c414f5c
  1. 13
      test/parallel/test-tls-env-extra-ca.js

13
test/parallel/test-tls-env-extra-ca.js

@ -9,18 +9,19 @@ if (!common.hasCrypto) {
}
const assert = require('assert');
const fs = require('fs');
const tls = require('tls');
const fork = require('child_process').fork;
const fs = require('fs');
if (process.env.CHILD) {
const copts = {
port: process.env.PORT,
checkServerIdentity: common.noop,
checkServerIdentity: common.mustCall(),
};
const client = tls.connect(copts, function() {
const client = tls.connect(copts, common.mustCall(function() {
client.end('hi');
});
}));
return;
}
@ -29,10 +30,10 @@ const options = {
cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`),
};
const server = tls.createServer(options, function(s) {
const server = tls.createServer(options, common.mustCall(function(s) {
s.end('bye');
server.close();
}).listen(0, common.mustCall(function() {
})).listen(0, common.mustCall(function() {
const env = {
CHILD: 'yes',
PORT: this.address().port,

Loading…
Cancel
Save