Closed omermorad closed 3 years ago
Seems like this may be useful, but I'm not sure if we'd want to add it into the official sample (for the same reason the testing-nestjs
repo is a separate, community-managed repository) to make sure people don't think this is the only way to do things. As the maintainer of the testing-nestjs repo I'd be happy to have this as a sample there. Similar to the @golevelup/ts-jest sample I'm using there too.
As @jmcdo29 said, I don't think we should be adding this to the official sample due to the reasons outlined above. The package itself seems to be very useful though so if you could publish & share it with the community, maybe write a short article on how this could be used, that would be amazing! Posting it on our Discord channel should help with "marketing" too 🙌
Thank you guys, @kamilmysliwiec and @jmcdo29
Actually, I am working on a short article these days, and then I will post both the article and the repo (at the Discord channel).
@jmcdo29 - I'm also working on the e2e
example; It will take me some time because of my work but expect it soon :)
Cheers
Feature Suggestion
Hi,
I opened this issue after a lot of time that my team and I encountered a problem (or rather process) that is systematically recurring.
Most of our microservices are developed in Nest, it gives us a complete solution and works great for us in a production environment. When it comes to tests, or to be precise, e2e testing, we tend to test the full flow, from the request to the controller to the database, which we mainly use an in-memory database.
To create reliable tests, we prepare a lot of fixtures/mocks in advance to sow them in the database before running the test and then check manipulations on this information in the database.
We recently thought of an effective solution that shortens the work of preparing the fixtures and decided to release a package called Mockingbird that allows the use of
@Mock
decorator on top of the DTO or the schema mongoose class which is used to design the database schema (using the@Prop
decorator)We thought it would be nice to share this with the Nest community by adding an example in the documentation or in the testing package itself, (if you find it efficient).
Here is an example use of the library with NestJS based on the example that exists in the sample of Mongoose:
Hope this makes sense :)