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:
TypeError: Cannot read property 'extras' of null
What I should import on the spec file of this component to read the "state"? On my spec file I added the import { RouterTestingModule } from '@angular/router/testing' but still doesn't work;
const navigation = this.router.getCurrentNavigation();
const state = navigation.extras.state;
console.log(state);