From 487ed8c47b46acedb9d5e3f6b4110eaf189567e4 Mon Sep 17 00:00:00 2001 From: michael-overall Date: Fri, 28 Sep 2018 09:13:32 -0400 Subject: [PATCH] fix issue 392- corrected promise scheduling with chaining --- tests/spec/fs.rename.spec.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/spec/fs.rename.spec.js b/tests/spec/fs.rename.spec.js index 2f833f8..9fd5eb9 100644 --- a/tests/spec/fs.rename.spec.js +++ b/tests/spec/fs.rename.spec.js @@ -163,11 +163,11 @@ describe('fs.rename', function() { } } - Promise.all( - fs.promises.open('/myfile', 'w+') - .then((fd)=>fs.promises.close(fd)), - fs.promises.rename('/myfile', '/myotherfile'), - fs.promises.stat('/myfile') + + fs.promises.open('/myfile', 'w+') + .then((fd)=>fs.promises.close(fd)) + .then(fs.promises.rename('/myfile', '/myotherfile')) + .then(Promise.all(fs.promises.stat('/myfile') .then( (result)=> expect(result).not.to.exist, (error) => expect(error).to.exist) .finally(()=>{ complete1 = true; @@ -178,7 +178,8 @@ describe('fs.rename', function() { .finally(()=>{ complete2 = true; maybeDone(); - }) - ).catch((error)=> {throw error;}); + }))) + + .catch((error)=> {throw error;}); }); });