* 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
This commit is contained in:
parent
05057c45d2
commit
da1aad5667
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue