Updated tests.

This commit is contained in:
Alan Kligman 2013-07-12 12:07:57 -04:00
parent c3c9751ff4
commit 3d00c85a27
1 changed files with 32 additions and 2 deletions

View File

@ -85,7 +85,7 @@ describe('stat', function() {
delete this.fs; delete this.fs;
}); });
describe('on path that does not exist', function() { describe('on non-existing path', function() {
it('should return an error', function() { it('should return an error', function() {
var complete = false; var complete = false;
var _error, _result; var _error, _result;
@ -111,7 +111,6 @@ describe('stat', function() {
var _error, _result; var _error, _result;
this.fs.stat('/tmp', function(error, result) { this.fs.stat('/tmp', function(error, result) {
jasmine.log(error, result);
_error = error; _error = error;
_result = result; _result = result;
@ -127,4 +126,35 @@ describe('stat', function() {
}); });
}); });
}); });
describe('on existing path', function() {
it('should return a stat object', function() {
var complete = false;
var _error, _result;
var that = this;
this.fs.mkdir('/tmp', function(error) {
if(error) throw error;
that.fs.stat('/tmp', function(error, result) {
_error = error;
_result = result;
complete = true;
});
});
waitsFor(function() {
return complete;
}, 'stat to complete', DEFAULT_TIMEOUT);
runs(function() {
expect(_result).toBeDefined();
expect(_result['dev']).toEqual(that.db_name);
expect(_result['nlinks']).toEqual(jasmine.any(Number));
expect(_result['atime']).toEqual(jasmine.any(Number));
expect(_result['mtime']).toEqual(jasmine.any(Number));
expect(_result['ctime']).toEqual(jasmine.any(Number));
});
});
});
}); });