mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-3181] Auth Guard - redirect by string url (#3474)
* redirect by string url * auth guard tests fix * revise
This commit is contained in:
committed by
Eugenio Romano
parent
0cf2a35983
commit
c0de0d5087
@@ -68,7 +68,7 @@ describe('AuthGuardService BPM', () => {
|
||||
expect(routerService.navigate).toHaveBeenCalledWith(['/login']);
|
||||
}));
|
||||
|
||||
it('should set redirect navigation commands', async(() => {
|
||||
it('should set redirect url', async(() => {
|
||||
spyOn(authService, 'setRedirect').and.callThrough();
|
||||
spyOn(routerService, 'navigate').and.stub();
|
||||
const router: RouterStateSnapshot = <RouterStateSnapshot> { url: 'some-url' };
|
||||
@@ -76,9 +76,9 @@ describe('AuthGuardService BPM', () => {
|
||||
authGuard.canActivate(null, router);
|
||||
|
||||
expect(authService.setRedirect).toHaveBeenCalledWith({
|
||||
provider: 'BPM', navigation: ['some-url', {}]
|
||||
provider: 'BPM', url: 'some-url'
|
||||
});
|
||||
expect(authService.getRedirect('BPM')).toEqual(['some-url', {}]);
|
||||
expect(authService.getRedirect('BPM')).toEqual('some-url');
|
||||
}));
|
||||
|
||||
it('should set redirect navigation commands with query params', async(() => {
|
||||
@@ -89,9 +89,9 @@ describe('AuthGuardService BPM', () => {
|
||||
authGuard.canActivate(null, router);
|
||||
|
||||
expect(authService.setRedirect).toHaveBeenCalledWith({
|
||||
provider: 'BPM', navigation: ['some-url', {q: '123'}]
|
||||
provider: 'BPM', url: 'some-url;q=123'
|
||||
});
|
||||
expect(authService.getRedirect('BPM')).toEqual(['some-url', { q: '123' }]);
|
||||
expect(authService.getRedirect('BPM')).toEqual('some-url;q=123');
|
||||
}));
|
||||
|
||||
it('should set redirect navigation commands with query params', async(() => {
|
||||
@@ -102,9 +102,9 @@ describe('AuthGuardService BPM', () => {
|
||||
authGuard.canActivate(null, router);
|
||||
|
||||
expect(authService.setRedirect).toHaveBeenCalledWith({
|
||||
provider: 'BPM', navigation: ['/']
|
||||
provider: 'BPM', url: '/'
|
||||
});
|
||||
expect(authService.getRedirect('BPM')).toEqual(['/']);
|
||||
expect(authService.getRedirect('BPM')).toEqual('/');
|
||||
}));
|
||||
|
||||
it('should get redirect url from config if there is one configured', async(() => {
|
||||
@@ -116,7 +116,7 @@ describe('AuthGuardService BPM', () => {
|
||||
authGuard.canActivate(null, router);
|
||||
|
||||
expect(authService.setRedirect).toHaveBeenCalledWith({
|
||||
provider: 'BPM', navigation: ['some-url', {}]
|
||||
provider: 'BPM', url: 'some-url'
|
||||
});
|
||||
expect(routerService.navigate).toHaveBeenCalledWith(['/fakeLoginRoute']);
|
||||
}));
|
||||
|
Reference in New Issue
Block a user