test: cleanup parallel/test-fs-readfile-unlink.js
Changes var to const, != to !==, and assert.equal() to assert.strict Equal() PR-URL: https://github.com/nodejs/node/pull/8764 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
This commit is contained in:
parent
782db084ad
commit
e5f5f3aa73
@ -5,21 +5,20 @@ const fs = require('fs');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const dirName = path.resolve(common.fixturesDir, 'test-readfile-unlink');
|
const dirName = path.resolve(common.fixturesDir, 'test-readfile-unlink');
|
||||||
const fileName = path.resolve(dirName, 'test.bin');
|
const fileName = path.resolve(dirName, 'test.bin');
|
||||||
|
const buf = Buffer.alloc(512 * 1024, 42);
|
||||||
var buf = Buffer.alloc(512 * 1024, 42);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
fs.mkdirSync(dirName);
|
fs.mkdirSync(dirName);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// Ignore if the directory already exists.
|
// Ignore if the directory already exists.
|
||||||
if (e.code != 'EEXIST') throw e;
|
if (e.code !== 'EEXIST') throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
fs.writeFileSync(fileName, buf);
|
fs.writeFileSync(fileName, buf);
|
||||||
|
|
||||||
fs.readFile(fileName, function(err, data) {
|
fs.readFile(fileName, function(err, data) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
assert.equal(data.length, buf.length);
|
assert.strictEqual(data.length, buf.length);
|
||||||
assert.strictEqual(buf[0], 42);
|
assert.strictEqual(buf[0], 42);
|
||||||
|
|
||||||
fs.unlinkSync(fileName);
|
fs.unlinkSync(fileName);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user