From f5c245a0e209259f91e510207a84b4f64f27da03 Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Tue, 5 Sep 2023 19:18:20 -0700 Subject: [PATCH] fixing tests --- .../fhir/resources/medication/medication.component.spec.ts | 3 ++- .../fhir/resources/procedure/procedure.component.spec.ts | 2 +- frontend/src/lib/models/resources/adverse-event-model.spec.ts | 1 + .../src/lib/models/resources/allergy-intolerance-model.spec.ts | 1 + frontend/src/lib/models/resources/care-plan-model.spec.ts | 2 ++ frontend/src/lib/models/resources/encounter-model.spec.ts | 1 + 6 files changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/components/fhir/resources/medication/medication.component.spec.ts b/frontend/src/app/components/fhir/resources/medication/medication.component.spec.ts index 3303f5db..551c9e7b 100644 --- a/frontend/src/app/components/fhir/resources/medication/medication.component.spec.ts +++ b/frontend/src/app/components/fhir/resources/medication/medication.component.spec.ts @@ -2,6 +2,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MedicationComponent } from './medication.component'; import {NgbCollapseModule} from '@ng-bootstrap/ng-bootstrap'; +import {RouterTestingModule} from '@angular/router/testing'; describe('MedicationComponent', () => { let component: MedicationComponent; @@ -9,7 +10,7 @@ describe('MedicationComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [MedicationComponent, NgbCollapseModule] + imports: [MedicationComponent, NgbCollapseModule, RouterTestingModule] }) .compileComponents(); diff --git a/frontend/src/app/components/fhir/resources/procedure/procedure.component.spec.ts b/frontend/src/app/components/fhir/resources/procedure/procedure.component.spec.ts index a6b397c2..90c62857 100644 --- a/frontend/src/app/components/fhir/resources/procedure/procedure.component.spec.ts +++ b/frontend/src/app/components/fhir/resources/procedure/procedure.component.spec.ts @@ -10,7 +10,7 @@ describe('ProcedureComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ProcedureComponent, NgbCollapseModule], + imports: [ProcedureComponent, NgbCollapseModule, RouterTestingModule], providers: [RouterTestingModule] }) diff --git a/frontend/src/lib/models/resources/adverse-event-model.spec.ts b/frontend/src/lib/models/resources/adverse-event-model.spec.ts index 85b80d94..9b847a4a 100644 --- a/frontend/src/lib/models/resources/adverse-event-model.spec.ts +++ b/frontend/src/lib/models/resources/adverse-event-model.spec.ts @@ -33,6 +33,7 @@ describe('AdverseEventModel', () => { "text": "This was a mild rash on the left forearm" }) expected.has_event = true + expected.code = { coding: [{ system: 'http://snomed.info/sct', code: '304386008', display: 'O/E - itchy rash' } ], text: 'This was a mild rash on the left forearm' } expect(new AdverseEventModel(example1Fixture)).toEqual(expected); }); diff --git a/frontend/src/lib/models/resources/allergy-intolerance-model.spec.ts b/frontend/src/lib/models/resources/allergy-intolerance-model.spec.ts index ec0a0904..43a9c549 100644 --- a/frontend/src/lib/models/resources/allergy-intolerance-model.spec.ts +++ b/frontend/src/lib/models/resources/allergy-intolerance-model.spec.ts @@ -32,6 +32,7 @@ describe('AllergyIntoleranceModel', () => { expected.note = [{text: 'The criticality is high becasue of the observed anaphylactic reaction when challenged with cashew extract.'}] expected.type = 'allergy' expected.category = ['food'] + expected.code = { coding: [{ system: 'http://snomed.info/sct', code: '227493005', display: 'Cashew nuts' } ] } expected.patient = {reference: 'Patient/example'} expect(new AllergyIntoleranceModel(example1Fixture)).toEqual(expected); diff --git a/frontend/src/lib/models/resources/care-plan-model.spec.ts b/frontend/src/lib/models/resources/care-plan-model.spec.ts index b5cd4d6e..ce8ad217 100644 --- a/frontend/src/lib/models/resources/care-plan-model.spec.ts +++ b/frontend/src/lib/models/resources/care-plan-model.spec.ts @@ -101,6 +101,8 @@ describe('CarePlanModel', () => { // expected.periodStart = '2013-01-01' expected.period_end = '2017-06-01' expected.author = { reference: 'Practitioner/example', display: 'Dr Adam Careful' } + //@ts-ignore + expected.code = [{ text: 'Weight management plan' }] expect(new CarePlanModel(weightLossPlanFixture)).toEqual(expected); }); diff --git a/frontend/src/lib/models/resources/encounter-model.spec.ts b/frontend/src/lib/models/resources/encounter-model.spec.ts index 62a4cb54..9fe2f800 100644 --- a/frontend/src/lib/models/resources/encounter-model.spec.ts +++ b/frontend/src/lib/models/resources/encounter-model.spec.ts @@ -64,6 +64,7 @@ describe('EncounterModel', () => { role: undefined } ] + expected.code = { coding: [{ system: 'http://snomed.info/sct', code: '11429006', display: 'Consultation' }] } expect(new EncounterModel(example3Fixture)).toEqual(expected); });