do not reuse message object for multiple outputs

This commit is contained in:
Hiroyasu Nishiyama
2018-01-28 14:37:34 +09:00
parent 15c3cc60f6
commit 8516f41ba8
2 changed files with 30 additions and 3 deletions

View File

@@ -328,6 +328,32 @@ describe('html node', function() {
});
});
it('should not reuse message', function(done) {
fs.readFile(file, 'utf8', function(err, data) {
var flow = [{id:"n1",type:"html",wires:[["n2"]],tag:"ul",ret:"text",as:"multi"},
{id:"n2", type:"helper"}];
helper.load(htmlNode, flow, function() {
var n1 = helper.getNode("n1");
var n2 = helper.getNode("n2");
var prev_msg = undefined;
n2.on("input", function(msg) {
cnt++;
if (prev_msg == undefined) {
prev_msg = msg;
}
else {
msg.should.not.equal(prev_msg);
}
if (cnt == 2) {
done();
}
});
n1.receive({payload:data,topic: "bar"});
});
});
});
});
});