Skip to content

Commit

Permalink
Fixed #665: Replaced var with let or const and added strict mode fs.a… (
Browse files Browse the repository at this point in the history
#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
  • Loading branch information
ithompson4 authored and humphd committed Jan 31, 2019
1 parent 43bba42 commit 3f619fd
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions tests/spec/fs.access.spec.js
Original file line number Diff line number Diff line change
@@ -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);
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 3f619fd

Please sign in to comment.