testing-nestjs
testing-nestjs copied to clipboard
[e2e tests for mongo-sample]
Just a e2e tests using mongo A clear and concise description of what feature you want to be shown tests for (e.g. Authentication): I tried to create e2e tests by when i started it it's connected to db and adding this data from tests to my db. Should i use mockingoose?
An e2e test usually should be using a database, that way you are testing the entire flow, from the request coming in, to the data being saved, to the data being retrieved. Usually it's also preferable to use a different database for testing that your dev or production database to ensure you don't have any collisions or pollution of your database. I can try to add an e2e sample for mongo though
Hey guys :)
@jmcdo29 well done with the repo! Actually, when I looked at the tests I was looking exactly for what you have described here.
Thought about adding this e2e test, from the controller to an in-memory DB, what do you think?
@omermorad thanks for looking to continue! You can either use an in memory database, or you can add the mongo image to the docker-compose. Either way I look forward to the contribution
Great, I will work on something and send you a PR
Should I modify this test? Or work on a new one?
https://github.com/jmcdo29/testing-nestjs/blob/dff1168a019bd30458b1d8bae58bf8985a267095/apps/mongo-sample/test/app.e2e-spec.ts
Add a new cats.e2e-spec.ts
. I'm pretty sure that's what the TypeORM sample does