How do I Mock RouterStateSnapshot for a Router Guard Jasmine test
问题 I have a simple router guard and I am trying to test the canActivate( route: ActivatedRouteSnapshot, state: RouterStateSnapshot ) . I can create the ActivatedRouteSnapshot like this new ActivatedRouteSnapshot() but I cannot figure out how to create a mocked RouterStateSnapshot . Per the code I tried... let createEmptyStateSnapshot = function( urlTree: UrlTree, rootComponent: Type<any>){ const emptyParams = {}; const emptyData = {}; const emptyQueryParams = {}; const fragment = ''; const