Add mocking possibility to nest/mongoose module
See original GitHub issueSo after opening the issue in the wrong repository, here I’m again.
I’m submitting a…
[ ] Regression
[ ] Bug report
[*] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
Testing e2e with mongoose is done via mockgoose. A connection has to be created, injected as provider (in AppModule)
Also models cannot be registered with the mongoose.forFeature()
-method, which is very convenient.
Im refering to this part of the documentation (https://docs.nestjs.com/recipes/mockgoose)
Expected behavior
It would be nice to get a TestingModule which can be used in e2e tests to mock the mongoose.forRoot()
-method.
Something like the HttpClientTestingModule from angular.
Also it would be great if there would be a way to add fake data, when creating the connection to the mocked database.
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
Currently it is cumbersome to setup a mongodb connection (either over mockgoose or a other collection in the database). It would be very convenient to have a built-in way to setup a connection which works together with the other parts of the mongoose package.
Environment
Issue Analytics
- State:
- Created 5 years ago
- Reactions:15
- Comments:6 (2 by maintainers)
This works:
How about using this instead: https://github.com/nodkz/mongodb-memory-server
Looks like mockgoose is abandoned. mongodb-memory-server looks more recent and, imho, mature from what I read in the docs.