Include unit-testing examples / best practices in documentation

Feature:
Make sure all quick-starters contain everything needed that the default / most common Unit-testing Frameworks can be used with the code

Description:
As quality code nowadays is unit tested (often even automatically in the build pipeline) the quick-starters should also come with all required parts to enable this. While it may be too much to make this work for each and every testing-framework at least the most common one(s) should be in there.
To be clear, I am not talking about “help me to write a test for my application”, but “what steps need to be done so that components that calls an Auth0 provided library can be created without running into initialisation errors” - and what the best practices would be (e.g. what data to pass into it or how to mock required parts in a good way).

Use-case:
I am working on an application that consists out of multiple independent parts, written in React and Angular. To make sure the components do what they should and are not broken by a change we apply unit-testing as well as integration testing.

Update:
This originated from here: How to unit test AuthService in Angular SDK

Thanks a lot for creating this feature request Manuel!

Let’s see how many other from community will be interested in such addition!

7 Likes

Hello, I’m new and kinda curious what would be the threshould you guys would consider high enough to grant that feature request?

Hey there @lueke.johannes !

We’re not thinking about it in terms of the threshold but rather comparing the numbers between feature requests

Hi,

I am curious if this has made any progress towards being added to the roadmap.

Not yet as there is still not enough requests for that compared to other features.

Hi,

How can we express our interest on this? I believe testing an endpoint secured with Auth0 with mocks (without actually calling Auth0) is a crucial thing for TDD engineers. Otherwise, you’ll end up with an implementation that you can’t properly test as to your principles.

Regards,
Mesru

The best thing is to add a comment on this thread with business context + upvote this feedback card at the top

One of the issues we’re seeing is that as soon as the AuthModule.forRoot(...) is added to our AppModule, hundreds of tests begin to fail. I’ll need to dig deeper, but it seems as if there’s some maintenance issue here, and I wish I was skilled enough to diagnose. But it shouldn’t cause all of our test beds to fail unless it’s added as a dependency. This seems like a massive hole in this SDK.

1 Like

What SDK are you using so we can add some context to that feedback card

Same issue. My tests only fails if I imported services that use Auth0 under the hood. It’s very frustating at this point. Always got this error:

An error was thrown in afterAll
  Uncaught TypeError: Cannot read properties of undefined (reading 'AUTH0_APPLICATION_CLIENT_ID')
  TypeError: Cannot read properties of undefined (reading 'AUTH0_APPLICATION_CLIENT_ID')