Skip to content

Automocking dependencies typed with abstract class #66

Closed Answered by omermorad
gabrielgasp asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @gabrielgasp,

I apologize for any confusion. Let me clarify regarding your questions about mocking class dependencies that expect an implementation of an interface or an abstract class.

Automock does support mocking such dependencies. The approach for mocking these dependencies may vary depending on the framework you are using. Let's consider the scenarios separately:

  1. Mocking class dependencies that expect an implementation of an interface:

In order to mock an implementation of an interface, you typically need to provide a "token" that represents the interface. This token allows you to bind the interface to the desired mock implementation. One example is using NestJS, where you can u…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@gabrielgasp
Comment options

Answer selected by omermorad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
2 participants