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

fixed message modificcation of concat mode of BATCH node

This commit is contained in:
Hiroyasu Nishiyama 2018-02-13 20:55:03 +09:00
parent 9066cedc29
commit 6252b075bc
2 changed files with 19 additions and 1 deletions

View File

@ -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;
}

View File

@ -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"}];