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
Branches
Tags
No related merge requests found
......@@ -11,6 +11,7 @@ import { createApiRootResource } from 'libs/api-root-shared/test/api-root';
import { MockComponent } from 'ng-mocks';
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 { Router } from '@angular/router';
describe('AppComponent', () => {
let component: AppComponent;
......@@ -25,6 +26,8 @@ describe('AppComponent', () => {
...mock(AuthService),
login: jest.fn().mockResolvedValue(Promise.resolve()),
};
const router: Mock<Router> = mock(Router);
const apiRootService: Mock<ApiRootService> = mock(ApiRootService);
beforeEach(async () => {
......@@ -44,6 +47,10 @@ describe('AppComponent', () => {
provide: ApiRootService,
useValue: apiRootService,
},
{
provide: Router,
useValue: router,
},
],
}).compileComponents();
});
......@@ -82,6 +89,12 @@ describe('AppComponent', () => {
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';
import { Observable } from 'rxjs';
import { AuthService } from '../common/auth/auth.service';
import { StateResource } from '@alfa-client/tech-shared';
import { Router } from '@angular/router';
@Component({
selector: 'app-root',
......@@ -17,6 +18,7 @@ export class AppComponent implements OnInit {
constructor(
public authService: AuthService,
private apiRootService: ApiRootService,
private router: Router,
) {}
ngOnInit(): void {
......@@ -25,5 +27,6 @@ export class AppComponent implements OnInit {
doAfterLoggedIn(): void {
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