Cannot seem to mock a class that has the @InjectRepository by mikro-orm or because of its generic typing #268
-
I have the following code in my test: const { unit, unitRef } = TestBed.create(MyService)
.compile();
myService = unit;
myRepository = unitRef.get(EntityRepository<MyEntity>); and the following code shows the constructor of constructor(
@InjectRepository(MyEntity)
private myRepository: EntityRepository<MyEntity>,
) {} I currently get an |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Are you using NestJS as your framework? const { unit, unitRef } = TestBed.create(MyService).compile();
myService = unit;
myRepository = unitRef.get(getRepositoryToken(EntityRepository) as string); Let's me know if it worked. |
Beta Was this translation helpful? Give feedback.
Are you using NestJS as your framework?
Try use this:
Let's me know if it worked.