Added promise-based test cases for rmdir
This commit is contained in:
parent
acef2c93b0
commit
2aa6cf2b5f
|
@ -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');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue