Skip to content

Commit

Permalink
Fixes #661: replaced var with const (#669)
Browse files Browse the repository at this point in the history
* replaced var with const for the most part

* Update fs.symlink.spec.js

fixed line 93 and added strict mode
  • Loading branch information
andrewkoung authored and humphd committed Jan 31, 2019
1 parent 26b47ee commit 4de0bbf
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions tests/spec/fs.symlink.spec.js
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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 => {
Expand All @@ -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 => {
Expand All @@ -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'))
Expand All @@ -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'))
Expand All @@ -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 => {
Expand All @@ -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 => {
Expand Down

0 comments on commit 4de0bbf

Please sign in to comment.