Reputation: 454
My problem is pretty simple, I use navigateByUrl() then then() in this way:
this.router
.navigateByUrl(PAGE1, {
skipLocationChange: true
})
.then(() => {
this.router.navigate([PAGE2]);
});
and I mock navigate, navigateByUrl and then this way:
const mockRouter = {
navigate: () => {},
navigateByUrl(url: string) { return url; },
then: () => {}
};
It works well for navigate and navigateByUrl but it doesn't work for then and I don't know how to mock this function. How can I proceed?
Upvotes: 0
Views: 1575
Reputation: 454
Thanks to jonrsharpe advise i found the solution. The solution was to mock navigateByUrl this way:
navigateByUrl: () => {
return {
then: () => {}
}
}
Upvotes: 2