title: Write unit test for "ActivationEnd" event from router.events.subscribe in angular
body: <p>I need help in order to write unit tests for <code>router.events.subscribe</code>. I used <code>ActivationEnd</code> to use snapshot object which has properties which I need for my application. No other events from router provide these so I have to stick to this <code>ActivationEnd</code>. But I did not get anything so far as to how to mock this <a href="https://angular.io/api/router/ActivatedRouteSnapshot" rel="nofollow noreferrer">snapshot</a> object.</p>
  <p>Below is my code snippet.</p>
  <pre><code>ngOnInit() {
      this.router.events.subscribe(e =&gt; {
        if (e instanceof ActivationEnd) {
          this.section = e.snapshot.data.title;
          this.dynamicSubNavLabel = e.snapshot.routeConfig?.data?.label;
        }
      });
    }
  </code></pre>
  <p>Can you please help me what could I do to achieve unit tests for this or any alternatives ?</p>
  <p>Regards,
  Alpesh</p>