0

I am using moduleRef in NestJS like this:

this.moduleRef.get(X)

In unit tests which is implemented with ts-mockito I try to mock like this:

describe(() => {
     const mockModuleRef = mock(ModuleRef);
     const mockX = mock(X);
     beforeEach(() => {
           when(mockModuleRef.get<X>(anything())).thenReturn(instance(mockX));
     })

})

However, I get the error: mockModuleRef.get is not a function

Can you help me?

Oğuzcan Budumlu
  • 511
  • 1
  • 4
  • 11

0 Answers0