Skip to content

Commit 7a17370

Browse files
[DSC-1917] test fixes
1 parent 693c4cf commit 7a17370

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

src/app/cris-layout/cris-layout-loader/cris-layout-horizontal/cris-layout-navbar/cris-layout-navbar.component.spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ describe('CrisLayoutNavbarComponent', () => {
2121
let component: CrisLayoutNavbarComponent;
2222
let fixture: ComponentFixture<CrisLayoutNavbarComponent>;
2323
let de: DebugElement;
24+
let router: RouterStub;
2425

2526
const windowServiceStub = new HostWindowServiceStub(1000);
2627

@@ -62,13 +63,15 @@ describe('CrisLayoutNavbarComponent', () => {
6263
{ provide: HostWindowService, useValue: windowServiceStub },
6364
{ provide: Router, useClass: RouterStub },
6465
{ provide: ActivatedRoute, useValue: activatedRouteStub },
65-
]
66+
],
6667
})
6768
.compileComponents();
6869
});
6970

7071
beforeEach(() => {
7172
fixture = TestBed.createComponent(CrisLayoutNavbarComponent);
73+
router = TestBed.inject(Router) as unknown as RouterStub;
74+
router.setNavigateReturnValue(true);
7275
component = fixture.componentInstance;
7376
component.item = mockItem;
7477
component.tabs = [];

src/app/shared/mocks/router.mock.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {of as observableOf} from 'rxjs';
2-
import {UrlTree} from '@angular/router';
2+
import { UrlTree} from '@angular/router';
33

44
/**
55
* Mock for [[RouterService]]

src/app/shared/testing/router.stub.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,8 @@ export class RouterStub {
1515
serializeUrl(commands, navExtras = {}) {
1616
return '/testing-url';
1717
}
18+
19+
public setNavigateReturnValue(value = true) {
20+
this.navigate.and.returnValue(Promise.resolve(value));
21+
}
1822
}

0 commit comments

Comments
 (0)