-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Closed
Description
Note: for support questions, please use one of these channels: Chat: AngularClass.slack or Twitter: @AngularClass
- I'm submitting a ...
[x ] bug report
I am getting following error when running a unit test:
Error: Template parse errors:
'router-outlet' is not a known element:
1. If 'router-outlet' is an Angular component, then verify that it is part of this module.
My unit test code:
import {
inject,
TestBed
} from '@angular/core/testing';
// Load the implementations that should be tested
import { App } from './app.component';
import { AppState } from './app.service';
import { Renderer } from '@angular/core';
import { Router, RouterOutlet } from "@angular/router";
class MockRouter { public navigate() {}; }
describe('App', () => {
// provide our implementations or mocks to the dependency injector
beforeEach(() => TestBed.configureTestingModule({
declarations: [ App ],
providers: [
AppState,
Renderer,
{provide: Router, useClass: MockRouter },
RouterOutlet
]}));
it('should have a url', inject([ App ], (app: App) => {
expect(app.name).toEqual('test');
}));
});
My app.html has router outlet:
<router-outlet></router-outlet>
I tried removing RouterOutlet as well in unit test and it did not work. Has anyone experienced this issue and help me with the solution?
desprit
Metadata
Metadata
Assignees
Labels
No labels