mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
add test case for support of out of order messages support in auto mode of join node if exactly one message has count set
This commit is contained in:
parent
468cfeffb6
commit
01b67c692b
@ -1646,4 +1646,40 @@ describe('JOIN node', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('should handle msg.parts even if messages are out of order in auto mode if exactly one message has count set', function (done) {
|
||||
var flow = [{ id: "n1", type: "join", wires: [["n2"]], joiner: "[44]", joinerType: "bin", build: "string", mode: "auto" },
|
||||
{ id: "n2", type: "helper" }];
|
||||
helper.load(joinNode, flow, function () {
|
||||
var n1 = helper.getNode("n1");
|
||||
var n2 = helper.getNode("n2");
|
||||
|
||||
n2.on("input", function (msg) {
|
||||
msg.payload.length.should.be.eql(5);
|
||||
msg.payload.should.be.eql([0,1,2,3,4]);
|
||||
done();
|
||||
});
|
||||
|
||||
var msg = {};
|
||||
msg.parts = {
|
||||
id: RED.util.generateId()
|
||||
};
|
||||
for(var elem = 1; elem < 5; ++elem) {
|
||||
var _msg = RED.util.cloneMessage(msg);
|
||||
_msg.parts.index = elem;
|
||||
if(elem == 4) {
|
||||
_msg.parts.count = 5;
|
||||
}
|
||||
_msg.payload = elem;
|
||||
n1.receive(_msg);
|
||||
}
|
||||
|
||||
var _msg = RED.util.cloneMessage(msg);
|
||||
delete _msg.parts.count;
|
||||
_msg.parts.index = 0;
|
||||
_msg.payload = 0;
|
||||
n1.receive(_msg);
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user