How to test Angular AuthGuard – examples for the CanActivate interface
After adding the routing guards to your project, you need to unit test their methods to make sure that an unauthenticated user is correctly redirected to a “/login” path. Check out a sample test configuration and test cases that verify if the router always redirects users unmistakably.