Skip to content

Commit 7bd9ecd

Browse files
Trottaddaleax
authored andcommitted
test: refactor test-zlib.js
* minor layout changes for clarity * assert.equal() and assert.ok() swapped out for assert.strictEqual() * var -> const for modules included via require() PR-URL: #9544 Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
1 parent 8a94c69 commit 7bd9ecd

1 file changed

Lines changed: 20 additions & 16 deletions

File tree

‎test/parallel/test-zlib.js‎

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@ const common = require('../common');
33
constassert=require('assert');
44
constzlib=require('zlib');
55
constpath=require('path');
6-
7-
varzlibPairs=
8-
[[zlib.Deflate,zlib.Inflate],
9-
[zlib.Gzip,zlib.Gunzip],
10-
[zlib.Deflate,zlib.Unzip],
11-
[zlib.Gzip,zlib.Unzip],
12-
[zlib.DeflateRaw,zlib.InflateRaw]];
6+
constfs=require('fs');
7+
constutil=require('util');
8+
conststream=require('stream');
9+
10+
varzlibPairs=[
11+
[zlib.Deflate,zlib.Inflate],
12+
[zlib.Gzip,zlib.Gunzip],
13+
[zlib.Deflate,zlib.Unzip],
14+
[zlib.Gzip,zlib.Unzip],
15+
[zlib.DeflateRaw,zlib.InflateRaw]
16+
];
1317

1418
// how fast to trickle through the slowstream
1519
vartrickle=[128,1024,1024*1024];
@@ -36,23 +40,18 @@ if (!process.env.PUMMEL) {
3640
strategy=[0];
3741
}
3842

39-
varfs=require('fs');
40-
4143
vartestFiles=['person.jpg','elipses.txt','empty.txt'];
4244

4345
if(process.env.FAST){
4446
zlibPairs=[[zlib.Gzip,zlib.Unzip]];
4547
testFiles=['person.jpg'];
4648
}
4749

48-
vartests={};
50+
consttests={};
4951
testFiles.forEach(function(file){
5052
tests[file]=fs.readFileSync(path.resolve(common.fixturesDir,file));
5153
});
5254

53-
varutil=require('util');
54-
varstream=require('stream');
55-
5655

5756
// stream that saves everything
5857
functionBufferStream(){
@@ -197,11 +196,16 @@ Object.keys(tests).forEach(function(file) {
197196
ss.pipe(def).pipe(inf).pipe(buf);
198197
ss.end(test);
199198
});
200-
});});});});});});// sad stallman is sad.
199+
});
200+
});
201+
});
202+
});
203+
});
204+
});
201205
});
202206

203207
process.on('exit',function(code){
204208
console.log('1..'+done);
205-
assert.equal(done,total,(total-done)+' tests left unfinished');
206-
assert.ok(!failures,'some test failures');
209+
assert.strictEqual(done,total,(total-done)+' tests left unfinished');
210+
assert.strictEqual(failures,0,'some test failures');
207211
});

0 commit comments

Comments
 (0)