|
1 | 1 | 'use strict'; |
2 | | -var common = require('../common'); |
3 | | -var assert = require('assert'); |
| 2 | +const common = require('../common'); |
| 3 | +const assert = require('assert'); |
4 | 4 |
|
5 | 5 | if (!common.hasCrypto) { |
6 | 6 | common.skip('missing crypto'); |
7 | 7 | return; |
8 | 8 | } |
9 | | -var tls = require('tls'); |
| 9 | +const tls = require('tls'); |
10 | 10 |
|
11 | | -var fs = require('fs'); |
| 11 | +const fs = require('fs'); |
12 | 12 |
|
13 | | -var key = fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'); |
14 | | -var cert = fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'); |
| 13 | +const key = fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'); |
| 14 | +const cert = fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'); |
15 | 15 |
|
16 | | -tls.createServer({ key: key, cert: cert }, function(conn) { |
| 16 | +tls.createServer({ key: key, cert: cert }, common.mustCall(function(conn) { |
17 | 17 | conn.end(); |
18 | 18 | this.close(); |
19 | | -}).listen(0, function() { |
| 19 | +})).listen(0, common.mustCall(function() { |
20 | 20 | var options = { port: this.address().port, rejectUnauthorized: true }; |
21 | 21 | tls.connect(options).on('error', common.mustCall(function(err) { |
22 | | - assert.equal(err.code, 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'); |
23 | | - assert.equal(err.message, 'unable to verify the first certificate'); |
| 22 | + assert.strictEqual(err.code, 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'); |
| 23 | + assert.strictEqual(err.message, 'unable to verify the first certificate'); |
24 | 24 | this.destroy(); |
25 | 25 | })); |
26 | | -}); |
| 26 | +})); |
0 commit comments