1

Can anyone help me with this.. New to unit test.. Thanks Facing issues with Assync data

export class ClassGuard implements CanActivate {         
      isLoaded: boolean = false;  
      constructor(private router: Router, private store: Store<fromRoot.State>) {}

      waitForUserToLoad(): Observable<boolean> {    
        return this.store.pipe(select(fromUser.sGetUserIsLoaded));   
      }

      canActivate(): Observable<boolean> {    
        return this.waitForUserToLoad().map(loaded => {   
          if (loaded) {   
            return true;   
          } else {   
            this.router.navigate(['']);   
          }   
        });   
      }   
    }  

Can't explain much as new to this.. I've looked into and considered many jest unit tests, but have been unable to find a suitable option to remain fully understanding about this.

bubbles
  • 2,597
  • 1
  • 15
  • 40
Beginner
  • 11
  • 2

0 Answers0