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

Fixup context test case to block until context close completes

This commit is contained in:
Nick O'Leary 2018-08-09 15:36:43 +01:00
parent ff627fd128
commit c9f916ebab
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -17,6 +17,7 @@
var should = require("should"); var should = require("should");
var sinon = require('sinon'); var sinon = require('sinon');
var path = require("path"); var path = require("path");
var fs = require('fs-extra');
var Context = require("../../../../../red/runtime/nodes/context/index"); var Context = require("../../../../../red/runtime/nodes/context/index");
describe('context', function() { describe('context', function() {
@ -273,6 +274,8 @@ describe('context', function() {
sandbox.reset(); sandbox.reset();
return Context.clean({allNodes:{}}).then(function(){ return Context.clean({allNodes:{}}).then(function(){
return Context.close(); return Context.close();
}).then(function(){
return fs.remove(resourcesDir);
}); });
}); });
@ -286,11 +289,11 @@ describe('context', function() {
}); });
it('should load memory module', function() { it('should load memory module', function() {
Context.init({contextStorage:{memory:{module:"memory"}}}); Context.init({contextStorage:{memory:{module:"memory"}}});
Context.load(); return Context.load();
}); });
it('should load localfilesystem module', function() { it('should load localfilesystem module', function() {
Context.init({contextStorage:{file:{module:"localfilesystem",config:{dir:resourcesDir}}}}); Context.init({contextStorage:{file:{module:"localfilesystem",config:{dir:resourcesDir}}}});
Context.load(); return Context.load();
}); });
it('should ignore reserved storage name `_`', function(done) { it('should ignore reserved storage name `_`', function(done) {
Context.init({contextStorage:{_:{module:testPlugin}}}); Context.init({contextStorage:{_:{module:testPlugin}}});