Skip to content

Commit

Permalink
test: improve test-fs-read-stream.js
Browse files Browse the repository at this point in the history
var -> const
assert.equal() -> assert.strictEqual()

PR-URL: #9629
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
  • Loading branch information
jennabelle authored and addaleax committed Dec 8, 2016
1 parent 39bf5bf commit e695862
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions test/parallel/test-fs-read-stream.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
'use strict';
var common = require('../common');
var assert = require('assert');
const common = require('../common');
const assert = require('assert');

var path = require('path');
var fs = require('fs');
var fn = path.join(common.fixturesDir, 'elipses.txt');
var rangeFile = path.join(common.fixturesDir, 'x.txt');
const path = require('path');
const fs = require('fs');
const fn = path.join(common.fixturesDir, 'elipses.txt');
const rangeFile = path.join(common.fixturesDir, 'x.txt');

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

Expand All @@ -20,7 +20,7 @@ assert.strictEqual(file.bytesRead, 0);
file.on('open', function(fd) {
file.length = 0;
callbacks.open++;
assert.equal('number', typeof fd);
assert.strictEqual('number', typeof fd);
assert.strictEqual(file.bytesRead, 0);
assert.ok(file.readable);

Expand Down Expand Up @@ -67,12 +67,12 @@ file.on('close', function() {
var file3 = fs.createReadStream(fn, {encoding: 'utf8'});
file3.length = 0;
file3.on('data', function(data) {
assert.equal('string', typeof data);
assert.strictEqual('string', typeof data);
file3.length += data.length;

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

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

process.on('exit', function() {
assert.equal(1, callbacks.open);
assert.equal(1, callbacks.end);
assert.equal(2, callbacks.close);
assert.equal(30000, file.length);
assert.equal(10000, file3.length);
assert.strictEqual(1, callbacks.open);
assert.strictEqual(1, callbacks.end);
assert.strictEqual(2, callbacks.close);
assert.strictEqual(30000, file.length);
assert.strictEqual(10000, file3.length);
console.error('ok');
});

Expand All @@ -95,7 +95,7 @@ file4.on('data', function(data) {
contentRead += data.toString('utf-8');
});
file4.on('end', function(data) {
assert.equal(contentRead, 'yz');
assert.strictEqual(contentRead, 'yz');
});

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

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

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

stream.on('end', function() {
assert.equal('x', stream.data);
assert.strictEqual('x', stream.data);
});

// pause and then resume immediately.
Expand All @@ -155,7 +155,7 @@ function file7Next() {
file7.data += data;
});
file7.on('end', function(err) {
assert.equal(file7.data, 'xyz\n');
assert.strictEqual(file7.data, 'xyz\n');
});
}

Expand Down

0 comments on commit e695862

Please sign in to comment.