1 spec, 1 failure Spec List | Failures OverviewComponent should create Failed: Can't resolve all parameters for Router: (?, ?, ?, ?, ?, ?, ?, ?). Error: Can't resolve all parameters for Router: (?, ?, ?, ?, ?, ?, ?, ?). at syntaxError (http://localhost:9876/karma_webpack/webpack:/node_modules/@angular/compiler/fesm5/compiler.js:215:1) at CompileMetadataResolver._getDependenciesMetadata (http://localhost:9876/karma_webpack/webpack:/node_modules/@angular/compiler/fesm5/compiler.js:10807:1) at CompileMetadataResolver._getTypeMetadata (http://localhost:9876/karma_webpack/webpack:/node_modules/@angular/compiler/fesm5/compiler.js:10700:1) at CompileMetadataResolver._getInjectableTypeMetadata (http://localhost:9876/karma_webpack/webpack:/node_modules/@angular/compiler/fesm5/compiler.js:10922:1) at CompileMetadataResolver.getProviderMetadata (http://localhost:9876/karma_webpack/webpack:/node_modules/@angular/compiler/fesm5/compiler.js:10931:1) at http://localhost:9876/karma_webpack/webpack:/node_modules/@angular/compiler/fesm5/compiler.js:10869:1 at Array.forEach () at CompileMetadataResolver._getProvidersMetadata (http://localhost:9876/karma_webpack/webpack:/node_modules/@angular/compiler/fesm5/compiler.js:10829:1) at CompileMetadataResolver.getNgModuleMetadata (http://localhost:9876/karma_webpack/webpack:/node_modules/@angular/compiler/fesm5/compiler.js:10548:1) at JitCompiler._loadModules (http://localhost:9876/karma_webpack/webpack:/node_modules/@angular/compiler/fesm5/compiler.js:22567:1)
============================================
describe('OverviewComponent', () => {
let component: OverviewComponent;
let fixture: ComponentFixture<OverviewComponent>;
let router : Router
const fakeActivatedRoute = {
snapshot: { data: { } }
} as ActivatedRoute;
beforeEach(async(() => {
TestBed.configureTestingModule({
imports:[
SharedModule,
FlexLayoutModule,
// RouterModule.forRoot(routes),
RouterTestingModule
],
declarations: [ OverviewComponent,
FooterComponent,
LoginComponent,
ChangePasswordComponent,
ForgotPasswordComponent,
AppComponent],
providers:[
HttpClient,
HttpHandler,
DataService,
NgxSpinnerService,
Router,
RouterModule,
EmitterService,
{provide: ActivatedRoute,
useValue: fakeActivatedRoute}
]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(OverviewComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
should create
test for OverviewComponent. It seems that you are not providing Router – Dumbo