Answer the question
In order to leave comments, you need to log in
How to test relative router.navigate?
there is this piece of code:
navigateTo() {
this.router.navigate(['.', 'testUrl'], {
relativeTo: this.activatedRoute,
});
}
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
RouterTestingModule.withRoutes([
{
path: 'testUrl',
component: TestComponent
},
]),
]
})
})
it('', async( async () => {
navigateTo();
await fixture.whenStable();
expect(location.path())
.toBe('/testUrl');
}))
this.router.navigate(['.', 'testUrl']);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question