Fixed #665: Replaced var with let or const and added strict mode fs.a… (#688)

* 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
This commit is contained in:
Iryna Thompson 2019-01-31 16:08:19 -05:00 committed by David Humphrey
parent 43bba422d9
commit 3f619fdcb8
1 changed files with 21 additions and 19 deletions

View File

@ -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;