11import { ComponentFixture , TestBed , waitForAsync } from '@angular/core/testing' ;
22import { MatDialogRef } from '@angular/material/dialog' ;
33import { MatIconModule } from '@angular/material/icon' ;
4+ import { BrowserAnimationsModule } from '@angular/platform-browser/animations' ;
45import { RouterTestingModule } from '@angular/router/testing' ;
6+ import { HealthEndpointSystem , MockHealth } from '@dasch-swiss/dsp-js' ;
7+ import { of } from 'rxjs' ;
58import { DspApiConnectionToken } from '../declarations/dsp-api-tokens' ;
69import { ErrorComponent } from './error.component' ;
710
811describe ( 'ErrorComponent' , ( ) => {
912 let component : ErrorComponent ;
1013 let fixture : ComponentFixture < ErrorComponent > ;
1114
12- const systemEndpointSpyObj = {
13- health : {
15+ const apiEndpointSpyObj = {
16+ system : {
1417 healthEndpoint : jasmine . createSpyObj ( 'healthEndpoint' , [ 'getHealthStatus' ] )
1518 }
1619 } ;
@@ -19,6 +22,7 @@ describe('ErrorComponent', () => {
1922 TestBed . configureTestingModule ( {
2023 declarations : [ ErrorComponent ] ,
2124 imports : [
25+ BrowserAnimationsModule ,
2226 MatIconModule ,
2327 RouterTestingModule
2428 ] ,
@@ -29,7 +33,7 @@ describe('ErrorComponent', () => {
2933 } ,
3034 {
3135 provide : DspApiConnectionToken ,
32- useValue : systemEndpointSpyObj
36+ useValue : apiEndpointSpyObj
3337 } ,
3438 ]
3539 } )
@@ -40,6 +44,14 @@ describe('ErrorComponent', () => {
4044 fixture = TestBed . createComponent ( ErrorComponent ) ;
4145 component = fixture . componentInstance ;
4246 fixture . detectChanges ( ) ;
47+
48+ const dspConnSpy = TestBed . inject ( DspApiConnectionToken ) ;
49+ ( dspConnSpy . system . healthEndpoint as jasmine . SpyObj < HealthEndpointSystem > ) . getHealthStatus . and . callFake (
50+ ( ) => {
51+ const health = MockHealth . mockRunning ( ) ;
52+ return of ( health ) ;
53+ }
54+ ) ;
4355 } ) ;
4456
4557 it ( 'should create' , ( ) => {
0 commit comments