update fs.symlink.spec.js based on code review

white spaces , comments added, Promises.Open used
This commit is contained in:
Adam 2018-09-28 20:44:50 -04:00 committed by David Humphrey
parent bb9dd2e67c
commit db237e617b
1 changed files with 5 additions and 4 deletions

View File

@ -43,6 +43,7 @@ describe('fs.symlink', function() {
}); });
}); });
}); });
/** 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;
@ -51,7 +52,7 @@ describe('fs.symlink', function() {
expect(error).to.exist; expect(error).to.exist;
expect(error.code).to.equal('ENOENT'); expect(error.code).to.equal('ENOENT');
}); });
});
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')
@ -77,11 +78,10 @@ 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; var fsPromises = util.fs().promises;
var fs = util.fs(); fsPromises.open('/myFile', 'w+').catch((error) => {
fs.open('/myFile', 'w+', function (error) {
if (error) throw error;
expect(error).not.to.exist; expect(error).not.to.exist;
}); });
return fsPromises.symlink('/myFile', '/myFileLink') return fsPromises.symlink('/myFile', '/myFileLink')
@ -97,6 +97,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; var fsPromises = util.fs().promises;