akveo / akveo/nebular

AuthModule inheritance and component test

Đang mở
#1,318 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
needs info
Ngôn ngữ chính
TypeScript
Star
8.1k
Fork
1.5k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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 !

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.