Open viru-rishu opened 4 years ago
You don't need to import the TypeOrmCrudService
class. Also use useClass instead of useValue.
beforeAll(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [
ContractService,
{ provide: getRepositoryToken(Contract), useClass: MockRepository },
],
}).compile();
service = module.get<ContractService>(ContractService);
repository = module.get(getRepositoryToken(Contract));
});
While running tests in my project, I am getting this error
TypeError: Cannot read property 'metadata' of undefined
Service file organisation.service.spec.ts
mockrepository file : mockrepository.ts
Also, I am getting this error TypeError: Cannot read property 'connection' of undefined in users.controller.spec.ts
Would you please let me know where I am doing wrong.
Node Version : v10.16.2 Crud Version "@nestjsx/crud": "^4.6.2", "@nestjsx/crud-request": "^4.4.2", "@nestjsx/crud-typeorm": "^4.6.2",