Issue 417 - Added test for fs.promises.rename to rename existing directory (#460)
* test added * working so far * done * cleaned up a catch * made some requested changes
This commit is contained in:
parent
a447b2dd45
commit
707d404db0
|
@ -87,6 +87,27 @@ describe('fs.rename', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should rename an existing directory (using promises)', () => {
|
||||||
|
var fsPromises = util.fs().promises;
|
||||||
|
|
||||||
|
return fsPromises.mkdir('/mydir')
|
||||||
|
.then(() => fsPromises.rename('/mydir', '/myotherdir'))
|
||||||
|
.then(() => { fsPromises.stat('/mydir')
|
||||||
|
.catch((error) => {
|
||||||
|
expect(error).to.exist;
|
||||||
|
expect(error.code).to.equal('ENOENT');
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.then(() => { fsPromises.stat('/myotherdir')
|
||||||
|
.then(result => {
|
||||||
|
expect(result.nlinks).to.equal(1);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
if (error) throw error;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should rename an existing directory if the new path points to an existing directory', function(done) {
|
it('should rename an existing directory if the new path points to an existing directory', function(done) {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue