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 { 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 fixture: ComponentFixture<ReportMedicalHistoryEditorComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ ReportMedicalHistoryEditorComponent ]
|
||||
declarations: [ ReportMedicalHistoryEditorComponent ],
|
||||
imports: [],
|
||||
providers: [NgbActiveModal, {
|
||||
provide: FastenApiService,
|
||||
useValue: jasmine.createSpyObj('FastenApiService', ['createResourceComposition'])
|
||||
}]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
|
|
|
@ -1,16 +1,30 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
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', () => {
|
||||
let component: MedicalHistoryComponent;
|
||||
let fixture: ComponentFixture<MedicalHistoryComponent>;
|
||||
let mockedFastenApiService
|
||||
|
||||
beforeEach(async () => {
|
||||
|
||||
// httpClientSpy = jasmine.createSpyObj('HttpClient', ['get']);
|
||||
// fastenApiService = new FastenApiService(httpClientSpy, );
|
||||
mockedFastenApiService = jasmine.createSpyObj('FastenApiService', ['getResourceGraph'])
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ MedicalHistoryComponent ]
|
||||
declarations: [ MedicalHistoryComponent ],
|
||||
providers: [{
|
||||
provide: FastenApiService,
|
||||
useValue: mockedFastenApiService
|
||||
}, NgbModalModule]
|
||||
})
|
||||
.compileComponents();
|
||||
mockedFastenApiService.getResourceGraph.and.returnValue(of({"Condition":[],"Encounter":[]}));
|
||||
|
||||
fixture = TestBed.createComponent(MedicalHistoryComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
|
Loading…
Reference in New Issue