I'm trying to mock router in my test. I followed the instruction step by step given in this answer but I still get error
'Cannot read property 'outlets' of null'
This is what I tried:
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [RouterTestingModule.withRoutes([
{path:'profile/login',component:ProfileLoginComponent}]
)],
declarations: [ ProfileLoginComponent ],
providers: [
FormBuilder,AuthModel
],
schemas: [NO_ERRORS_SCHEMA]
})
.overrideComponent(ProfileLoginComponent, {
set: {
providers: [
{provide: AuthModel, useClass: MockAuthModel}
],
}
})
.compileComponents();
}));
If I remove the code with routerLink and routerLinkActive in the template, then the test cases work perfectly. Where have I gone wrong?