I am trying to do a test that needs NbDialogService as a provider
providers: [
{ provide: NbDialogService, useClass: ClinicViewPopupComponent },
],
But this creates the error in the karma-jasmine browser:
NullInjectorError: StaticInjectorError(DynamicTestModule)[NbDialogService -> NbDialogRef]:
StaticInjectorError(Platform: core)[NbDialogService -> NbDialogRef]:
NullInjectorError: No provider for NbDialogRef!
So I updated the providers to:
providers: [
{ provide: NbDialogService, useClass: ClinicViewPopupComponent },
{ provide: NbDialogRef, useClass: ClinicViewPopupComponent }
],
And this returns an error:
Failed: Provider parse errors:
Cannot instantiate cyclic dependency! NbDialogRef ("[ERROR ->]"): in NgModule DynamicTestModule in ./DynamicTestModule@-1:-1
Switching useClass to useValue in { provide: NbDialogService, useValue: {} }, returns the same error as above
Switching useClass to useValue in { provide: NbDialogRef, useValue: {} }, returns UnhandledRejection