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?
Thanks to jonrsharpe advise i found the solution. The solution was to mock navigateByUrl this way:
navigateByUrl: () => {
return {
then: () => {}
}
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments