Angular 2 v.2.0.0 - TS + karma + jasmine.
I would test this canActivate function:
public canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> {
return this.serverThisLogin.checkAuth().map((e: boolean) => {
if (e) {
return true;
}
}). catch(() => {
this.router.navigate(["/login"]);
return Observable.of(false);
});
}
How implement this? When i add this construction
beforeEach(() => {
canAct = new CanActivate(null, null);
});
i've got this error 'CanActivate' only refers to a type, but is being used as a value here.
Aucun commentaire:
Enregistrer un commentaire