From da1aad56672ee7b2cfe21430e8dc23e7ebbd6c6f Mon Sep 17 00:00:00 2001 From: Jacob Adach Date: Fri, 1 Feb 2019 20:53:12 -0500 Subject: [PATCH] fixes issue #667 (#678) * fixes issue 667: Update code in tests/some/fs.write.spec.js to use const/let AND strict mode * fixes issue 667: Update code in tests/some/fs.write.spec.js to use const/let AND strict mode * changed let to const for variables pointing to required function * switched a few variable lets to const in file fs.write.spec.js * switched a few variable lets to const in file fs.write.spec.js * added package-lock.json file * changed variables let to const --- tests/spec/fs.write.spec.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/tests/spec/fs.write.spec.js b/tests/spec/fs.write.spec.js index ec5da7b..31f3025 100644 --- a/tests/spec/fs.write.spec.js +++ b/tests/spec/fs.write.spec.js @@ -1,24 +1,25 @@ -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.write', function() { beforeEach(util.setup); afterEach(util.cleanup); it('should be a function', function() { - var fs = util.fs(); + const fs = util.fs(); expect(fs.write).to.be.a('function'); }); it('should error if file path is undefined', function() { - var fs = util.fs(); - var fn = () => fs.writeFile(undefined, 'data'); + const fs = util.fs(); + const fn = () => fs.writeFile(undefined, 'data'); expect(fn).to.throw(); }); it('should write data to a file', function(done) { - var fs = util.fs(); - var buffer = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]); + const fs = util.fs(); + const buffer = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]); fs.open('/myfile', 'w', function(error, fd) { if(error) throw error; @@ -38,9 +39,9 @@ describe('fs.write', function() { }); it('should update the current file position', function(done) { - var fs = util.fs(); - var buffer = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]); - var _result = 0; + const fs = util.fs(); + const buffer = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]); + let _result = 0; fs.open('/myfile', 'w', function(error, fd) { if(error) throw error;