From db237e617bd30c1150e2e4512ea301d69f05d663 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 28 Sep 2018 20:44:50 -0400 Subject: [PATCH] update fs.symlink.spec.js based on code review white spaces , comments added, Promises.Open used --- tests/spec/fs.symlink.spec.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/spec/fs.symlink.spec.js b/tests/spec/fs.symlink.spec.js index 093165f..1ce5ce0 100644 --- a/tests/spec/fs.symlink.spec.js +++ b/tests/spec/fs.symlink.spec.js @@ -43,6 +43,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; @@ -51,7 +52,7 @@ describe('fs.symlink', function() { expect(error).to.exist; expect(error.code).to.equal('ENOENT'); }); - }); + it('should return an error if source path does not exist', function () { var fsPromises = util.fs().promises; 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 () { var fsPromises = util.fs().promises; - var fs = util.fs(); - fs.open('/myFile', 'w+', function (error) { - if (error) throw error; + fsPromises.open('/myFile', 'w+').catch((error) => { expect(error).not.to.exist; }); 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 () { var fsPromises = util.fs().promises;