Added promise-based test cases for rmdir

This commit is contained in:
imedqq 2018-09-24 23:24:26 -04:00 committed by David Humphrey
parent acef2c93b0
commit 2aa6cf2b5f
1 changed files with 23 additions and 0 deletions

View File

@ -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');
});
});
});