В Angular 2.0.0 я тестирую компонент, использующий Router. Однако я получаю, что "Поставляемые параметры не соответствуют какой-либо сигнатуре целевого вызова". ошибка. В Visual Studio код в spec.ts это новый Router(), который выделен красным цветом
Я очень ценю, если кто-то может сообщить мне, какой будет правильный синтаксис? Заранее спасибо. Мой код выглядит следующим образом:
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();
});
});
Конструктор компонентов
constructor(private componentComm: ComponentComm, private router: Router) {}