Unit testing Auth0 Actions

We are very excited about the release of Actions, which provide an export that can be used for testing purposes, unlike Rules.

Since the Actions typically do not return something like a callback, what are the recommended strategies for unit testing these functions? I have not found any documentation around testing Auth0 code. This also applies to database connection scripts, although without any exports, I am unsure of how to go about testing those at all. Any ideas are appreciated!

Thank you!

Hey there!

Let me reach out to the team to find out more about it!

Hey there! Unfortunately as of now we still don’t have any content around it but I was asked by the team to ask you to file a feature request for that using our Feedback category here:

I voted for the feature Include unit-testing examples / best practices in documentation

It’s unfortunate to hear this is treated as a feature request, when it’s really just basic documentation for using the product. I should not need to request a feature to know how to use something. Surely the development team is creating features with testing capabilities in mind, it would be great to even share the recommended strategies.

The team indeed made some design decisions around the architecture used in Actions so that they could eventually offer a nice DX for customers to unit test Actions in isolation but the guide is not live yet.

Further to this it would be extremely useful if auth0 released a package to help with testing actions. As it is we have to create quite extensive mocks for the event & api arguments, it’s quite feasible that our tests may pass but because we have mocked out the api interface wrongly it will not work in auth0.

Thanks for providing that feedback! Can you file it as a feature request using our Feedback category here:

Hi Konrad,

Any update on the Actions unit test guide that is not live yet?

Checking for any updates. Thank you!

Hi @ben_wozniak,

Konrad is out of the office, but will be back next week and should be able to follow up on this one. Just wanted to let you know!