Skip to content

Commit

Permalink
fixes issue #667 (#678)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jadach1 authored and humphd committed Feb 2, 2019
1 parent 05057c4 commit da1aad5
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions 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;
Expand All @@ -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;
Expand Down

0 comments on commit da1aad5

Please sign in to comment.