#Can not get Repository when run test
17 messages · Page 1 of 1 (latest)
Are you getting a particular error?
Also, how did you registered that entity?
i get an undefined error when try to use the repo
TypeOrm.ForFeature
The app it self work fine, but the test does not!
:((
can you show us that code?
You mean this one?
btw idk about that buildAndStart() and AppBuilder class
Ah, it's a named connection..app.get(getRepositoryToken (Entity, databaseName))
here
appModuleMetadata: ModuleMetadata = {
imports: [],
}
): Promise<INestApplication> {
const { imports: customImportModule, ...rest } = appModuleMetadata;
const moduleRef = Test.createTestingModule({
imports: [AppModule],
})
.overrideProvider(SnsEventPublisher)
.useValue({
emit: () => {},
});
this.providersToOverride.forEach((provider) => {
moduleRef.overrideProvider(provider.name).useValue(provider.value);
});
return (await this.buildApp(moduleRef)).init();
}```