DEV Community

Discussion on: Testing Angular route guards with the RouterTestingModule

Collapse
 
omeryousaf profile image
Omer Yousaf

Lars, in your tests you just check whether the navigation went through or was denied, right ?

expect(canNavigate).toBeFalse();
Enter fullscreen mode Exit fullscreen mode

So, was triggering change detection still necessary ?

Thread Thread
 
layzee profile image
Lars Gyrup Brink Nielsen Playful Programming Angular

If we want to avoid warnings, yes. The warning will say that a scheduled event happened outside of the NgZone.

Thread Thread
 
layzee profile image
Lars Gyrup Brink Nielsen Playful Programming Angular

We also want to make sure that changes are stable as they would be in an app.