Renamed test suite, started rewriting for mocha.

This commit is contained in:
kwkofler 2014-03-07 13:06:11 -05:00
parent 0ce4d192fa
commit 0fb099d6c8
4 changed files with 66 additions and 123 deletions

30
dist/filer.js vendored
View File

@ -25,7 +25,6 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
} }
}( this, function() { }( this, function() {
/** /**
* almond 0.2.5 Copyright (c) 2011-2012, The Dojo Foundation All Rights Reserved. * almond 0.2.5 Copyright (c) 2011-2012, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license. * Available via the MIT or new BSD license.
@ -5469,6 +5468,34 @@ define('src/fs',['require','nodash','encoding','src/path','src/path','src/path',
this.type = fileNode.mode; this.type = fileNode.mode;
} }
Stats.prototype.isFile = function() {
return this.type === constants.MODE_FILE;
};
Stats.prototype.isDirectory = function() {
return this.type === constants.MODE_DIRECTORY;
};
Stats.prototype.isBlockDevice = function() {
return false;
};
Stats.prototype.isCharacterDevice = function() {
return false;
};
Stats.prototype.isSymbolicLink = function() {
return this.type === constants.MODE_SYMBOLIC_LINK;
};
Stats.prototype.isFIFO = function() {
return false;
};
Stats.prototype.isSocket = function() {
return false;
};
/* /*
* find_node * find_node
*/ */
@ -7859,6 +7886,7 @@ define('src/index',['require','src/fs','src/fs','src/path'],function(require) {
}); });
var Filer = require( "src/index" ); var Filer = require( "src/index" );
return Filer; return Filer;

5
dist/filer.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,64 +1,33 @@
define(["Filer"], function(Filer) { define(["Filer", "util"], function(Filer, util) {
describe('fs.Stats', function() { describe('fs.stats', function() {
describe('#isFile()', function() { describe('#isFile()', function() {
beforeEach(function() { beforeEach(util.setup);
this.db_name = mk_db_name(); afterEach(util.cleanup);
this.fs = new Filer.FileSystem({
name: this.db_name,
flags: 'FORMAT'
});
});
afterEach(function() {
indexedDB.deleteDatabase(this.db_name);
delete this.fs;
});
it('should be a function', function() { it('should be a function', function() {
var testStat = this.fs.stat('/', function(error) { var fs = util.fs();
if(error) throw error; expect(fs.stat.isFile).to.be.a('function');
});
expect(typeof this.testStat.isFile).toEqual('function');
}); });
it('should return true if stats are for file', function() { it('should return true if stats are for file', function(done) {
var complete = false; var fs = util.fs();
var _error, _result;
var that = this;
var contents = "This is a file."; var contents = "This is a file.";
that.fs.writeFile('/myFile', contents, binary, function(error) { fs.writeFile('/myFile', contents, function(error) {
if(error) throw error; if(error) throw error;
_result = that.fs.stat('/myFile', function() {}).isFile(); fs.stat('/myFile').isFile(function (error, data) {
complete = true; expect(error).not.to.exist;
}) expect(data).toEqual(true);
done()
waitsFor(function() { });
return complete;
}, 'test to complete', DEFAULT_TIMEOUT);
runs(function() {
expect(_error).toEqual(null);
expect(_result).toEqual(true);
}); });
}); });
}) });
describe('#isDirectory()', function() { /* describe('#isDirectory()', function() {
beforeEach(function() { beforeEach(util.setup);
this.db_name = mk_db_name(); afterEach(util.cleanup);
this.fs = new Filer.FileSystem({
name: this.db_name,
flags: 'FORMAT'
});
});
afterEach(function() {
indexedDB.deleteDatabase(this.db_name);
delete this.fs;
});
it('should be a function', function() { it('should be a function', function() {
var testStat = this.fs.stat('/', function(error) { var testStat = this.fs.stat('/', function(error) {
@ -86,21 +55,11 @@ define(["Filer"], function(Filer) {
expect(_result).toEqual(true); expect(_result).toEqual(true);
}); });
}); });
}) });
describe('#isBlockDevice()', function() { describe('#isBlockDevice()', function() {
beforeEach(function() { beforeEach(util.setup);
this.db_name = mk_db_name(); afterEach(util.cleanup);
this.fs = new Filer.FileSystem({
name: this.db_name,
flags: 'FORMAT'
});
});
afterEach(function() {
indexedDB.deleteDatabase(this.db_name);
delete this.fs;
});
it('should be a function', function() { it('should be a function', function() {
var testStat = this.fs.stat('/', function(error) { var testStat = this.fs.stat('/', function(error) {
@ -128,21 +87,11 @@ define(["Filer"], function(Filer) {
expect(_result).toEqual(false); expect(_result).toEqual(false);
}); });
}); });
}) });
describe('#isCharacterDevice()', function() { describe('#isCharacterDevice()', function() {
beforeEach(function() { beforeEach(util.setup);
this.db_name = mk_db_name(); afterEach(util.cleanup);
this.fs = new Filer.FileSystem({
name: this.db_name,
flags: 'FORMAT'
});
});
afterEach(function() {
indexedDB.deleteDatabase(this.db_name);
delete this.fs;
});
it('should be a function', function() { it('should be a function', function() {
var testStat = this.fs.stat('/', function(error) { var testStat = this.fs.stat('/', function(error) {
@ -170,21 +119,11 @@ define(["Filer"], function(Filer) {
expect(_result).toEqual(false); expect(_result).toEqual(false);
}); });
}); });
}) });
describe('#isSymbolicLink()', function() { describe('#isSymbolicLink()', function() {
beforeEach(function() { beforeEach(util.setup);
this.db_name = mk_db_name(); afterEach(util.cleanup);
this.fs = new Filer.FileSystem({
name: this.db_name,
flags: 'FORMAT'
});
});
afterEach(function() {
indexedDB.deleteDatabase(this.db_name);
delete this.fs;
});
it('should be a function', function() { it('should be a function', function() {
var testStat = this.fs.stat('/', function(error) { var testStat = this.fs.stat('/', function(error) {
@ -218,21 +157,11 @@ define(["Filer"], function(Filer) {
expect(_result).toEqual(true); expect(_result).toEqual(true);
}); });
}); });
}) });
describe('#isFIFO()', function() { describe('#isFIFO()', function() {
beforeEach(function() { beforeEach(util.setup);
this.db_name = mk_db_name(); afterEach(util.cleanup);
this.fs = new Filer.FileSystem({
name: this.db_name,
flags: 'FORMAT'
});
});
afterEach(function() {
indexedDB.deleteDatabase(this.db_name);
delete this.fs;
});
it('should be a function', function() { it('should be a function', function() {
var testStat = this.fs.stat('/', function(error) { var testStat = this.fs.stat('/', function(error) {
@ -260,21 +189,11 @@ define(["Filer"], function(Filer) {
expect(_result).toEqual(false); expect(_result).toEqual(false);
}); });
}); });
}) });
describe('#isSocket()', function() { describe('#isSocket()', function() {
beforeEach(function() { beforeEach(util.setup);
this.db_name = mk_db_name(); afterEach(util.cleanup);
this.fs = new Filer.FileSystem({
name: this.db_name,
flags: 'FORMAT'
});
});
afterEach(function() {
indexedDB.deleteDatabase(this.db_name);
delete this.fs;
});
it('should be a function', function() { it('should be a function', function() {
var testStat = this.fs.stat('/', function(error) { var testStat = this.fs.stat('/', function(error) {
@ -302,5 +221,6 @@ define(["Filer"], function(Filer) {
expect(_result).toEqual(false); expect(_result).toEqual(false);
}); });
}); });
}) });*/
} });
)

View File

@ -31,7 +31,7 @@ define([
"spec/fs.truncate.spec", "spec/fs.truncate.spec",
"spec/fs.utimes.spec", "spec/fs.utimes.spec",
"spec/fs.xattr.spec", "spec/fs.xattr.spec",
"spec/fs.stats.spec". "spec/fs.stats.spec",
"spec/path-resolution.spec", "spec/path-resolution.spec",
// Filer.FileSystem.providers.* // Filer.FileSystem.providers.*