Skip to content

Commit 66554c7

Browse files
stpCollabr8nLstnaddaleax
authored andcommitted
test: refactor test-tls-ecdh
clear out const/let change assert.notEqual to assert move assert after common.hasCrypto check PR-URL: #9878 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
1 parent a857c9a commit 66554c7

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

test/parallel/test-tls-ecdh.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
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 exec = require('child_process').exec;
12-
var fs = require('fs');
11+
const exec = require('child_process').exec;
12+
const fs = require('fs');
1313

14-
var options = {
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: '-ALL:ECDHE-RSA-AES128-SHA256',
1818
ecdhCurve: 'prime256v1'
1919
};
2020

21-
var reply = 'I AM THE WALRUS'; // something recognizable
21+
const reply = 'I AM THE WALRUS'; // something recognizable
2222

23-
var server = tls.createServer(options, common.mustCall(function(conn) {
23+
const server = tls.createServer(options, common.mustCall(function(conn) {
2424
conn.end(reply);
2525
}));
2626

2727
server.listen(0, '127.0.0.1', common.mustCall(function() {
28-
var cmd = '"' + common.opensslCli + '" s_client -cipher ' + options.ciphers +
28+
let cmd = '"' + common.opensslCli + '" s_client -cipher ' + options.ciphers +
2929
` -connect 127.0.0.1:${this.address().port}`;
3030

3131
// for the performance and stability issue in s_client on Windows
@@ -34,7 +34,7 @@ server.listen(0, '127.0.0.1', common.mustCall(function() {
3434

3535
exec(cmd, common.mustCall(function(err, stdout, stderr) {
3636
if (err) throw err;
37-
assert.notEqual(stdout.indexOf(reply), -1);
37+
assert(stdout.includes(reply));
3838
server.close();
3939
}));
4040
}));

0 commit comments

Comments
 (0)