I want to mock window.location.origin
in my unit test.
I have tried to edit it directly. but it said that the location object is readonly.
I can't find other way.Could you help me?
e,g
function login(){
if(window.location.origin) {
window.location.href = 'https://stackoverflow.com';
}}
How can I test the login()
function?