Detecting Route state changes can be done by subscribing to the router and listening to the events being emitted. In the example below you will see all the router events that you can listen to in Angular 5.
Install the latest version of Angular Material + Animations using npm to get started.
npm i --save @angular/material @angular/cdk
npm i --save @angular/animations
To perform unit testing on a component that makes use of a service, that returns a promise, we can use fakeAsync() and spy() methods from Angular’s unit testing package.