How to mock Connection in unit testing
devvaneio opened this issue · comments
devvaneio commented
I'm submitting a...
[ ] Regression
[ ] Bug report
[ ] Feature request
[x] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
I can't find a way to mock a Connection in unit testing. I did that with with repository though
Expected behavior
Mock Connection
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
Environment
Nest version: 7.x
For Tooling issues:
- Node version: 14
- Platform: Ubuntu
Jay McDoniel commented
lusatiro commented
Thanks. I had to use Connection
to get around the lack of support for MongoDB transactions in Typeorm. I did mock repositories using getRepositoryToken
. But I couldn't do the same with Connection
. I'm gonna keep doing my research anyway. I'll go back here If I found something.
Kamil Mysliwiec commented
Please, use our Discord channel (support) for further questions. We are using GitHub to track bugs, feature requests, and potential improvements.