mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Merge pull request #1627 from node-red-hitachi/fix-batch-concat-mode-msg-modification
fixed message modificcation of concat mode of BATCH node
This commit is contained in:
commit
5fb3ffc240
@ -116,7 +116,7 @@ module.exports = function(RED) {
|
||||
for (var topic of topics) {
|
||||
remove_topic(pending, topic);
|
||||
}
|
||||
send_msgs(node, msgs, false);
|
||||
send_msgs(node, msgs, true);
|
||||
node.pending_count -= msgs.length;
|
||||
}
|
||||
|
||||
|
@ -54,8 +54,13 @@ describe('BATCH node', function() {
|
||||
var ix0 = 0; // seq no
|
||||
var ix1 = 0; // loc. in seq
|
||||
var seq = undefined;
|
||||
var msgs = [];
|
||||
n2.on("input", function(msg) {
|
||||
try {
|
||||
for (var i = 0; i < msgs.length; i++) {
|
||||
msg.should.not.equal(msgs[i]);
|
||||
}
|
||||
msgs.push(msg);
|
||||
if (seq === undefined) {
|
||||
seq = results[ix0];
|
||||
}
|
||||
@ -306,6 +311,19 @@ describe('BATCH node', function() {
|
||||
check_concat(flow, results, inputs, done);
|
||||
});
|
||||
|
||||
it('should concat same seq.', function(done) {
|
||||
var flow = [{id:"n1", type:"batch", name: "BatchNode", mode: "concat", count: 0, overlap: 0, interval: 1, allowEmptySequence: false, topics: [{topic: "TA"}, {topic: "TA"}], wires:[["n2"]]},
|
||||
{id:"n2", type:"helper"}];
|
||||
var results = [
|
||||
[9, 8, 9, 8]
|
||||
];
|
||||
var inputs = [
|
||||
["TA", 9, 0, 2],
|
||||
["TA", 8, 1, 2]
|
||||
];
|
||||
check_concat(flow, results, inputs, done);
|
||||
});
|
||||
|
||||
it('should handle too many pending messages', function(done) {
|
||||
var flow = [{id:"n1", type:"batch", name: "BatchNode", mode: "concat", count: 0, overlap: 0, interval: 1, allowEmptySequence: false, topics: [{topic: "TA"}, {topic: "TB"}], wires:[["n2"]]},
|
||||
{id:"n2", type:"helper"}];
|
||||
|
Loading…
Reference in New Issue
Block a user