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

Fix multi-level sequences of split/join nodes

This commit is contained in:
Nick O'Leary 2016-06-13 17:43:22 +01:00
parent 8fe07e0f07
commit 3ad9053d65
2 changed files with 24 additions and 1 deletions

View File

@ -93,7 +93,7 @@ module.exports = function(RED) {
RED.util.setMessageProperty(group.msg,node.property,group.payload);
}
if (group.msg.hasOwnProperty('parts') && group.msg.parts.hasOwnProperty('parts')) {
group.msg.parts = group.msg.parts;
group.msg.parts = group.msg.parts.parts;
} else {
delete group.msg.parts;
}

View File

@ -359,4 +359,27 @@ describe('JOIN node', function() {
n1.receive({payload:"b", parts:{type:'string',index:1, count:4, ch:"", id:555}});
});
});
it('should allow chained split-split-join-join sequences', function(done) {
var flow = [{id:"s1", type:"split",wires:[["s2"]]},
{id:"s2", type:"split",wires:[["j1"]]},
{id:"j1", type:"join", mode:"auto", wires:[["j2"]]},
{id:"j2", type:"join", mode:"auto", wires:[["n2"]]},
{id:"n2", type:"helper"}];
helper.load(joinNode, flow, function() {
var s1 = helper.getNode("s1");
var n2 = helper.getNode("n2");
n2.on("input", function(msg) {
try {
msg.should.have.property("payload");
msg.payload.should.eql([[1,2,3],"a\nb\nc",[7,8,9]]);
done();
}
catch(e) { done(e); }
});
s1.receive({payload:[[1,2,3],"a\nb\nc",[7,8,9]]});
});
})
});