Fix review issues
This commit is contained in:
parent
7e941bb304
commit
33339b81d7
|
@ -43,10 +43,12 @@ 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;
|
var fsPromises = util.fs().promises;
|
||||||
|
|
||||||
return fsPromises.symlink('/', '/tmp/link')
|
return fsPromises.symlink('/', '/tmp/link')
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
expect(error).to.exist;
|
expect(error).to.exist;
|
||||||
|
@ -56,6 +58,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;
|
var fsPromises = util.fs().promises;
|
||||||
|
|
||||||
return fsPromises.symlink('/tmp/myLink', '/myLink')
|
return fsPromises.symlink('/tmp/myLink', '/myLink')
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
expect(error).to.exist;
|
expect(error).to.exist;
|
||||||
|
@ -65,36 +68,24 @@ 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;
|
var fsPromises = util.fs().promises;
|
||||||
|
|
||||||
return fsPromises.symlink('/', '/myDirLink')
|
return fsPromises.symlink('/', '/myDirLink')
|
||||||
.then(() => {
|
.then(() => fsPromises.stat('/myDirLink'))
|
||||||
return fsPromises.stat('/myDirLink')
|
|
||||||
.then(stats => {
|
.then(stats => {
|
||||||
expect(stats).to.exist;
|
expect(stats).to.exist;
|
||||||
expect(stats.type).to.equal('DIRECTORY');
|
expect(stats.type).to.equal('DIRECTORY');
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
expect(error).not.to.exist;
|
|
||||||
expect(error.code).to.equal('ENOENT');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
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;
|
var fsPromises = util.fs().promises;
|
||||||
fsPromises.open('/myFile', 'w+').catch((error) => {
|
|
||||||
expect(error).not.to.exist;
|
return fsPromises.writeFile('/myFile', 'data')
|
||||||
});
|
.then(() => fsPromises.symlink('/myFile', '/myFileLink'))
|
||||||
return fsPromises.symlink('/myFile', '/myFileLink')
|
.then(() => fsPromises.stat('/myFileLink'))
|
||||||
.then(() => {
|
|
||||||
return fsPromises.stat('/myFileLink')
|
|
||||||
.then(stats => {
|
.then(stats => {
|
||||||
expect(stats).to.exist;
|
expect(stats).to.exist;
|
||||||
expect(stats.type).to.equal('FILE');
|
expect(stats.type).to.equal('FILE');
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
expect(error).not.to.exist;
|
|
||||||
expect(error.code).to.equal('ENOENT');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -107,7 +98,6 @@ describe('fs.symlink', function () {
|
||||||
expect(error.code).to.equal('EEXIST');
|
expect(error.code).to.equal('EEXIST');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue