Fix #423: added proimse support for fs.stat (#432)

* added promise support to fs.stat

* restored package lock

* fixed lint issues

* made tests more promise freindly

* removed .catch statement from promise and fixed style issues

* removed .catch statement from promise and fixed style issues
This commit is contained in:
rdittrich97 2018-10-09 12:54:40 -04:00 committed by David Humphrey
parent 1156f420c4
commit 0354c7e13e
1 changed files with 29 additions and 0 deletions

View File

@ -91,4 +91,33 @@ describe('fs.stat', function() {
});
});
});
it('(promise) should be a function', function() {
var fs = util.fs();
expect(fs.promises.stat).to.be.a('function');
});
it('should return a promise', function() {
var fs = util.fs();
expect(fs.promises.stat()).to.be.a('Promise');
});
it('(promise) should return a stat object if file exists', function() {
var fs = util.fs();
return fs.promises
.stat('/')
.then(result => {
expect(result).to.exist;
expect(result.node).to.be.a('string');
expect(result.dev).to.equal(fs.name);
expect(result.size).to.be.a('number');
expect(result.nlinks).to.be.a('number');
expect(result.atime).to.be.a('number');
expect(result.mtime).to.be.a('number');
expect(result.ctime).to.be.a('number');
expect(result.type).to.equal('DIRECTORY');
});
});
});