akveo / akveo/nebular

Testing Nebular auth inherited component

Open
#2,462 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
8.1k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

I'm using Nebular (akveo/nebular) Authmodule in my project and it's working fine, but when I wanted to test my components that are extended from Nebular components I got this error :

`TypeError: There is no Auth Strategy registered under 'email' name
`
here and example of my test class

```
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { LogoutComponent } from './logout.component';
import { NbAuthModule } from '@nebular/auth';
import { RouterTestingModule } from '@angular/router/testing';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { CommonModule } from '@angular/common';

describe('LogoutComponent', () => {
let component: LogoutComponent;
let fixture: ComponentFixture;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [LogoutComponent],
imports: [
FormsModule,
ReactiveFormsModule,
CommonModule,
NbAuthModule.forRoot(),
RouterTestingModule,
],
}).compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(LogoutComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
```
I tried to passe the stratergy in the module declaration like this

```
.....
NbAuthModule.forRoot({
strategies: [
NbPasswordAuthStrategy.setup({
name: 'email',
}),
],
}),
.....
```
But I got an other error :(.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.