summaryrefslogtreecommitdiff
path: root/test/parallel/test-https-agent-session-reuse.js
diff options
context:
space:
mode:
authorDiego Paez <paez.di@gmail.com>2016-12-03 16:21:11 +0000
committerAnna Henningsen <anna@addaleax.net>2016-12-08 01:14:25 +0100
commit83d9cd80bfd99f01e713aa35a7f2935be09c42da (patch)
treee7a0acc3ed30bd1112ec4c089aa46968488c1257 /test/parallel/test-https-agent-session-reuse.js
parent89603835b3b165f3b64373c06f635aaf04dd626c (diff)
downloadnode-new-83d9cd80bfd99f01e713aa35a7f2935be09c42da.tar.gz
test: refactor test-https-agent-session-reuse
Use const and let instead of var and assert.strictEqual() instead of assert.equal() PR-URL: https://github.com/nodejs/node/pull/10105 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'test/parallel/test-https-agent-session-reuse.js')
-rw-r--r--test/parallel/test-https-agent-session-reuse.js36
1 files changed, 18 insertions, 18 deletions
diff --git a/test/parallel/test-https-agent-session-reuse.js b/test/parallel/test-https-agent-session-reuse.js
index 01f161574b..73465aa5a9 100644
--- a/test/parallel/test-https-agent-session-reuse.js
+++ b/test/parallel/test-https-agent-session-reuse.js
@@ -1,39 +1,39 @@
'use strict';
-var common = require('../common');
-var assert = require('assert');
+const common = require('../common');
+const assert = require('assert');
if (!common.hasCrypto) {
common.skip('missing crypto');
return;
}
-var https = require('https');
-var crypto = require('crypto');
+const https = require('https');
+const crypto = require('crypto');
-var fs = require('fs');
+const fs = require('fs');
-var options = {
+const options = {
key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
};
-var ca = fs.readFileSync(common.fixturesDir + '/keys/ca1-cert.pem');
+const ca = fs.readFileSync(common.fixturesDir + '/keys/ca1-cert.pem');
-var clientSessions = {};
-var serverRequests = 0;
+const clientSessions = {};
+let serverRequests = 0;
-var agent = new https.Agent({
+const agent = new https.Agent({
maxCachedSessions: 1
});
-var server = https.createServer(options, function(req, res) {
+const server = https.createServer(options, function(req, res) {
if (req.url === '/drop-key')
server.setTicketKeys(crypto.randomBytes(48));
serverRequests++;
res.end('ok');
}).listen(0, function() {
- var queue = [
+ const queue = [
{
name: 'first',
@@ -97,7 +97,7 @@ var server = https.createServer(options, function(req, res) {
];
function request() {
- var options = queue.shift();
+ const options = queue.shift();
options.agent = agent;
https.request(options, function(res) {
clientSessions[options.name] = res.socket.getSession();
@@ -114,9 +114,9 @@ var server = https.createServer(options, function(req, res) {
});
process.on('exit', function() {
- assert.equal(serverRequests, 6);
- assert.equal(clientSessions['first'].toString('hex'),
- clientSessions['first-reuse'].toString('hex'));
+ assert.strictEqual(serverRequests, 6);
+ assert.strictEqual(clientSessions['first'].toString('hex'),
+ clientSessions['first-reuse'].toString('hex'));
assert.notEqual(clientSessions['first'].toString('hex'),
clientSessions['cipher-change'].toString('hex'));
assert.notEqual(clientSessions['first'].toString('hex'),
@@ -125,6 +125,6 @@ process.on('exit', function() {
clientSessions['before-drop'].toString('hex'));
assert.notEqual(clientSessions['before-drop'].toString('hex'),
clientSessions['after-drop'].toString('hex'));
- assert.equal(clientSessions['after-drop'].toString('hex'),
- clientSessions['after-drop-reuse'].toString('hex'));
+ assert.strictEqual(clientSessions['after-drop'].toString('hex'),
+ clientSessions['after-drop-reuse'].toString('hex'));
});