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

Fix async problem in test cases

This commit is contained in:
Kazuhito Yokoi 2018-07-13 17:34:04 +09:00
parent 513579a7ee
commit 761161a8e5
3 changed files with 30 additions and 22 deletions

View File

@ -21,7 +21,7 @@ var helper = require("node-red-node-test-helper");
describe('inject node', function() {
before(function(done) {
beforeEach(function(done) {
Context.init({
contextStorage: {
memory: {
@ -29,18 +29,19 @@ describe('inject node', function() {
}
}
});
Context.load();
Context.load().then(function () {
helper.startServer(done);
});
after(function(done) {
helper.stopServer(done);
});
afterEach(function() {
helper.unload();
Context.clean({allNodes: {}});
Context.close();
afterEach(function(done) {
helper.unload().then(function () {
return Context.clean({allNodes: {}});
}).then(function () {
return Context.close();
}).then(function () {
helper.stopServer(done);
});
});
it('sets the value of flow context property', function (done) {

View File

@ -31,14 +31,17 @@ describe('trigger node', function() {
}
}
});
Context.load();
Context.load().then(function () {
helper.startServer(done);
});
});
afterEach(function(done) {
helper.unload().then(function () {
Context.clean({allNodes: {}});
Context.close();
return Context.clean({allNodes: {}});
}).then(function () {
return Context.close();
}).then(function () {
helper.stopServer(done);
});
});

View File

@ -31,15 +31,19 @@ describe('change Node', function() {
}
}
});
Context.load();
Context.load().then(function () {
helper.startServer(done);
});
});
afterEach(function(done) {
helper.unload();
helper.unload().then(function () {
return Context.clean({allNodes: {}});
}).then(function () {
return Context.close();
}).then(function () {
helper.stopServer(done);
Context.clean({allNodes:{}});
Context.close();
});
});
it('should load node with defaults', function(done) {