Angular 7: Test Guard
I will show you how you can test a guard. I'd like to test the code below:
We have in this code mainly 3 cases to test:
We have in this code mainly 3 cases to test:
- The logged in user has the required role. He should be able to access the restricted area.
- The logged in user has NOT the required role. He should not be able to access the restricted area. The user is redirected to the home page.
- The user is NOT logged in. He should not be able to access the restricted area. The user is redirected to the login page.
Comments
Post a Comment