In Angular 2.0.0, I am unit testing a component that uses Router. However I get the 'Supplied parameters do not match any signature of call target.' error. In Visual studio code in spec.ts it is the new Router() that is highlighted in red
What is the correct syntax?
My code as follows:
spec.ts
import { TestBed, async } from '@angular/core/testing';
import { NavToolComponent } from './nav-tool.component';
import { ComponentComm } from '../../shared/component-comm.service';
import { Router } from '@angular/router';
describe('Component: NavTool', () => {
it('should create an instance', () => {
let component = new NavToolComponent( new ComponentComm(), new Router());
expect(component).toBeTruthy();
});
});
Component constructor
constructor(private componentComm: ComponentComm, private router: Router) {}
router = TestBed.get(Router)
and save my router to a variable alongside fixture, instead of casting component to any, as recommended in angular.io/guide/testing#testbedget – Eyeleteer