Skip to content

Commit 47c925a

Browse files
Ethan-Arrowoodaddaleax
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 bc3b77f commit 47c925a

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed
Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
'use strict';
2-
varcommon=require('../common');
3-
varassert=require('assert');
2+
constcommon=require('../common');
43

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

11-
varfs=require('fs');
12-
varcipher_list=['AES128-SHA256','AES256-SHA256'];
13-
varcipher_version_pattern=/TLS|SSL/;
14-
varoptions={
11+
constfs=require('fs');
12+
constcipher_list=['AES128-SHA256','AES256-SHA256'];
13+
constcipher_version_pattern=/TLS|SSL/;
14+
constoptions={
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-
varserver=tls.createServer(options,
22-
common.mustCall(function(cleartextStream){}));
21+
constserver=tls.createServer(options,
22+
common.mustCall(function(cleartextStream){}));
2323

24-
server.listen(0,'127.0.0.1',function(){
25-
varclient=tls.connect({
24+
server.listen(0,'127.0.0.1',common.mustCall(function(){
25+
constclient=tls.connect({
2626
host: '127.0.0.1',
2727
port: this.address().port,
2828
ciphers: cipher_list.join(':'),
2929
rejectUnauthorized: false
30-
},function(){
31-
varcipher=client.getCipher();
32-
assert.equal(cipher.name,cipher_list[0]);
30+
},common.mustCall(function(){
31+
constcipher=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)