Auth0 Actions Unit Test
The Actions NPM (@auth0/actions) package enables the use of TypeScript development on external projects, allowing developers to follow best practices and improve their unit testing based on the TypeScript definitions.
How it works
Follow the installation and import guidelines described at: How Actions NPM works. To unit test an Action, you must mock theevent and api objects that your Action function receives. You can create these mocks using the TypeScript definitions included in auth0/actions, which ensures your tests accurately reflect the production environment. Testing frameworks like Jest are ideal for managing mocking and functionality.
The Unit Tests can be run in a local environment, version control, or CI/CD process, improving the overall quality assurance and validations before impacting changes on Auth0 Tenants.
Examples
The following pages provide validation for a series of scenarios by mocking the necessary objects, with full JavaScript and TypeScript suites for Jest, Mocha, and the Node.js test runner. To learn more about@auth0/actions, visit: https://www.npmjs.com/package/@auth0/actions.
To learn more about writing Actions, read Write Your First Action.