Router Reload testing

Viewed 22

how to test this piece of code in angular karma ?

this.router.navigate(['test']).then(()=> {window.location.reload()})

My test :

let routeSpy = {navigate: jasmine.createSpy('navigate)}
routeSpy.navigate(['test']).then(() => {window.location.reload()})

Error :

Cannot read property of undefined (reading then )
0 Answers
Related