Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cf3c635

Browse filesBrowse files
davidmarkclementsFishrock123
authored andcommitted
test: refactor test-https-truncate
Changes assert.equal to assert.strictEqual to ensure specificity. Changes var declarations to const/let where appropriate. PR-URL: #10074 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
1 parent 14c0388 commit cf3c635
Copy full SHA for cf3c635

File tree

Expand file treeCollapse file tree

1 file changed

+13
-13
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+13
-13
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-https-truncate.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-https-truncate.js
+13-13Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
'use strict';
2-
var common = require('../common');
3-
var assert = require('assert');
2+
const common = require('../common');
3+
const assert = require('assert');
44

55
if (!common.hasCrypto) {
66
common.skip('missing crypto');
77
return;
88
}
9-
var https = require('https');
9+
const https = require('https');
1010

11-
var fs = require('fs');
11+
const fs = require('fs');
1212

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');
1515

1616
// number of bytes discovered empirically to trigger the bug
17-
var data = Buffer.allocUnsafe(1024 * 32 + 1);
17+
const data = Buffer.allocUnsafe(1024 * 32 + 1);
1818

1919
httpsTest();
2020

2121
function httpsTest() {
22-
var sopt = { key: key, cert: cert };
22+
const sopt = { key: key, cert: cert };
2323

24-
var server = https.createServer(sopt, function(req, res) {
24+
const server = https.createServer(sopt, function(req, res) {
2525
res.setHeader('content-length', data.length);
2626
res.end(data);
2727
server.close();
2828
});
2929

3030
server.listen(0, function() {
31-
var opts = { port: this.address().port, rejectUnauthorized: false };
31+
const opts = { port: this.address().port, rejectUnauthorized: false };
3232
https.get(opts).on('response', function(res) {
3333
test(res);
3434
});
@@ -38,14 +38,14 @@ function httpsTest() {
3838

3939
function test(res) {
4040
res.on('end', function() {
41-
assert.equal(res._readableState.length, 0);
42-
assert.equal(bytes, data.length);
41+
assert.strictEqual(res._readableState.length, 0);
42+
assert.strictEqual(bytes, data.length);
4343
console.log('ok');
4444
});
4545

4646
// Pause and then resume on each chunk, to ensure that there will be
4747
// a lone byte hanging out at the very end.
48-
var bytes = 0;
48+
let bytes = 0;
4949
res.on('data', function(chunk) {
5050
bytes += chunk.length;
5151
this.pause();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.