In my Angular 4 application, I need to test a method of a Service which at some point it calls a private method of the same service having:
window.location.replace(url);
When the test reach that line, the karma-runner browser gets redirected to the url
which of course is not what I want.
If I try to spy it, I get:
Error: <spyOn> : replace is not declared writable or has no setter
How can I correctly test my method?