From a5bdcc39ac1353c37c12fd9b2bc11d6509b3c8bf Mon Sep 17 00:00:00 2001 From: Adrian Estrada Date: Sun, 1 Jan 2017 23:48:58 -0500 Subject: [PATCH] test: improve test-fs-readfile-zero-byte-liar * use const instead of var * use assert.strictEqual instead of assert.equal * use arrow functions PR-URL: https://github.com/nodejs/node/pull/10570 Reviewed-By: Luigi Pinca Reviewed-By: Italo A. Casas Reviewed-By: James M Snell --- .../test-fs-readfile-zero-byte-liar.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/parallel/test-fs-readfile-zero-byte-liar.js b/test/parallel/test-fs-readfile-zero-byte-liar.js index bbcbfeb7c9..82037a77e6 100644 --- a/test/parallel/test-fs-readfile-zero-byte-liar.js +++ b/test/parallel/test-fs-readfile-zero-byte-liar.js @@ -3,29 +3,29 @@ const common = require('../common'); const assert = require('assert'); const fs = require('fs'); -var dataExpected = fs.readFileSync(__filename, 'utf8'); +const dataExpected = fs.readFileSync(__filename, 'utf8'); // sometimes stat returns size=0, but it's a lie. fs._fstat = fs.fstat; fs._fstatSync = fs.fstatSync; -fs.fstat = function(fd, cb) { - fs._fstat(fd, function(er, st) { +fs.fstat = (fd, cb) => { + fs._fstat(fd, (er, st) => { if (er) return cb(er); st.size = 0; return cb(er, st); }); }; -fs.fstatSync = function(fd) { - var st = fs._fstatSync(fd); +fs.fstatSync = (fd) => { + const st = fs._fstatSync(fd); st.size = 0; return st; }; -var d = fs.readFileSync(__filename, 'utf8'); -assert.equal(d, dataExpected); +const d = fs.readFileSync(__filename, 'utf8'); +assert.strictEqual(d, dataExpected); -fs.readFile(__filename, 'utf8', common.mustCall(function(er, d) { - assert.equal(d, dataExpected); +fs.readFile(__filename, 'utf8', common.mustCall((er, d) => { + assert.strictEqual(d, dataExpected); }));