akveo / akveo/nebular

AuthModule inheritance and component test

Aberta
#1,318 3 comentários 0 reações 0 responsáveis Ver no GitHub
needs info
Linguagem predominante
TypeScript
Estrelas
8.1k
Forks
1.5k
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

Hi,

### Issue type

**I'm submitting a ...**

* [X] bug report
* [ ] feature request

### Issue description

I started to customize the auth components. For example, I'm extending the NbLoginComponent like that :

```typescript
export class LoginComponent extends NbLoginComponent {

}
```

The fact is I'm trying to test my newly created component and the test fails. I started to add dependencies like those one :

```typescript
TestBed.configureTestingModule({
imports: [ AuthModule ], // My module containing all extended components
providers: [
NbAuthService,
NbTokenService,
NbAuthTokenParceler,
{ provide: NbTokenStorage, useClass: NbTokenLocalStorage }
]
})
```

At this point, I'm encountering this error :

```
Error: StaticInjectorError(DynamicTestModule)[NbAuthTokenParceler -> InjectionToken Nebular Auth Options]:
StaticInjectorError(Platform: core)[NbAuthTokenParceler -> InjectionToken Nebular Auth Options]:
NullInjectorError: No provider for InjectionToken Nebular Auth Options!
```

This error is generated by this default test :

```typescript
it('should create', () => {
expect(component).toBeTruthy();
});
```

I searched through issues and repositories but I didn't find any component test. Is there a way to correctly test a component extending as Nebular component ?

Thank you !

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.