diff --git a/tests/spec/fs.rmdir.spec.js b/tests/spec/fs.rmdir.spec.js index 328c972..6e183be 100644 --- a/tests/spec/fs.rmdir.spec.js +++ b/tests/spec/fs.rmdir.spec.js @@ -97,4 +97,27 @@ describe('fs.rmdir', function() { }); }); }); + + it('(promise) should be a function', function() { + var fsPromises = util.fs().promises; + expect(fsPromises.rmdir).to.be.a('function'); + }); + + it('(promise) should return an error if the path does not exist', function() { + var fsPromises = util.fs().promises; + return fsPromises.rmdir('/tmp/mydir') + .catch(error => { + expect(error).to.exist; + expect(error.code).to.equal('ENOENT'); + }); + }); + + it('(promise) should return an error if attempting to remove the root directory', function() { + var fsPromises = util.fs().promises; + return fsPromises.rmdir('/') + .catch(error => { + expect(error).to.exist; + expect(error.code).to.equal('EBUSY'); + }); + }); });