Skip to content

Commit e695862

Browse files
jennabelleaddaleax
authored andcommitted
test: improve test-fs-read-stream.js
var -> const assert.equal() -> assert.strictEqual() PR-URL: #9629 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]>
1 parent 39bf5bf commit e695862

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

test/parallel/test-fs-read-stream.js

+19-19
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
'use strict';
2-
var common = require('../common');
3-
var assert = require('assert');
2+
const common = require('../common');
3+
const assert = require('assert');
44

5-
var path = require('path');
6-
var fs = require('fs');
7-
var fn = path.join(common.fixturesDir, 'elipses.txt');
8-
var rangeFile = path.join(common.fixturesDir, 'x.txt');
5+
const path = require('path');
6+
const fs = require('fs');
7+
const fn = path.join(common.fixturesDir, 'elipses.txt');
8+
const rangeFile = path.join(common.fixturesDir, 'x.txt');
99

1010
var callbacks = { open: 0, end: 0, close: 0 };
1111

@@ -20,7 +20,7 @@ assert.strictEqual(file.bytesRead, 0);
2020
file.on('open', function(fd) {
2121
file.length = 0;
2222
callbacks.open++;
23-
assert.equal('number', typeof fd);
23+
assert.strictEqual('number', typeof fd);
2424
assert.strictEqual(file.bytesRead, 0);
2525
assert.ok(file.readable);
2626

@@ -67,12 +67,12 @@ file.on('close', function() {
6767
var file3 = fs.createReadStream(fn, {encoding: 'utf8'});
6868
file3.length = 0;
6969
file3.on('data', function(data) {
70-
assert.equal('string', typeof data);
70+
assert.strictEqual('string', typeof data);
7171
file3.length += data.length;
7272

7373
for (var i = 0; i < data.length; i++) {
7474
// http://www.fileformat.info/info/unicode/char/2026/index.htm
75-
assert.equal('\u2026', data[i]);
75+
assert.strictEqual('\u2026', data[i]);
7676
}
7777
});
7878

@@ -81,11 +81,11 @@ file3.on('close', function() {
8181
});
8282

8383
process.on('exit', function() {
84-
assert.equal(1, callbacks.open);
85-
assert.equal(1, callbacks.end);
86-
assert.equal(2, callbacks.close);
87-
assert.equal(30000, file.length);
88-
assert.equal(10000, file3.length);
84+
assert.strictEqual(1, callbacks.open);
85+
assert.strictEqual(1, callbacks.end);
86+
assert.strictEqual(2, callbacks.close);
87+
assert.strictEqual(30000, file.length);
88+
assert.strictEqual(10000, file3.length);
8989
console.error('ok');
9090
});
9191

@@ -95,7 +95,7 @@ file4.on('data', function(data) {
9595
contentRead += data.toString('utf-8');
9696
});
9797
file4.on('end', function(data) {
98-
assert.equal(contentRead, 'yz');
98+
assert.strictEqual(contentRead, 'yz');
9999
});
100100

101101
var file5 = fs.createReadStream(rangeFile, {bufferSize: 1, start: 1});
@@ -104,7 +104,7 @@ file5.on('data', function(data) {
104104
file5.data += data.toString('utf-8');
105105
});
106106
file5.on('end', function() {
107-
assert.equal(file5.data, 'yz\n');
107+
assert.strictEqual(file5.data, 'yz\n');
108108
});
109109

110110
// https://github.com/joyent/node/issues/2320
@@ -114,7 +114,7 @@ file6.on('data', function(data) {
114114
file6.data += data.toString('utf-8');
115115
});
116116
file6.on('end', function() {
117-
assert.equal(file6.data, 'yz\n');
117+
assert.strictEqual(file6.data, 'yz\n');
118118
});
119119

120120
assert.throws(function() {
@@ -129,7 +129,7 @@ stream.on('data', function(chunk) {
129129
});
130130

131131
stream.on('end', function() {
132-
assert.equal('x', stream.data);
132+
assert.strictEqual('x', stream.data);
133133
});
134134

135135
// pause and then resume immediately.
@@ -155,7 +155,7 @@ function file7Next() {
155155
file7.data += data;
156156
});
157157
file7.on('end', function(err) {
158-
assert.equal(file7.data, 'xyz\n');
158+
assert.strictEqual(file7.data, 'xyz\n');
159159
});
160160
}
161161

0 commit comments

Comments
 (0)