#Can not get Repository when run test

17 messages · Page 1 of 1 (latest)

tulip pond
#

I have two connection in my app, when i run e2e test i try to get the repo from one connection but i get something like a circular dependency!

mental valley
#

Are you getting a particular error?

subtle vine
#

Also, how did you registered that entity?

tulip pond
tulip pond
#

The app it self work fine, but the test does not!

#

:((

subtle vine
tulip pond
#

You mean this one?

subtle vine
#

btw idk about that buildAndStart() and AppBuilder class

tulip pond
mental valley
#

Ah, it's a named connection..app.get(getRepositoryToken (Entity, databaseName))

tulip pond
#
    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();
  }```
tulip pond
#

any idea guys

#

i am dead stuck