Skip to content

Commit 9b7d748

Browse files
davidmarkclementsaddaleax
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 <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]>
1 parent d698f9d commit 9b7d748

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

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

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

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

11-
varfs=require('fs');
11+
constfs=require('fs');
1212

13-
varkey=fs.readFileSync(common.fixturesDir+'/keys/agent1-key.pem');
14-
varcert=fs.readFileSync(common.fixturesDir+'/keys/agent1-cert.pem');
13+
constkey=fs.readFileSync(common.fixturesDir+'/keys/agent1-key.pem');
14+
constcert=fs.readFileSync(common.fixturesDir+'/keys/agent1-cert.pem');
1515

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

1919
httpsTest();
2020

2121
functionhttpsTest(){
22-
varsopt={key: key,cert: cert};
22+
constsopt={key: key,cert: cert};
2323

24-
varserver=https.createServer(sopt,function(req,res){
24+
constserver=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-
varopts={port: this.address().port,rejectUnauthorized: false};
31+
constopts={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
functiontest(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-
varbytes=0;
48+
letbytes=0;
4949
res.on('data',function(chunk){
5050
bytes+=chunk.length;
5151
this.pause();

0 commit comments

Comments
(0)