* 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:
parent
26b47ee094
commit
4de0bbfafd
|
@ -1,17 +1,19 @@
|
||||||
var util = require('../lib/test-utils.js');
|
'use strict';
|
||||||
var expect = require('chai').expect;
|
|
||||||
|
const util = require('../lib/test-utils.js');
|
||||||
|
const expect = require('chai').expect;
|
||||||
|
|
||||||
describe('fs.symlink', function () {
|
describe('fs.symlink', function () {
|
||||||
beforeEach(util.setup);
|
beforeEach(util.setup);
|
||||||
afterEach(util.cleanup);
|
afterEach(util.cleanup);
|
||||||
|
|
||||||
it('should be a function', function () {
|
it('should be a function', function () {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
expect(fs.symlink).to.be.a('function');
|
expect(fs.symlink).to.be.a('function');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return an error if part of the parent destination path does not exist', function (done) {
|
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) {
|
fs.symlink('/', '/tmp/mydir', function (error) {
|
||||||
expect(error).to.exist;
|
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) {
|
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) {
|
fs.symlink('/tmp', '/', function (error) {
|
||||||
expect(error).to.exist;
|
expect(error).to.exist;
|
||||||
|
@ -31,7 +33,7 @@ describe('fs.symlink', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create a symlink', function (done) {
|
it('should create a symlink', function (done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
|
|
||||||
fs.symlink('/', '/myfile', function (error) {
|
fs.symlink('/', '/myfile', function (error) {
|
||||||
expect(error).not.to.exist;
|
expect(error).not.to.exist;
|
||||||
|
@ -47,7 +49,7 @@ describe('fs.symlink', function () {
|
||||||
/** Tests for fsPromises API */
|
/** Tests for fsPromises API */
|
||||||
describe('fsPromises.symlink', function () {
|
describe('fsPromises.symlink', function () {
|
||||||
it('should return an error if destination path does not exist', 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')
|
return fsPromises.symlink('/', '/tmp/link')
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
@ -57,7 +59,7 @@ describe('fs.symlink', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return an error if source path does not exist', 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')
|
return fsPromises.symlink('/tmp/myLink', '/myLink')
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
@ -67,7 +69,7 @@ describe('fs.symlink', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Promise should create a symlink of type DIRECTORY when directory provided', 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')
|
return fsPromises.symlink('/', '/myDirLink')
|
||||||
.then(() => fsPromises.stat('/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 () {
|
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')
|
return fsPromises.writeFile('/myFile', 'data')
|
||||||
.then(() => fsPromises.symlink('/myFile', '/myFileLink'))
|
.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 () {
|
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', '/')
|
return fsPromises.symlink('/tmp', '/')
|
||||||
.catch(error => {
|
.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', () => {
|
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')
|
return fsPromises.symlink('/', '/tmp/mydir')
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
|
Loading…
Reference in New Issue