Una vez terminada la configuración del testing module podemos hacer testing sobre las rutas y verificar si al momento de crear el evento se dirige a esa ruta y se renderiza ese componente.
app.integration.spec.ts
import { Router, RouterLinkWithHref } from '@angular/router';
import { clickElement, query, queryAllByDirective } from
'src/testing';
it('should there are 7 routerlinks', () => {
const links = queryAllByDirective(fixture, RouterLinkWithHref);
expect(links.length).toEqual(7);
});
it('should render OthersComponent when clicked', fakeAsync(() => {
clickElement(fixture, 'others-link', true);
tick(); // wait while nav...
fixture.detectChanges(); // ngOnInit - OthersComponent
expect(router.url).toEqual('/others');
const element = query(fixture, 'app-others');
expect(element).not.toBeNull();
}));