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

api/nodes accessing comms module incorrectly

This commit is contained in:
Nick O'Leary 2015-11-18 10:35:22 +00:00
parent d673846e3d
commit 1ca3ca07d5
2 changed files with 9 additions and 3 deletions

View File

@ -15,8 +15,8 @@
**/ **/
var when = require("when"); var when = require("when");
var comms = require("./comms");
var redNodes; var redNodes;
var comms;
var log; var log;
var i18n; var i18n;
var settings; var settings;
@ -24,7 +24,6 @@ var settings;
module.exports = { module.exports = {
init: function(runtime) { init: function(runtime) {
redNodes = runtime.api; redNodes = runtime.api;
comms = runtime.comms;
log = runtime.log; log = runtime.log;
i18n = runtime.i18n; i18n = runtime.i18n;
settings = runtime.settings; settings = runtime.settings;

View File

@ -23,6 +23,9 @@ var when = require('when');
var nodes = require("../../../red/api/nodes"); var nodes = require("../../../red/api/nodes");
var comms = require("../../../red/api/comms");
describe("nodes api", function() { describe("nodes api", function() {
var app; var app;
@ -33,7 +36,6 @@ describe("nodes api", function() {
info: function(){}, info: function(){},
warn: function(){} warn: function(){}
} }
runtime.comms = { publish:function(){}}
nodes.init(runtime); nodes.init(runtime);
} }
@ -47,6 +49,11 @@ describe("nodes api", function() {
app.put("/nodes/:mod",nodes.putModule); app.put("/nodes/:mod",nodes.putModule);
app.put("/nodes/:mod/:set",nodes.putSet); app.put("/nodes/:mod/:set",nodes.putSet);
app.delete("/nodes/:id",nodes.delete); app.delete("/nodes/:id",nodes.delete);
sinon.stub(comms,"publish");
});
after(function() {
comms.publish.restore();
}); });
describe('get nodes', function() { describe('get nodes', function() {