Paras Mendiratta
Sep 3, 2018 · 1 min read

Not using jest mock anymore. It was good initially though but if I change anything in the interface definition then jest was unable to catch. The reason is same as you have mentioned. Now I am using decorators for dependency injection and using jest power to search mock classes files and build instances for testing purpose only. Actually, I think, I have leveled-up. Doing a bit of research from past few days to easily use DI with TypeScript. The only drawback I see as of now is I need to use an abstract class instead of an interface to define a repository class. I guess I am fine with it.

    Paras Mendiratta

    Written by