Skip to content

Commit 64b2494

Browse files
Ethan-ArrowoodFishrock123
authored andcommitted
test: updated tls-getcipher test
Changed var to ES6 syntax const/let. Added common.mustCall function wrapper to all functions called exactly once. Changed assert.equal to assert.strictEqual. PR-URL: #9923 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent e502262 commit 64b2494

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

test/parallel/test-tls-getcipher.js

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
'use strict';
2-
var common = require('../common');
3-
var assert = require('assert');
2+
const common = require('../common');
43

54
if (!common.hasCrypto) {
65
common.skip('missing crypto');
76
return;
87
}
9-
var tls = require('tls');
8+
const assert = require('assert');
9+
const tls = require('tls');
1010

11-
var fs = require('fs');
12-
var cipher_list = ['AES128-SHA256', 'AES256-SHA256'];
13-
var cipher_version_pattern = /TLS|SSL/;
14-
var options = {
11+
const fs = require('fs');
12+
const cipher_list = ['AES128-SHA256', 'AES256-SHA256'];
13+
const cipher_version_pattern = /TLS|SSL/;
14+
const options = {
1515
key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
1616
cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem'),
1717
ciphers: cipher_list.join(':'),
1818
honorCipherOrder: true
1919
};
2020

21-
var server = tls.createServer(options,
22-
common.mustCall(function(cleartextStream) {}));
21+
const server = tls.createServer(options,
22+
common.mustCall(function(cleartextStream) {}));
2323

24-
server.listen(0, '127.0.0.1', function() {
25-
var client = tls.connect({
24+
server.listen(0, '127.0.0.1', common.mustCall(function() {
25+
const client = tls.connect({
2626
host: '127.0.0.1',
2727
port: this.address().port,
2828
ciphers: cipher_list.join(':'),
2929
rejectUnauthorized: false
30-
}, function() {
31-
var cipher = client.getCipher();
32-
assert.equal(cipher.name, cipher_list[0]);
30+
}, common.mustCall(function() {
31+
const cipher = client.getCipher();
32+
assert.strictEqual(cipher.name, cipher_list[0]);
3333
assert(cipher_version_pattern.test(cipher.version));
3434
client.end();
3535
server.close();
36-
});
37-
});
36+
}));
37+
}));

0 commit comments

Comments
 (0)