Skip to content
Snippets Groups Projects
Commit 5a9873f7 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-4321 manuell navigation to avoid iss parameter

parent 75acbee7
No related branches found
No related tags found
No related merge requests found
...@@ -11,6 +11,7 @@ import { createApiRootResource } from 'libs/api-root-shared/test/api-root'; ...@@ -11,6 +11,7 @@ import { createApiRootResource } from 'libs/api-root-shared/test/api-root';
import { MockComponent } from 'ng-mocks'; import { MockComponent } from 'ng-mocks';
import { UserProfileButtonContainerComponent } from '../common/user-profile-button-container/user-profile.button-container.component'; import { UserProfileButtonContainerComponent } from '../common/user-profile-button-container/user-profile.button-container.component';
import { PostfachNavigationItemComponent } from '../pages/postfach/postfach-navigation-item/postfach-navigation-item.component'; import { PostfachNavigationItemComponent } from '../pages/postfach/postfach-navigation-item/postfach-navigation-item.component';
import { Router } from '@angular/router';
describe('AppComponent', () => { describe('AppComponent', () => {
let component: AppComponent; let component: AppComponent;
...@@ -25,6 +26,8 @@ describe('AppComponent', () => { ...@@ -25,6 +26,8 @@ describe('AppComponent', () => {
...mock(AuthService), ...mock(AuthService),
login: jest.fn().mockResolvedValue(Promise.resolve()), login: jest.fn().mockResolvedValue(Promise.resolve()),
}; };
const router: Mock<Router> = mock(Router);
const apiRootService: Mock<ApiRootService> = mock(ApiRootService); const apiRootService: Mock<ApiRootService> = mock(ApiRootService);
beforeEach(async () => { beforeEach(async () => {
...@@ -44,6 +47,10 @@ describe('AppComponent', () => { ...@@ -44,6 +47,10 @@ describe('AppComponent', () => {
provide: ApiRootService, provide: ApiRootService,
useValue: apiRootService, useValue: apiRootService,
}, },
{
provide: Router,
useValue: router,
},
], ],
}).compileComponents(); }).compileComponents();
}); });
...@@ -82,6 +89,12 @@ describe('AppComponent', () => { ...@@ -82,6 +89,12 @@ describe('AppComponent', () => {
expect(apiRootService.getApiRoot).toHaveBeenCalled(); expect(apiRootService.getApiRoot).toHaveBeenCalled();
}); });
it('should navigate to default route', () => {
component.doAfterLoggedIn();
expect(router.navigate).toHaveBeenCalledWith(['/']);
});
}); });
}); });
......
...@@ -3,6 +3,7 @@ import { Component, OnInit } from '@angular/core'; ...@@ -3,6 +3,7 @@ import { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { AuthService } from '../common/auth/auth.service'; import { AuthService } from '../common/auth/auth.service';
import { StateResource } from '@alfa-client/tech-shared'; import { StateResource } from '@alfa-client/tech-shared';
import { Router } from '@angular/router';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
...@@ -17,6 +18,7 @@ export class AppComponent implements OnInit { ...@@ -17,6 +18,7 @@ export class AppComponent implements OnInit {
constructor( constructor(
public authService: AuthService, public authService: AuthService,
private apiRootService: ApiRootService, private apiRootService: ApiRootService,
private router: Router,
) {} ) {}
ngOnInit(): void { ngOnInit(): void {
...@@ -25,5 +27,6 @@ export class AppComponent implements OnInit { ...@@ -25,5 +27,6 @@ export class AppComponent implements OnInit {
doAfterLoggedIn(): void { doAfterLoggedIn(): void {
this.apiRootStateResource$ = this.apiRootService.getApiRoot(); this.apiRootStateResource$ = this.apiRootService.getApiRoot();
this.router.navigate(['/']);
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment