New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Testing Services And Database e2e #984
Comments
There is documentation how to test controllers. Services can be handled the same way. Still not enough? Check out the cat app sample |
I saw you've changed the issue. I created an example for that: https://github.com/BrunnerLivio/nestjs-unit-test-db-example but it is written in Nest 4.x.x |
News? |
Even, I'm struggling to find a way to test the services and increase the code coverage. The method defined in the sample app creates a mock for the service and the actual service never gets executed, hence reducing the coverage. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I'm submitting a...
Current behavior
In regards to e2e testing, one can mock Repositories when not interfacing with a database, but it is unclear how to use actual Repositories on a database within the e2e tests.
There is no documentation regarding testing services. This is not intuitive with all the DI specifics with testing.
Expected behavior
I would like to see examples in the documentation about how to pass Repos into e2e tests and how to test services.
What is the motivation / use case for changing the behavior?
Be able to test services and increase coverage and confidence in code.
The text was updated successfully, but these errors were encountered: