Renamed test suite, started rewriting for mocha.
This commit is contained in:
parent
0ce4d192fa
commit
0fb099d6c8
|
@ -25,7 +25,6 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|||
}
|
||||
|
||||
}( this, function() {
|
||||
|
||||
/**
|
||||
* almond 0.2.5 Copyright (c) 2011-2012, The Dojo Foundation All Rights Reserved.
|
||||
* 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;
|
||||
}
|
||||
|
||||
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
|
||||
*/
|
||||
|
@ -7859,6 +7886,7 @@ define('src/index',['require','src/fs','src/fs','src/path'],function(require) {
|
|||
|
||||
});
|
||||
|
||||
|
||||
var Filer = require( "src/index" );
|
||||
|
||||
return Filer;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -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() {
|
||||
beforeEach(function() {
|
||||
this.db_name = mk_db_name();
|
||||
this.fs = new Filer.FileSystem({
|
||||
name: this.db_name,
|
||||
flags: 'FORMAT'
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
indexedDB.deleteDatabase(this.db_name);
|
||||
delete this.fs;
|
||||
});
|
||||
beforeEach(util.setup);
|
||||
afterEach(util.cleanup);
|
||||
|
||||
it('should be a function', function() {
|
||||
var testStat = this.fs.stat('/', function(error) {
|
||||
if(error) throw error;
|
||||
});
|
||||
expect(typeof this.testStat.isFile).toEqual('function');
|
||||
var fs = util.fs();
|
||||
expect(fs.stat.isFile).to.be.a('function');
|
||||
});
|
||||
|
||||
it('should return true if stats are for file', function() {
|
||||
var complete = false;
|
||||
var _error, _result;
|
||||
var that = this;
|
||||
|
||||
it('should return true if stats are for file', function(done) {
|
||||
var fs = util.fs();
|
||||
var contents = "This is a file.";
|
||||
|
||||
that.fs.writeFile('/myFile', contents, binary, function(error) {
|
||||
fs.writeFile('/myFile', contents, function(error) {
|
||||
if(error) throw error;
|
||||
_result = that.fs.stat('/myFile', function() {}).isFile();
|
||||
complete = true;
|
||||
})
|
||||
|
||||
waitsFor(function() {
|
||||
return complete;
|
||||
}, 'test to complete', DEFAULT_TIMEOUT);
|
||||
|
||||
runs(function() {
|
||||
expect(_error).toEqual(null);
|
||||
expect(_result).toEqual(true);
|
||||
fs.stat('/myFile').isFile(function (error, data) {
|
||||
expect(error).not.to.exist;
|
||||
expect(data).toEqual(true);
|
||||
done()
|
||||
});
|
||||
});
|
||||
})
|
||||
|
||||
describe('#isDirectory()', function() {
|
||||
beforeEach(function() {
|
||||
this.db_name = mk_db_name();
|
||||
this.fs = new Filer.FileSystem({
|
||||
name: this.db_name,
|
||||
flags: 'FORMAT'
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
indexedDB.deleteDatabase(this.db_name);
|
||||
delete this.fs;
|
||||
});
|
||||
/* describe('#isDirectory()', function() {
|
||||
beforeEach(util.setup);
|
||||
afterEach(util.cleanup);
|
||||
|
||||
it('should be a function', function() {
|
||||
var testStat = this.fs.stat('/', function(error) {
|
||||
|
@ -86,21 +55,11 @@ define(["Filer"], function(Filer) {
|
|||
expect(_result).toEqual(true);
|
||||
});
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
describe('#isBlockDevice()', function() {
|
||||
beforeEach(function() {
|
||||
this.db_name = mk_db_name();
|
||||
this.fs = new Filer.FileSystem({
|
||||
name: this.db_name,
|
||||
flags: 'FORMAT'
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
indexedDB.deleteDatabase(this.db_name);
|
||||
delete this.fs;
|
||||
});
|
||||
beforeEach(util.setup);
|
||||
afterEach(util.cleanup);
|
||||
|
||||
it('should be a function', function() {
|
||||
var testStat = this.fs.stat('/', function(error) {
|
||||
|
@ -128,21 +87,11 @@ define(["Filer"], function(Filer) {
|
|||
expect(_result).toEqual(false);
|
||||
});
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
describe('#isCharacterDevice()', function() {
|
||||
beforeEach(function() {
|
||||
this.db_name = mk_db_name();
|
||||
this.fs = new Filer.FileSystem({
|
||||
name: this.db_name,
|
||||
flags: 'FORMAT'
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
indexedDB.deleteDatabase(this.db_name);
|
||||
delete this.fs;
|
||||
});
|
||||
beforeEach(util.setup);
|
||||
afterEach(util.cleanup);
|
||||
|
||||
it('should be a function', function() {
|
||||
var testStat = this.fs.stat('/', function(error) {
|
||||
|
@ -170,21 +119,11 @@ define(["Filer"], function(Filer) {
|
|||
expect(_result).toEqual(false);
|
||||
});
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
describe('#isSymbolicLink()', function() {
|
||||
beforeEach(function() {
|
||||
this.db_name = mk_db_name();
|
||||
this.fs = new Filer.FileSystem({
|
||||
name: this.db_name,
|
||||
flags: 'FORMAT'
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
indexedDB.deleteDatabase(this.db_name);
|
||||
delete this.fs;
|
||||
});
|
||||
beforeEach(util.setup);
|
||||
afterEach(util.cleanup);
|
||||
|
||||
it('should be a function', function() {
|
||||
var testStat = this.fs.stat('/', function(error) {
|
||||
|
@ -218,21 +157,11 @@ define(["Filer"], function(Filer) {
|
|||
expect(_result).toEqual(true);
|
||||
});
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
describe('#isFIFO()', function() {
|
||||
beforeEach(function() {
|
||||
this.db_name = mk_db_name();
|
||||
this.fs = new Filer.FileSystem({
|
||||
name: this.db_name,
|
||||
flags: 'FORMAT'
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
indexedDB.deleteDatabase(this.db_name);
|
||||
delete this.fs;
|
||||
});
|
||||
beforeEach(util.setup);
|
||||
afterEach(util.cleanup);
|
||||
|
||||
it('should be a function', function() {
|
||||
var testStat = this.fs.stat('/', function(error) {
|
||||
|
@ -260,21 +189,11 @@ define(["Filer"], function(Filer) {
|
|||
expect(_result).toEqual(false);
|
||||
});
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
describe('#isSocket()', function() {
|
||||
beforeEach(function() {
|
||||
this.db_name = mk_db_name();
|
||||
this.fs = new Filer.FileSystem({
|
||||
name: this.db_name,
|
||||
flags: 'FORMAT'
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
indexedDB.deleteDatabase(this.db_name);
|
||||
delete this.fs;
|
||||
});
|
||||
beforeEach(util.setup);
|
||||
afterEach(util.cleanup);
|
||||
|
||||
it('should be a function', function() {
|
||||
var testStat = this.fs.stat('/', function(error) {
|
||||
|
@ -302,5 +221,6 @@ define(["Filer"], function(Filer) {
|
|||
expect(_result).toEqual(false);
|
||||
});
|
||||
});
|
||||
})
|
||||
}
|
||||
});*/
|
||||
});
|
||||
)
|
|
@ -31,7 +31,7 @@ define([
|
|||
"spec/fs.truncate.spec",
|
||||
"spec/fs.utimes.spec",
|
||||
"spec/fs.xattr.spec",
|
||||
"spec/fs.stats.spec".
|
||||
"spec/fs.stats.spec",
|
||||
"spec/path-resolution.spec",
|
||||
|
||||
// Filer.FileSystem.providers.*
|
||||
|
|
Loading…
Reference in New Issue