Issue 427 - Add tests to fsPromises.rmdir when directory doesn't exist and when trying to delete root directory (#457)
* Fix #427 - Fixed indentation and ENOENT -> EBUSY on line 120 * Deleted extra line at the end of document * Fix #427 - Added tests for fsPromises.rmdir when trying to remove a nonexistent directory and when trying to remove root directory
This commit is contained in:
parent
87230ce1e3
commit
e77361107e
|
@ -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');
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue