Replies: 2 comments 1 reply
-
What is the advantage of this, and what would be the big difference of creating the service manually via its constructor? |
Beta Was this translation helpful? Give feedback.
-
For example. We are working on a little auth-library atm with keycloak integration. What would be the best way to test them with (or without) testing-library. Since this might be hard(er)
Or is this what you meant by:
In that case, the answer to the question "What would be a proper way to test (standalone) services" would be: Correct? |
Beta Was this translation helpful? Give feedback.
-
Can we use the testing-library/angular for unit testing services as wel.
Like an
AuthService
.So without creating a 'login-component' or something to
render()
and call theautService
Or in that case, just use 'plain' jest / Angular Testbed. Or even a separate library like https://ngneat.github.io/spectator/
The sample: https://github.com/testing-library/angular-testing-library/blob/main/apps/example-app/src/app/examples/12-service-component.spec.ts uses a Component to test/mock the service.
Beta Was this translation helpful? Give feedback.
All reactions