title: how to unit test router.navigate in angular app
body: <p>I am running unit test for angular app, I  want to unit test if navigation is working correctly in angular app.</p>
  
  <pre><code> if (this.customer.length == 0) {
       this.router.navigate(['/nocustomer']);
   } 
  
  </code></pre>
  
  <p>And the unit test for this</p>
  
  <pre><code> it(`should navigate to nocustomer`,()=&gt;{
     component.customers.length=0;
     //what must be written here to check this
  })
  </code></pre>