title: Getting Error Cannot read property 'extras' of null when i'm running karma test
body: <p>I made a component and I'm using the following code to get some data from the route. When I'm trying ng test I'm getting an error: </p>
  
  <blockquote>
    <p>TypeError: Cannot read property 'extras' of null</p>
  </blockquote>
  
  <p>What I should import on the spec file of this component to read the "state"? On my spec file I added the <code>import { RouterTestingModule } from '@angular/router/testing'</code> but still doesn't work;</p>
  
  <pre><code>const navigation = this.router.getCurrentNavigation();
          const state = navigation.extras.state;
          console.log(state);
  </code></pre>