mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add RED._ to test helper
This commit is contained in:
parent
4fb86ab55a
commit
c105b2df37
@ -86,15 +86,28 @@ module.exports = {
|
|||||||
available: function() { return false; }
|
available: function() { return false; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var red = {};
|
||||||
|
for (var i in RED) {
|
||||||
|
if (RED.hasOwnProperty(i) && !/^(init|start|stop)$/.test(i)) {
|
||||||
|
var propDescriptor = Object.getOwnPropertyDescriptor(RED,i);
|
||||||
|
Object.defineProperty(red,i,propDescriptor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
red["_"] = function(messageId) {
|
||||||
|
return messageId;
|
||||||
|
};
|
||||||
|
|
||||||
redNodes.init(settings, storage);
|
redNodes.init(settings, storage);
|
||||||
credentials.init(storage,express());
|
credentials.init(storage,express());
|
||||||
RED.nodes.registerType("helper", helperNode);
|
RED.nodes.registerType("helper", helperNode);
|
||||||
if (Array.isArray(testNode)) {
|
if (Array.isArray(testNode)) {
|
||||||
for (var i = 0; i < testNode.length; i++) {
|
for (var i = 0; i < testNode.length; i++) {
|
||||||
testNode[i](RED);
|
testNode[i](red);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
testNode(RED);
|
testNode(red);
|
||||||
}
|
}
|
||||||
flows.load().then(function() {
|
flows.load().then(function() {
|
||||||
should.deepEqual(testFlows, flows.getFlows());
|
should.deepEqual(testFlows, flows.getFlows());
|
||||||
|
Loading…
Reference in New Issue
Block a user