title: How do I Mock RouterStateSnapshot for a Router Guard Jasmine test
body: <p>I have a simple router guard and I am trying to test the <code>canActivate( route: ActivatedRouteSnapshot, state: RouterStateSnapshot )</code>. I can create the ActivatedRouteSnapshot like this <code>new ActivatedRouteSnapshot()</code> but I cannot figure out how to create a mocked <code>RouterStateSnapshot</code>.</p>
  
  <p>Per the code I tried...</p>
  
  <pre><code>let createEmptyStateSnapshot = function(
      urlTree: UrlTree, rootComponent: Type&lt;any&gt;){
      const emptyParams = {};
      const emptyData = {};
      const emptyQueryParams = {};
      const fragment = '';
      const activated = new ActivatedRouteSnapshot();
      const state = new RouterStateSnapshot(new TreeNode&lt;ActivatedRouteSnapshot&gt;(activated, []));
      return {
          state: state,
          activated: activated
      }
  }
  </code></pre>
  
  <p>But <code>import {TreeNode} from "@angular/router/src/utils/tree";</code> seems to need to be transpiled or something because I get...</p>
  
  <blockquote>
    <p>Uncaught SyntaxError: Unexpected token export
      at webpack:///~/@angular/router/src/utils/tree.js:8:0 &lt;- test.bundle.ts:72431</p>
  </blockquote>