# Testing Async Functions

**URL:** https://discourse.nodered.org/t/testing-async-functions/64481
**Category:** Developing Nodes
**Created:** [28 June 2022 21:01 UTC](https://discourse.nodered.org/t/testing-async-functions/64481 "2022-06-28T21:01:05Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![linuxjamie](https://avatars.discourse-cdn.com/v4/letter/l/b5a626/32.png) [@linuxjamie](https://discourse.nodered.org/u/linuxjamie)
#### Post date: [28 June 2022 21:01 UTC](https://discourse.nodered.org/t/testing-async-functions/64481/1 "2022-06-28T21:01:05Z")

</div>

I have a node with the following function:

```auto
    node.foo = async function () {
      throw ("FooBar");

    };

```

I would like to test this function using the [https://github.com/node-red/node-red-node-test-helper](https://github.com/node-red/node-red-node-test-helper).

I want to test that the function returns an exception. How is this achievable with the test helper?

---

<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: [27 August 2022 21:01 UTC](https://discourse.nodered.org/t/testing-async-functions/64481/2 "2022-08-27T21:01:34Z")

</div>

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