mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
parent
27db727321
commit
b98d1216b1
@ -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];
|
||||
}
|
||||
}
|
||||
|
@ -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"}];
|
||||
|
Loading…
Reference in New Issue
Block a user