fixing tests. make we can mock FastenApiService in tests.
This commit is contained in:
parent
db9f289b54
commit
d8cc91d1d0
|
@ -1,14 +1,22 @@
|
||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
import { ReportMedicalHistoryEditorComponent } from './report-medical-history-editor.component';
|
import { ReportMedicalHistoryEditorComponent } from './report-medical-history-editor.component';
|
||||||
|
import {NgbActiveModal, NgbModalModule} from '@ng-bootstrap/ng-bootstrap';
|
||||||
|
import {FastenApiService} from '../../services/fasten-api.service';
|
||||||
|
import {HttpClient} from '@angular/common/http';
|
||||||
|
|
||||||
describe('ReportEditorRelatedComponent', () => {
|
describe('ReportMedicalHistoryEditorComponent', () => {
|
||||||
let component: ReportMedicalHistoryEditorComponent;
|
let component: ReportMedicalHistoryEditorComponent;
|
||||||
let fixture: ComponentFixture<ReportMedicalHistoryEditorComponent>;
|
let fixture: ComponentFixture<ReportMedicalHistoryEditorComponent>;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
declarations: [ ReportMedicalHistoryEditorComponent ]
|
declarations: [ ReportMedicalHistoryEditorComponent ],
|
||||||
|
imports: [],
|
||||||
|
providers: [NgbActiveModal, {
|
||||||
|
provide: FastenApiService,
|
||||||
|
useValue: jasmine.createSpyObj('FastenApiService', ['createResourceComposition'])
|
||||||
|
}]
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,30 @@
|
||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
import { MedicalHistoryComponent } from './medical-history.component';
|
import { MedicalHistoryComponent } from './medical-history.component';
|
||||||
|
import {FastenApiService} from '../../services/fasten-api.service';
|
||||||
|
import {HttpClient} from '@angular/common/http';
|
||||||
|
import {NgbModal, NgbModalModule} from '@ng-bootstrap/ng-bootstrap';
|
||||||
|
import {of} from 'rxjs';
|
||||||
|
|
||||||
describe('MedicalHistoryComponent', () => {
|
describe('MedicalHistoryComponent', () => {
|
||||||
let component: MedicalHistoryComponent;
|
let component: MedicalHistoryComponent;
|
||||||
let fixture: ComponentFixture<MedicalHistoryComponent>;
|
let fixture: ComponentFixture<MedicalHistoryComponent>;
|
||||||
|
let mockedFastenApiService
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
|
|
||||||
|
// httpClientSpy = jasmine.createSpyObj('HttpClient', ['get']);
|
||||||
|
// fastenApiService = new FastenApiService(httpClientSpy, );
|
||||||
|
mockedFastenApiService = jasmine.createSpyObj('FastenApiService', ['getResourceGraph'])
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
declarations: [ MedicalHistoryComponent ]
|
declarations: [ MedicalHistoryComponent ],
|
||||||
|
providers: [{
|
||||||
|
provide: FastenApiService,
|
||||||
|
useValue: mockedFastenApiService
|
||||||
|
}, NgbModalModule]
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
|
mockedFastenApiService.getResourceGraph.and.returnValue(of({"Condition":[],"Encounter":[]}));
|
||||||
|
|
||||||
fixture = TestBed.createComponent(MedicalHistoryComponent);
|
fixture = TestBed.createComponent(MedicalHistoryComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
|
|
Loading…
Reference in New Issue