mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-5009] close all the dialogs after false canActivate event (#5312)
* close all the dialogs after false canActivate event * Update auth-guard-bpm.service.spec.ts * sso fix * fix lint
This commit is contained in:
committed by
Denys Vuika
parent
d7e56b641e
commit
9c83c35e61
@@ -21,6 +21,7 @@ import { setupTestBed } from '../testing/setupTestBed';
|
||||
import { CoreTestingModule } from '../testing/core.testing.module';
|
||||
import { AuthGuardSsoRoleService } from './auth-guard-sso-role.service';
|
||||
import { JwtHelperService } from './jwt-helper.service';
|
||||
import { MatDialog } from '@angular/material';
|
||||
|
||||
describe('Auth Guard SSO role service', () => {
|
||||
|
||||
@@ -164,4 +165,21 @@ describe('Auth Guard SSO role service', () => {
|
||||
|
||||
expect(authGuard.canActivate(route)).toBeFalsy();
|
||||
});
|
||||
|
||||
it('Should canActivate be false hasRealm is true and hasClientRole is false', () => {
|
||||
const materialDialog = TestBed.get(MatDialog);
|
||||
|
||||
spyOn(materialDialog, 'closeAll');
|
||||
|
||||
const route: ActivatedRouteSnapshot = new ActivatedRouteSnapshot();
|
||||
spyOn(jwtHelperService, 'hasRealmRoles').and.returnValue(true);
|
||||
spyOn(jwtHelperService, 'hasRealmRolesForClientRole').and.returnValue(false);
|
||||
|
||||
route.params = { appName: 'fakeapp' };
|
||||
route.data = { 'clientRoles': ['appName'], 'roles': ['role1', 'role2'] };
|
||||
|
||||
expect(authGuard.canActivate(route)).toBeFalsy();
|
||||
expect(materialDialog.closeAll).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
});
|
||||
|
Reference in New Issue
Block a user