# Node-red-node-test-helper does not support multiple upstream output ports?

**URL:** https://discourse.nodered.org/t/node-red-node-test-helper-does-not-support-multiple-upstream-output-ports/73395
**Category:** Developing Nodes
**Tags:** node-red-node-test-helper
**Created:** [9 January 2023 07:56 UTC](https://discourse.nodered.org/t/node-red-node-test-helper-does-not-support-multiple-upstream-output-ports/73395 "2023-01-09T07:56:12Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![kakyoism](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kakyoism/32/46283_2.png) [@kakyoism](https://discourse.nodered.org/u/kakyoism)
#### Post date: [9 January 2023 07:56 UTC](https://discourse.nodered.org/t/node-red-node-test-helper-does-not-support-multiple-upstream-output-ports/73395/1 "2023-01-09T07:56:12Z")

</div>

## Repro

- define a node `myNode`, with multiple output ports
- at the end of its `node.on('input', ...)`, call `node.send([msg1, msg2, ...]);`
- hook this node up with `node-red-node-test-helper`, like this

```js
let flow = [
  { id: 'n1', type: 'myNode', wires: [['n2']] },
  { id: 'n2', type: 'helper', wires: [[]] }
];

```

- Load the flow and do the regular dance

```js
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: `n2` should receive a message array of the exact layout as the message array sent from `n1`.

## Observed

- `n2` only receives a single message, which is the first message in the message array sent from `n1`

## Question

Is this by design? How do I properly test a node with multiple output ports?

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [9 January 2023 08:55 UTC](https://discourse.nodered.org/t/node-red-node-test-helper-does-not-support-multiple-upstream-output-ports/73395/2 "2023-01-09T08:55:28Z")

</div>

Looking at your wires array property of n1 you have only wired up n2 to one of the outputs so yes you aren't going to test the other... notice like the send it is an array of arrays. one for each output.

---

<div class="post-metadata">

### Author: ![kakyoism](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kakyoism/32/46283_2.png) [@kakyoism](https://discourse.nodered.org/u/kakyoism)
#### Post date: [9 January 2023 08:59 UTC](https://discourse.nodered.org/t/node-red-node-test-helper-does-not-support-multiple-upstream-output-ports/73395/3 "2023-01-09T08:59:17Z")

</div>

Do you mean I can actually hook up multiple node-red-node-test-helper with different IDs?  
I see. That makes sense. I'll try it and report back.

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [9 January 2023 09:01 UTC](https://discourse.nodered.org/t/node-red-node-test-helper-does-not-support-multiple-upstream-output-ports/73395/4 "2023-01-09T09:01:08Z")

</div>

This question was cross-posted as an issue on the test-helper (please don't do that). I've already answered it there: [Helper wrongly strips off all but the first message in its input message array · Issue #60 · node-red/node-red-node-test-helper · GitHub](https://github.com/node-red/node-red-node-test-helper/issues/60)

---

<div class="post-metadata">

### Author: ![kakyoism](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kakyoism/32/46283_2.png) [@kakyoism](https://discourse.nodered.org/u/kakyoism)
#### Post date: [9 January 2023 10:52 UTC](https://discourse.nodered.org/t/node-red-node-test-helper-does-not-support-multiple-upstream-output-ports/73395/5 "2023-01-09T10:52:12Z")

</div>

@knolleary  
Sorry about that. Will not do that again. Thanks for the solution. Works like a charm!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [23 January 2023 10:52 UTC](https://discourse.nodered.org/t/node-red-node-test-helper-does-not-support-multiple-upstream-output-ports/73395/6 "2023-01-23T10:52:28Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
