-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
Add unit/e2e tests for mongo-typeorm sample #3173
Conversation
Pull Request Test Coverage Report for Build c6f66b77-4cf5-4dc2-a4bc-d25738b16a38
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for your PR @kiwikern !
Could you rebase with master - we run sample e2e & unit tests now in CI :)
@kamilmysliwiec how shall we run the e2e tests with the database in CI? Either we use
- SQLite so we would not need a docker-compose file?
- We run
docker-compose up && jest --config ./test/jest-e2e.json
asnpm run test:e2e
script? - Update the
test:e2e:samples
task to make it work with docker-compose out of the box?
How would that look like? |
@kamilmysliwiec Check whether the sample has a |
… mongo-typeorm-sample-tests # Conflicts: # sample/13-mongo-typeorm/package-lock.json # sample/13-mongo-typeorm/package.json # sample/13-mongo-typeorm/test/photos.e2e-spec.ts
6189a8c
to
e3696cd
Compare
Thanks for your feedback @BrunnerLivio. 🙂 I addressed your comments and rebased to master. As expected, the e2e test is now failing since the database is not started. |
# Conflicts: # sample/13-mongo-typeorm/package-lock.json # sample/13-mongo-typeorm/package.json
Since the only thing the controller does is delegating work to the injected service instance (which we mock in this test), it doesn't really bring any value (does not protect us from anything). |
@kamilmysliwiec I absolutely agree that these tests do not ensure the example code does not break. However, I believe the goal of the tests is to rather serve as examples on how to set up unit/e2e tests for the mongo-sample given. Especially, how you can mock a repository can be of interest for new users. From the linked issue #1539:
|
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: #1539
What is the new behavior?
Added unit + e2e tests for mongo+typeorm sample.
Does this PR introduce a breaking change?
Other information