/
error.component.spec.ts
50 lines (44 loc) · 1.56 KB
/
error.component.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { MatDialogRef } from '@angular/material/dialog';
import { MatIconModule } from '@angular/material/icon';
import { RouterTestingModule } from '@angular/router/testing';
import { DspApiConnectionToken } from '../declarations/dsp-api-tokens';
import { ErrorComponent } from './error.component';
describe('ErrorComponent', () => {
let component: ErrorComponent;
let fixture: ComponentFixture<ErrorComponent>;
const systemEndpointSpyObj = {
health: {
healthEndpoint: jasmine.createSpyObj('healthEndpoint', ['getHealthStatus'])
}
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ErrorComponent],
imports: [
MatIconModule,
RouterTestingModule
],
providers: [
{
provide: MatDialogRef,
useValue: {}
},
{
provide: DspApiConnectionToken,
useValue: systemEndpointSpyObj
},
]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ErrorComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
// todo: check the input, check the switch (display 403 template if we get a 403 error, same for 404)
});