fixing tests (#109)

This commit is contained in:
Jason Kulatunga 2023-03-16 23:17:34 -07:00 committed by GitHub
parent f6fb99002e
commit 003e713ccf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 40 additions and 5 deletions

View File

@ -53,14 +53,14 @@ export class PractitionerComponent implements OnInit, FhirResourceComponentInter
// enabled: !!this.displayModel.telecom,
// },
];
for(let idCoding of this.displayModel.identifier){
for(let idCoding of (this.displayModel?.identifier || [])){
this.tableData.push({
label: `Identifier (${idCoding.system})`,
data: idCoding.display || idCoding.value,
enabled: true,
})
}
for(let telecom of this.displayModel.telecom){
for(let telecom of (this.displayModel?.telecom || [])){
this.tableData.push({
label: telecom.system,
data: telecom.value,

View File

@ -1,6 +1,10 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { NlmTypeaheadComponent } from './nlm-typeahead.component';
import {HttpClientTestingModule} from '@angular/common/http/testing';
import {NgbActiveModal, NgbCollapseModule, NgbTypeaheadModule} from '@ng-bootstrap/ng-bootstrap';
import {FastenApiService} from '../../services/fasten-api.service';
import {NlmClinicalTableSearchService} from '../../services/nlm-clinical-table-search.service';
describe('NlmTypeaheadComponent', () => {
let component: NlmTypeaheadComponent;
@ -8,7 +12,27 @@ describe('NlmTypeaheadComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ NlmTypeaheadComponent ]
imports: [
NgbTypeaheadModule
],
declarations: [ NlmTypeaheadComponent ],
providers: [{
provide: NlmClinicalTableSearchService,
useValue: jasmine.createSpyObj('NlmClinicalTableSearchService', [
'searchAllergy',
'searchAllergyReaction',
'searchCondition',
'searchCountries',
'searchMedicalContactIndividualProfession',
'searchMedicalContactIndividual',
'searchMedicalContactOrganization',
'searchMedicalContactOrganizationType',
'searchMedication',
'searchMedicationWhyStopped',
'searchProcedure',
'searchVaccine',
])
}]
})
.compileComponents();

View File

@ -6,7 +6,7 @@
{{conditionDisplayModel?.sort_title ? conditionDisplayModel?.sort_title : (conditionGroup | fhirPath: "Condition.code.text.first()":"Condition.code.coding.display.first()")}}
</div>
<div class="col-6">
{{conditionDisplayModel?.onset_datetime | date }} <span *ngIf="conditionDisplayModel.abatement_datetime">- {{conditionDisplayModel.abatement_datetime | date}}</span>
{{conditionDisplayModel?.onset_datetime | date }} <span *ngIf="conditionDisplayModel?.abatement_datetime">- {{conditionDisplayModel.abatement_datetime | date}}</span>
</div>
</div>
</div><!-- card-header -->

View File

@ -66,6 +66,10 @@ export class ReportMedicalHistoryConditionComponent implements OnInit {
constructor() { }
ngOnInit(): void {
if(!this.conditionGroup){
return
}
//add resources to the lookup table, ensure uniqueness.
this.conditionDisplayModel = this.recExtractResources(this.conditionGroup)

View File

@ -1,6 +1,9 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ResourceCreatorComponent } from './resource-creator.component';
import {HttpClientTestingModule} from '@angular/common/http/testing';
import {RouterTestingModule} from '@angular/router/testing';
import {NgbCollapseModule, NgbDatepickerModule} from '@ng-bootstrap/ng-bootstrap';
describe('ResourceCreatorComponent', () => {
let component: ResourceCreatorComponent;
@ -8,6 +11,7 @@ describe('ResourceCreatorComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [HttpClientTestingModule, RouterTestingModule, NgbDatepickerModule, NgbCollapseModule],
declarations: [ ResourceCreatorComponent ]
})
.compileComponents();

View File

@ -1,12 +1,15 @@
import { TestBed } from '@angular/core/testing';
import { NlmClinicalTableSearchService } from './nlm-clinical-table-search.service';
import {HttpClientTestingModule} from '@angular/common/http/testing';
describe('NlmClinicalTableSearchService', () => {
let service: NlmClinicalTableSearchService;
beforeEach(() => {
TestBed.configureTestingModule({});
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
});
service = TestBed.inject(NlmClinicalTableSearchService);
});