mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Change node must handle empty rule set
This commit is contained in:
parent
042409f870
commit
72c400794c
@ -283,6 +283,9 @@ module.exports = function(RED) {
|
||||
}
|
||||
}
|
||||
function applyRules(msg, currentRule) {
|
||||
if (currentRule >= node.rules.length) {
|
||||
return Promise.resolve(msg);
|
||||
}
|
||||
var r = node.rules[currentRule];
|
||||
var rulePromise;
|
||||
if (r.t === "move") {
|
||||
|
@ -78,6 +78,24 @@ describe('change Node', function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('should no-op if there are no rules', function(done) {
|
||||
var flow = [{"id":"changeNode1","type":"change","rules":[],"action":"","property":"","from":"","to":"","reg":false,"name":"changeNode","wires":[["helperNode1"]]},
|
||||
{id:"helperNode1", type:"helper", wires:[]}];
|
||||
helper.load(changeNode, flow, function() {
|
||||
var changeNode1 = helper.getNode("changeNode1");
|
||||
var helperNode1 = helper.getNode("helperNode1");
|
||||
helperNode1.on("input", function(msg) {
|
||||
try {
|
||||
msg.should.eql(sentMsg);
|
||||
done();
|
||||
} catch(err) {
|
||||
done(err);
|
||||
}
|
||||
});
|
||||
var sentMsg = {payload:"leaveMeAlong"};
|
||||
changeNode1.receive(sentMsg);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#set' , function() {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user