Angular 2 unit test : Cannot read property 'root' of undefined
<p>My template contain </p>

<pre><code>&lt;a [routerLink]="['/my-profile']" routerLinkActive="active"&gt;
    &lt;i class="icon-user"&gt;&lt;/i&gt;{{ 'MY_PROFILE' | translate }}
&lt;/a&gt;
</code></pre>

<p>the error is because of <code>routerLink</code> and <code>routerLinkActive</code> directives.</p>

<p>Unit test file.</p>

<pre><code>TestBed.configureTestingModule({
    imports: [
        MultilingualModule, CommonModule,
        RouterTestingModule.withRoutes([
            { path: 'my-profile', component: MockComponent },
            { path: 'change-password', component: MockComponent },
        ])
    ],
    schemas: [ NO_ERRORS_SCHEMA ],
    declarations: [TopNavigationBarComponent, TestComponent,MockComponent],
    providers: [
        { provide: LoginService, useValue: MockLoginService },
        { provide: Router, useClass: RouterStub }
    ]
});
</code></pre>