nest
nest copied to clipboard
Add unit tests for sample 06-mongoose
PR Checklist
Please check if your PR fulfills the following requirements:
- [x] The commit message follows our guidelines: https://github.com/nestjs/nest/blob/master/CONTRIBUTING.md
- [x] Tests for the changes have been added (for bug fixes / features)
- [x] Docs have been added / updated (for bug fixes / features)
PR Type
What kind of change does this PR introduce?
- [ ] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, local variables)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] CI related changes
- [x] Other... Improvements in samples
What is the current behavior?
Sample 06-mongoose is missing some unit tests.
Issue Number: N/A
What is the new behavior?
More unit tests in sample 06-mongoose.
Does this PR introduce a breaking change?
- [ ] Yes
- [x] No
Other information
Pull Request Test Coverage Report for Build 2d502500-1db4-4ec5-b760-8610b6ab6adf
Details
- 0 of 0 changed or added relevant lines in 0 files are covered.
- No unchanged relevant lines lost coverage.
- Overall coverage remained the same at 92.213%
| Totals | |
|---|---|
| Change from base Build 71551605-c356-4a76-8f46-8de2acf07906: | 0.0% |
| Covered Lines: | 6750 |
| Relevant Lines: | 7320 |
💛 - Coveralls
I would like to include E2E tests too, but I need to use a database for that. Usually, I am using testcontainers in my E2E tests. Do you agree to use additional dependency (testcontainers) here?
(also for unit tests of services I do not like to mock the model. Usually, in a real codebase, you have to improve these mocks every time you change the service. I think, using a real database and actually run the queries give you more confidence in your tests. Previously I did use inmemory mongo db, now I am using testcontainers here too. The result is that these tests are not pure unit tests anymore but rather integration tests. Still, I think it makes more sense for services. So again. If you agree then I can rewrite this example to use testcontainers)