1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Make localfs test async aware

This commit is contained in:
Nick O'Leary 2014-03-31 14:37:38 +01:00
parent 1bdfd920cd
commit ea2c0da163

View File

@ -7,23 +7,20 @@ var localfilesystem = require("../red/storage/localfilesystem");
describe('LocalFileSystem', function() { describe('LocalFileSystem', function() {
var userDir = path.join(__dirname,".testUserHome"); var userDir = path.join(__dirname,".testUserHome");
var testFlow = [{"type":"tab","id":"d8be2a6d.2741d8","label":"Sheet 1"}]; var testFlow = [{"type":"tab","id":"d8be2a6d.2741d8","label":"Sheet 1"}];
beforeEach(function() { beforeEach(function(done) {
console.log(userDir); fs.remove(userDir,function(err) {
if (fs.existsSync(userDir)) { fs.mkdir(userDir,done);
console.log("deleting");
fs.removeSync(userDir)
}
console.log("making");
fs.mkdirSync(userDir);
}); });
afterEach(function() { });
fs.removeSync(userDir); afterEach(function(done) {
fs.remove(userDir,done);
}); });
it('should initialise the user directory',function() { it('should initialise the user directory',function(done) {
localfilesystem.init({userDir:userDir}).then(function() { localfilesystem.init({userDir:userDir}).then(function() {
fs.existsSync(path.join(userDir,"lib")).should.be.true; fs.existsSync(path.join(userDir,"lib")).should.be.true;
fs.existsSync(path.join(userDir,"lib",'flows')).should.be.true; fs.existsSync(path.join(userDir,"lib",'flows')).should.be.true;
done();
}); });
}); });