Repro
- define a node
myNode, with multiple output ports - at the end of its
node.on('input', ...), callnode.send([msg1, msg2, ...]); - hook this node up with
node-red-node-test-helper, like this
let flow = [
{ id: 'n1', type: 'myNode', wires: [['n2']] },
{ id: 'n2', type: 'helper', wires: [[]] }
];
- Load the flow and do the regular dance
helper.load(myNodeRuntime, flow, function () {
var n2 = helper.getNode("n2");
var n1 = helper.getNode("n1");
n2.on("input", function (msgs) {
expect(msgs[0].payload.output).toEqual(msg1.payload.output);
expect(msgs[1].payload.output).toEqual(msg2.payload.output);
...
});
n1.receive({ payload: "expected input message to myNode" });
});
Expected
- The test should pass:
n2should receive a message array of the exact layout as the message array sent fromn1.
Observed
-
n2only receives a single message, which is the first message in the message array sent fromn1
Question
Is this by design? How do I properly test a node with multiple output ports?