From ea2c0da163fd249c503b6fc34c25535b2217c699 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Mon, 31 Mar 2014 14:37:38 +0100 Subject: [PATCH] Make localfs test async aware --- test/storage_localfilesystem_spec.js | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/test/storage_localfilesystem_spec.js b/test/storage_localfilesystem_spec.js index ebd2531e6..2c47d18b3 100644 --- a/test/storage_localfilesystem_spec.js +++ b/test/storage_localfilesystem_spec.js @@ -7,23 +7,20 @@ var localfilesystem = require("../red/storage/localfilesystem"); describe('LocalFileSystem', function() { var userDir = path.join(__dirname,".testUserHome"); var testFlow = [{"type":"tab","id":"d8be2a6d.2741d8","label":"Sheet 1"}]; - beforeEach(function() { - console.log(userDir); - if (fs.existsSync(userDir)) { - console.log("deleting"); - fs.removeSync(userDir) - } - console.log("making"); - fs.mkdirSync(userDir); + beforeEach(function(done) { + fs.remove(userDir,function(err) { + fs.mkdir(userDir,done); + }); }); - 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() { fs.existsSync(path.join(userDir,"lib")).should.be.true; fs.existsSync(path.join(userDir,"lib",'flows')).should.be.true; + done(); }); });