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:
bblarney 2018-10-16 11:07:10 -04:00 committed by David Humphrey
parent a447b2dd45
commit 707d404db0
1 changed files with 21 additions and 0 deletions

View File

@ -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) {
var fs = util.fs();