From 2aa6cf2b5fd289d62be1fd82d41abbe7af6d1a6c Mon Sep 17 00:00:00 2001 From: imedqq Date: Mon, 24 Sep 2018 23:24:26 -0400 Subject: [PATCH] Added promise-based test cases for rmdir --- tests/spec/fs.rmdir.spec.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/spec/fs.rmdir.spec.js b/tests/spec/fs.rmdir.spec.js index de04079..0d89629 100644 --- a/tests/spec/fs.rmdir.spec.js +++ b/tests/spec/fs.rmdir.spec.js @@ -152,3 +152,26 @@ describe('fs.promises.rmdir', function(){ }); }); }); +describe('fsPromises.rmdir', function() { + beforeEach(util.setup); + afterEach(util.cleanup); + + it('should return an error if the path does not exist', function() { + var fs = util.fs().promises; + + return fs.rmdir('/tmp/mydir') + .catch(error => { + expect(error).to.exist; + expect(error.code).to.equal('ENOENT'); + }); + }); + it('should return an error if attempting to remove the root directory', function(){ + var fs = util.fs().promises; + + return fs.rmdir('/') + .catch(error => { + expect(error).to.exist; + expect(error.code).to.equal('EBUSY'); + }); + }); +}); \ No newline at end of file