Fixes #661: replaced var with const (#669)

* replaced var with const for the most part

* Update fs.symlink.spec.js

fixed line 93 and added strict mode
This commit is contained in:
andrewkoung 2019-01-31 13:52:39 -05:00 committed by David Humphrey
parent 26b47ee094
commit 4de0bbfafd
1 changed files with 14 additions and 12 deletions

View File

@ -1,17 +1,19 @@
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.symlink', function () {
beforeEach(util.setup);
afterEach(util.cleanup);
it('should be a function', function () {
var fs = util.fs();
const fs = util.fs();
expect(fs.symlink).to.be.a('function');
});
it('should return an error if part of the parent destination path does not exist', function (done) {
var fs = util.fs();
const fs = util.fs();
fs.symlink('/', '/tmp/mydir', function (error) {
expect(error).to.exist;
@ -21,7 +23,7 @@ describe('fs.symlink', function () {
});
it('should return an error if the destination path already exists', function (done) {
var fs = util.fs();
const fs = util.fs();
fs.symlink('/tmp', '/', function (error) {
expect(error).to.exist;
@ -31,7 +33,7 @@ describe('fs.symlink', function () {
});
it('should create a symlink', function (done) {
var fs = util.fs();
const fs = util.fs();
fs.symlink('/', '/myfile', function (error) {
expect(error).not.to.exist;
@ -47,7 +49,7 @@ describe('fs.symlink', function () {
/** Tests for fsPromises API */
describe('fsPromises.symlink', function () {
it('should return an error if destination path does not exist', function () {
var fsPromises = util.fs().promises;
const fsPromises = util.fs().promises;
return fsPromises.symlink('/', '/tmp/link')
.catch(error => {
@ -57,7 +59,7 @@ describe('fs.symlink', function () {
});
it('should return an error if source path does not exist', function () {
var fsPromises = util.fs().promises;
const fsPromises = util.fs().promises;
return fsPromises.symlink('/tmp/myLink', '/myLink')
.catch(error => {
@ -67,7 +69,7 @@ describe('fs.symlink', function () {
});
it('Promise should create a symlink of type DIRECTORY when directory provided', function () {
var fsPromises = util.fs().promises;
const fsPromises = util.fs().promises;
return fsPromises.symlink('/', '/myDirLink')
.then(() => fsPromises.stat('/myDirLink'))
@ -78,7 +80,7 @@ describe('fs.symlink', function () {
});
it('Promise should create a symlink of type FILE when file provided', function () {
var fsPromises = util.fs().promises;
const fsPromises = util.fs().promises;
return fsPromises.writeFile('/myFile', 'data')
.then(() => fsPromises.symlink('/myFile', '/myFileLink'))
@ -90,7 +92,7 @@ describe('fs.symlink', function () {
});
it('Promise should return an error if the destination path already exists', function () {
var fsPromises = util.fs().promises;
const fsPromises = util.fs().promises;
return fsPromises.symlink('/tmp', '/')
.catch(error => {
@ -108,7 +110,7 @@ describe('fsPromises.symlink', function () {
it('should return an error if part of the parent destination path does not exist', () => {
var fsPromises = util.fs().promises;
const fsPromises = util.fs().promises;
return fsPromises.symlink('/', '/tmp/mydir')
.catch(error => {