mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Update unit tests
This commit is contained in:
@@ -207,12 +207,12 @@ function diffNodeConfigs(oldNode,newNode) {
|
||||
var subflowInstanceRE = /^subflow:(.+)$/;
|
||||
|
||||
function Flow(config) {
|
||||
|
||||
this.activeNodes = {};
|
||||
this.subflowInstanceNodes = {};
|
||||
|
||||
this.parseConfig(config);
|
||||
|
||||
|
||||
}
|
||||
|
||||
Flow.prototype.parseConfig = function(config) {
|
||||
@@ -385,6 +385,14 @@ Flow.prototype.getFlow = function() {
|
||||
return this.config;
|
||||
}
|
||||
|
||||
Flow.prototype.eachNode = function(callback) {
|
||||
for (var id in this.activeNodes) {
|
||||
if (this.activeNodes.hasOwnProperty(id)) {
|
||||
callback(this.activeNodes[id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Flow.prototype.applyConfig = function(config,type) {
|
||||
var diff = this.diffFlow(config);
|
||||
//console.log(diff);
|
||||
|
@@ -81,6 +81,10 @@ var flowNodes = module.exports = {
|
||||
return activeFlow.getNode(i);
|
||||
},
|
||||
|
||||
eachNode: function(cb) {
|
||||
activeFlow.eachNode(cb);
|
||||
},
|
||||
|
||||
/**
|
||||
* Stops all active nodes and clears the active set
|
||||
* @return a promise for the stopping of all active nodes
|
||||
@@ -174,7 +178,7 @@ var flowNodes = module.exports = {
|
||||
var missingTypes = activeFlow.getMissingTypes();
|
||||
if (missingTypes.length > 0) {
|
||||
util.log("[red] Waiting for missing types to be registered:");
|
||||
for (i=0;i<missingTypes.length;i++) {
|
||||
for (var i=0;i<missingTypes.length;i++) {
|
||||
util.log("[red] - "+missingTypes[i]);
|
||||
}
|
||||
}
|
||||
|
@@ -317,7 +317,11 @@ var registry = (function() {
|
||||
},
|
||||
|
||||
getNodeConfig: function(id) {
|
||||
var config = moduleConfigs[getModule(id)].nodes[getNode(id)];
|
||||
var config = moduleConfigs[getModule(id)];
|
||||
if (!config) {
|
||||
return null;
|
||||
}
|
||||
config = config.nodes[getNode(id)];
|
||||
if (config) {
|
||||
var result = config.config;
|
||||
if (config.script) {
|
||||
|
Reference in New Issue
Block a user