Angular 15.2 introduced RouterTestingHarness, a built-in utility that solves the long-standing pain of testing routed components. Instead of creating brittle ActivatedRoute and Router test doubles, you configure provideRouter and provideLocationMocks in TestBed, create a harness instance, and navigate to a URL to activate the component under test. Assertions are made via the DOM using routeNativeElement, making tests resilient to internal refactorings. A complete example tests a HeroDetailComponent by navigating to a parameterized route and asserting the rendered hero name.
Sort: