From 3f619fdcb855d988795e90fd6d7115eb9833c6aa Mon Sep 17 00:00:00 2001 From: Iryna Thompson Date: Thu, 31 Jan 2019 16:08:19 -0500 Subject: [PATCH] =?UTF-8?q?Fixed=20#665:=20Replaced=20var=20with=20let=20o?= =?UTF-8?q?r=20const=20and=20added=20strict=20mode=20fs.a=E2=80=A6=20(#688?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fixed #665: Replaced var with let or const and added strict mode fs.access.spec.js * Replaced let with const * Replaced all let with const --- tests/spec/fs.access.spec.js | 40 +++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/tests/spec/fs.access.spec.js b/tests/spec/fs.access.spec.js index cb3b1e7..6a92261 100644 --- a/tests/spec/fs.access.spec.js +++ b/tests/spec/fs.access.spec.js @@ -1,12 +1,14 @@ -var util = require('../lib/test-utils.js'); -var expect = require('chai').expect; +'use strict'; + +const util = require('../lib/test-utils.js'); +const expect = require('chai').expect; describe('fs.access', function () { beforeEach(util.setup); afterEach(util.cleanup); it('should expose access mode flags on fs and fs.constants', function() { - var fs = util.fs(); + const fs = util.fs(); // F_OK expect(fs.F_OK).to.equal(0); @@ -26,12 +28,12 @@ describe('fs.access', function () { }); it('should be a function', function () { - var fs = util.fs(); + const fs = util.fs(); expect(typeof fs.access).to.equal('function'); }); it('should return an error if file does not exist', function (done) { - var fs = util.fs(); + const fs = util.fs(); fs.access('/tmp', fs.constants.F_OK, function (error) { expect(error).to.exist; @@ -41,8 +43,8 @@ describe('fs.access', function () { }); it('should return no error if file does exist and mode = F_OK', function (done) { - var fs = util.fs(); - var contents = 'This is a file.'; + const fs = util.fs(); + const contents = 'This is a file.'; fs.writeFile('/myfile', contents, function (error) { if (error) throw error; @@ -55,8 +57,8 @@ describe('fs.access', function () { }); it('should return no error if file does exist and mode = R_OK', function (done) { - var fs = util.fs(); - var contents = 'This is a file.'; + const fs = util.fs(); + const contents = 'This is a file.'; fs.writeFile('/myfile', contents, function (error) { if (error) throw error; @@ -69,8 +71,8 @@ describe('fs.access', function () { }); it('should return no error if file does exist and mode = W_OK', function (done) { - var fs = util.fs(); - var contents = 'This is a file.'; + const fs = util.fs(); + const contents = 'This is a file.'; fs.writeFile('/myfile', contents, function (error) { if (error) throw error; @@ -83,8 +85,8 @@ describe('fs.access', function () { }); it('should return an error if file is not executable and mode = X_OK', function (done) { - var fs = util.fs(); - var contents = 'This is a file.'; + const fs = util.fs(); + const contents = 'This is a file.'; fs.writeFile('/myfile', contents, function (error) { if (error) throw error; @@ -102,8 +104,8 @@ describe('fs.access', function () { }); it('should return no error if file does exist and mode = X_OK', function (done) { - var fs = util.fs(); - var contents = 'This is a file.'; + const fs = util.fs(); + const contents = 'This is a file.'; fs.writeFile('/myfile', contents, function (error) { if (error) throw error; @@ -120,8 +122,8 @@ describe('fs.access', function () { }); it('should return no error if file does exist and no mode is passed', function (done) { - var fs = util.fs(); - var contents = 'This is a file.'; + const fs = util.fs(); + const contents = 'This is a file.'; fs.writeFile('/myfile', contents, function (error) { if (error) throw error; @@ -134,8 +136,8 @@ describe('fs.access', function () { }); it('should return no error if file does exist and mode = R_OK | W_OK', function (done) { - var fs = util.fs(); - var contents = 'This is a file.'; + const fs = util.fs(); + const contents = 'This is a file.'; fs.writeFile('/myfile', contents, function (error) { if (error) throw error;