From 4a39dcc2f01d04da22be41eacc2780912274b50c Mon Sep 17 00:00:00 2001 From: Nathaniel Ngo Date: Thu, 31 Jan 2019 14:00:48 -0500 Subject: [PATCH] =?UTF-8?q?Fixes=20Issue#674:=20Refactored=20var=20declara?= =?UTF-8?q?tions=20to=20const=20or=20let=20declarations=20to=20address=20i?= =?UTF-8?q?=E2=80=A6=20(#676)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Refactored var declarations to const or let declarations to address issue#674 * refactored let to const when variable does not change values --- tests/spec/fs.chmod.spec.js | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/tests/spec/fs.chmod.spec.js b/tests/spec/fs.chmod.spec.js index 5d1d0db..0dfcb2b 100644 --- a/tests/spec/fs.chmod.spec.js +++ b/tests/spec/fs.chmod.spec.js @@ -1,18 +1,20 @@ -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.chmod, fs.fchmod', function() { beforeEach(util.setup); afterEach(util.cleanup); it('should be functions', function() { - var fs = util.fs(); + const fs = util.fs(); expect(typeof fs.chmod).to.equal('function'); expect(typeof fs.fchmod).to.equal('function'); }); it('should automatically set mode=755 for a directory', function(done) { - var fs = util.fs(); + const fs = util.fs(); fs.mkdir('/dir', function(err) { if(err) throw err; @@ -26,7 +28,7 @@ describe('fs.chmod, fs.fchmod', function() { }); it('should automatically set mode=644 for a file', function(done) { - var fs = util.fs(); + const fs = util.fs(); fs.open('/file', 'w', function(err, fd) { if(err) throw err; @@ -40,7 +42,7 @@ describe('fs.chmod, fs.fchmod', function() { }); it('should be an error when the path is invalid', function(done){ - var fs = util.fs(); + const fs = util.fs(); fs.chmod('/invalid_path', 0o444, function(err){ expect(err).to.exist; expect(err.code).to.equal('ENOENT'); @@ -49,7 +51,7 @@ describe('fs.chmod, fs.fchmod', function() { }); it('should error if mode value is a non-numeric string', function(done) { - var fs = util.fs(); + const fs = util.fs(); fs.mkdir('/dir', function(err) { if(err) throw err; @@ -63,7 +65,7 @@ describe('fs.chmod, fs.fchmod', function() { }); it('should error if mode value is null', function(done) { - var fs = util.fs(); + const fs = util.fs(); fs.mkdir('/dir', function(err) { if(err) throw err; @@ -77,7 +79,7 @@ describe('fs.chmod, fs.fchmod', function() { }); it('should error if mode value is non-integer number', function(done) { - var fs = util.fs(); + const fs = util.fs(); fs.mkdir('/dir', function(err) { if(err) throw err; @@ -91,7 +93,7 @@ describe('fs.chmod, fs.fchmod', function() { }); it('should error if mode value is non-integer number', function(done) { - var fs = util.fs(); + const fs = util.fs(); fs.mkdir('/dir', function(err) { if(err) throw err; @@ -105,7 +107,7 @@ describe('fs.chmod, fs.fchmod', function() { }); it('should allow octal strings for mode value', function(done) { - var fs = util.fs(); + const fs = util.fs(); fs.mkdir('/dir', function(err) { if(err) throw err; @@ -124,7 +126,7 @@ describe('fs.chmod, fs.fchmod', function() { }); it('should allow for updating mode of a given file', function(done) { - var fs = util.fs(); + const fs = util.fs(); fs.open('/file', 'w', function(err, fd) { if(err) throw err; @@ -161,12 +163,12 @@ describe('fsPromise.chmod', function() { afterEach(util.setup); it('should be a function', function() { - var fsPromise = util.fs().promises; + const fsPromise = util.fs().promises; expect(typeof fsPromise.chmod).to.equal('function'); }); it('should allow for updating mode of a given file', function() { - var fsPromise = util.fs().promises; + const fsPromise = util.fs().promises; return fsPromise.open('/file', 'w') .then(() => fsPromise.chmod('/file', 0o444))