mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
Create Image from PR if request (#6705)
* [create docker image] fix fix e2e [MNT-21636] Use URLTree for redirect (#6691) * use URLTree for redirect * use always urltree * fix e2e * fix * fix * Update release-docker.sh * update js-api * update lock
This commit is contained in:
@@ -66,7 +66,8 @@ describe('AuthGuardService', () => {
|
||||
spyOn(router, 'navigateByUrl');
|
||||
spyOn(authService, 'isLoggedIn').and.returnValue(false);
|
||||
|
||||
expect(await authGuard.canActivate(null, state)).toEqual(router.parseUrl('/login?redirectUrl=some-url'));
|
||||
expect(await authGuard.canActivate(null, state)).toBeFalsy();
|
||||
expect(router.navigateByUrl).toHaveBeenCalled();
|
||||
}));
|
||||
|
||||
it('if the alfresco js api is configured with withCredentials true should canActivate be true', async(async () => {
|
||||
@@ -96,7 +97,8 @@ describe('AuthGuardService', () => {
|
||||
spyOn(authService, 'isOauth').and.returnValue(true);
|
||||
appConfigService.config.oauth2.silentLogin = false;
|
||||
|
||||
expect(await authGuard.canActivate(null, state)).toEqual(router.parseUrl('/login'));
|
||||
expect(await authGuard.canActivate(null, state)).toBeFalsy();
|
||||
expect(router.navigateByUrl).toHaveBeenCalled();
|
||||
}));
|
||||
|
||||
it('should redirect url if the User is NOT logged in and isOAuth but no silentLogin configured', async(async () => {
|
||||
@@ -105,7 +107,8 @@ describe('AuthGuardService', () => {
|
||||
spyOn(authService, 'isOauth').and.returnValue(true);
|
||||
appConfigService.config.oauth2.silentLogin = undefined;
|
||||
|
||||
expect(await authGuard.canActivate(null, state)).toEqual(router.parseUrl('/login'));
|
||||
expect(await authGuard.canActivate(null, state)).toBeFalsy();
|
||||
expect(router.navigateByUrl).toHaveBeenCalled();
|
||||
}));
|
||||
|
||||
it('should NOT redirect url if the User is NOT logged in and isOAuth but with silentLogin configured', async(async () => {
|
||||
@@ -125,7 +128,12 @@ describe('AuthGuardService', () => {
|
||||
spyOn(router, 'navigateByUrl');
|
||||
spyOn(authService, 'setRedirect');
|
||||
|
||||
expect(await authGuard.canActivate(null, state)).toEqual(router.parseUrl('/login?redirectUrl=some-url'));
|
||||
await authGuard.canActivate(null, state);
|
||||
|
||||
expect(authService.setRedirect).toHaveBeenCalledWith({
|
||||
provider: 'ALL', url: 'some-url'
|
||||
});
|
||||
expect(router.navigateByUrl).toHaveBeenCalledWith(router.parseUrl('/login?redirectUrl=some-url'));
|
||||
}));
|
||||
|
||||
it('should set redirect url with query params', async(async () => {
|
||||
@@ -136,7 +144,12 @@ describe('AuthGuardService', () => {
|
||||
spyOn(router, 'navigateByUrl');
|
||||
spyOn(authService, 'setRedirect');
|
||||
|
||||
expect(await authGuard.canActivate(null, state)).toEqual(router.parseUrl('/login?redirectUrl=some-url;q=query'));
|
||||
await authGuard.canActivate(null, state);
|
||||
|
||||
expect(authService.setRedirect).toHaveBeenCalledWith({
|
||||
provider: 'ALL', url: 'some-url;q=query'
|
||||
});
|
||||
expect(router.navigateByUrl).toHaveBeenCalledWith(router.parseUrl('/login?redirectUrl=some-url;q=query'));
|
||||
}));
|
||||
|
||||
it('should get redirect url from config if there is one configured', async(async () => {
|
||||
@@ -146,7 +159,12 @@ describe('AuthGuardService', () => {
|
||||
spyOn(router, 'navigateByUrl');
|
||||
spyOn(authService, 'setRedirect');
|
||||
|
||||
expect(await authGuard.canActivate(null, state)).toEqual(router.parseUrl('/fakeLoginRoute?redirectUrl=some-url'));
|
||||
await authGuard.canActivate(null, state);
|
||||
|
||||
expect(authService.setRedirect).toHaveBeenCalledWith({
|
||||
provider: 'ALL', url: 'some-url'
|
||||
});
|
||||
expect(router.navigateByUrl).toHaveBeenCalledWith(router.parseUrl('/fakeLoginRoute?redirectUrl=some-url'));
|
||||
}));
|
||||
|
||||
it('should pass actual redirect when no state segments exists', async(async () => {
|
||||
|
Reference in New Issue
Block a user