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