Mocking dependency injection to test resolver #888
-
|
I have this resolver. It's just a simple And this service which uses Firestore and is injected into the above resolver. It has a constructor where I configure Firestore and a And this unit test for the When I run test I get: The Does anyone know how to correctly mock a dependency injection when using type-graphql? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This is a question for DI lib you're using. TypeGraphQL only calls Based on |
Beta Was this translation helpful? Give feedback.
This is a question for DI lib you're using. TypeGraphQL only calls
Container.get, that's it. Nothing more on TypeGraphQL side.Based on
@Service()looks like you're using TypeDI. The whole purpose of DI container is to register mock inside it instead of mocking JS module by Jest.