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

ignore _msgid when merging full objects

to hand code and close #1423
This commit is contained in:
Dave Conway-Jones 2017-12-05 21:45:43 +00:00
parent 27db727321
commit b98d1216b1
No known key found for this signature in database
GPG Key ID: 9E7F9C73F5168CD4
2 changed files with 30 additions and 1 deletions

View File

@ -441,7 +441,7 @@ module.exports = function(RED) {
}
} else {
for (propertyKey in property) {
if (property.hasOwnProperty(propertyKey)) {
if (property.hasOwnProperty(propertyKey) && propertyKey !== '_msgid') {
group.payload[propertyKey] = property[propertyKey];
}
}

View File

@ -323,6 +323,7 @@ describe('JOIN node', function() {
n1.receive({payload:"D", parts:{id:1, type:"string", ch:",", index:3, count:4}});
});
});
it('should join bits of buffer back together automatically', function(done) {
var flow = [{id:"n1", type:"join", wires:[["n2"]], joiner:",", build:"buffer", mode:"auto"},
{id:"n2", type:"helper"}];
@ -425,6 +426,34 @@ describe('JOIN node', function() {
});
});
it('should merge full msg objects', function(done) {
var flow = [{id:"n1", type:"join", wires:[["n2"]], count:6, build:"merged", mode:"custom", propertyType:"full", property:""},
{id:"n2", type:"helper"}];
helper.load(joinNode, flow, function() {
var n1 = helper.getNode("n1");
var n2 = helper.getNode("n2");
n2.on("input", function(msg) {
try {
msg.payload.should.have.property("payload",7);
msg.payload.should.have.property("aha",'c');
msg.payload.should.have.property("bar",'b');
msg.payload.should.have.property("bingo",'e');
msg.payload.should.have.property("foo",'d');
msg.payload.should.have.property("topic",'a');
done();
}
catch(e) { done(e)}
});
n1.receive({payload:1, topic:"f"});
n1.receive({payload:2, topic:"a"});
n1.receive({payload:3, foo:"b"});
n1.receive({payload:4, bar:"b"});
n1.receive({payload:5, aha:"c"});
n1.receive({payload:6, foo:"d"});
n1.receive({payload:7, bingo:"e"});
});
});
it('should accumulate a merged object', function(done) {
var flow = [{id:"n1", type:"join", wires:[["n2"]], build:"merged",mode:"custom",accumulate:true, count:1},
{id:"n2", type:"helper"}];