fixing tests

This commit is contained in:
Jason Kulatunga 2023-09-05 19:26:03 -07:00
parent f5c245a0e2
commit 786f2f6f5e
No known key found for this signature in database
4 changed files with 11 additions and 4 deletions

View File

@ -3,6 +3,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AllergyIntoleranceComponent } from './allergy-intolerance.component'; import { AllergyIntoleranceComponent } from './allergy-intolerance.component';
import {NgbCollapseModule} from '@ng-bootstrap/ng-bootstrap'; import {NgbCollapseModule} from '@ng-bootstrap/ng-bootstrap';
import {AuthService} from '../../../../services/auth.service'; import {AuthService} from '../../../../services/auth.service';
import {RouterTestingModule} from '@angular/router/testing';
describe('AllergyIntoleranceComponent', () => { describe('AllergyIntoleranceComponent', () => {
let component: AllergyIntoleranceComponent; let component: AllergyIntoleranceComponent;
@ -10,7 +11,7 @@ describe('AllergyIntoleranceComponent', () => {
beforeEach(async () => { beforeEach(async () => {
await TestBed.configureTestingModule({ await TestBed.configureTestingModule({
imports: [AllergyIntoleranceComponent, NgbCollapseModule], imports: [AllergyIntoleranceComponent, NgbCollapseModule, RouterTestingModule],
providers: [AuthService] providers: [AuthService]
}) })
.compileComponents(); .compileComponents();

View File

@ -13,6 +13,7 @@ describe('HumanNameModel', () => {
expectedHumanName.familyName = 'Windsor' expectedHumanName.familyName = 'Windsor'
expectedHumanName.suffix = '' expectedHumanName.suffix = ''
expectedHumanName.use = 'maiden' expectedHumanName.use = 'maiden'
expectedHumanName.displayName = 'Peter, James Windsor'
// expectedHumanName.header = 'Peter, James Windsor' // expectedHumanName.header = 'Peter, James Windsor'
expect(new HumanNameModel(fixture)).toEqual(expectedHumanName); expect(new HumanNameModel(fixture)).toEqual(expectedHumanName);

View File

@ -49,6 +49,7 @@ describe('AllergyIntoleranceModel', () => {
// expected.type = '' // expected.type = ''
expected.category = ['medication'] expected.category = ['medication']
expected.patient = {reference: 'Patient/example'} expected.patient = {reference: 'Patient/example'}
expected.code = { coding: [{ system: 'http://www.nlm.nih.gov/research/umls/rxnorm', code: '7980', display: 'Penicillin G' } ] }
expect(new AllergyIntoleranceModel(example2Fixture)).toEqual(expected); expect(new AllergyIntoleranceModel(example2Fixture)).toEqual(expected);
}); });
@ -64,6 +65,7 @@ describe('AllergyIntoleranceModel', () => {
// expected.type = 'allergy' // expected.type = 'allergy'
// expected.category = [ 'food' ] // expected.category = [ 'food' ]
expected.patient = {reference: 'Patient/mom'} expected.patient = {reference: 'Patient/mom'}
expected.code = { coding: [{ system: 'http://snomed.info/sct', code: '716186003', display: 'No Known Allergy (situation)' } ], text: 'NKA' }
expect(new AllergyIntoleranceModel(example3Fixture)).toEqual(expected); expect(new AllergyIntoleranceModel(example3Fixture)).toEqual(expected);
}); });
@ -133,7 +135,7 @@ describe('AllergyIntoleranceModel', () => {
expected.type = 'allergy' expected.type = 'allergy'
expected.category = ['food'] expected.category = ['food']
expected.patient = {reference: 'Patient/example'} expected.patient = {reference: 'Patient/example'}
expected.code = { coding: [ { system: 'http://snomed.info/sct', code: '227493005', display: 'Cashew nuts' } ] }
expect(new AllergyIntoleranceModel(example1Stu3Fixture, fhirVersions.STU3)).toEqual(expected); expect(new AllergyIntoleranceModel(example1Stu3Fixture, fhirVersions.STU3)).toEqual(expected);
}); });
@ -149,6 +151,7 @@ describe('AllergyIntoleranceModel', () => {
// expected.type = 'allergy' // expected.type = 'allergy'
expected.category = ['food'] expected.category = ['food']
expected.patient = {reference: 'Patient/example'} expected.patient = {reference: 'Patient/example'}
expected.code = { coding: [{ system: 'http://snomed.info/sct', code: '227037002', display: 'Fish - dietary (substance)' }], text: 'Allergic to fresh fish. Tolerates canned fish' }
expect(new AllergyIntoleranceModel(example2Stu3Fixture, fhirVersions.STU3)).toEqual(expected); expect(new AllergyIntoleranceModel(example2Stu3Fixture, fhirVersions.STU3)).toEqual(expected);
}); });

View File

@ -36,7 +36,7 @@ describe('ConditionModel', () => {
expected.clinical_status = 'active' expected.clinical_status = 'active'
// expected.dateRecorded: string | undefined // expected.dateRecorded: string | undefined
expected.onset_datetime = '2012-05-24' expected.onset_datetime = '2012-05-24'
expected.code = { coding: [{ system: 'http://snomed.info/sct', code: '39065001', display: 'Burn of ear' } ], text: 'Burnt Ear' }
expect(new ConditionModel(example1Fixture)).toEqual(expected); expect(new ConditionModel(example1Fixture)).toEqual(expected);
}); });
it('should parse example2.json', () => { it('should parse example2.json', () => {
@ -51,7 +51,8 @@ describe('ConditionModel', () => {
expected.clinical_status = 'active' expected.clinical_status = 'active'
// expected.dateRecorded: string | undefined // expected.dateRecorded: string | undefined
// expected.onsetDateTime = '2012-05-24' // expected.onsetDateTime = '2012-05-24'
//@ts-ignore
expected.code = {text: 'Asthma' }
expect(new ConditionModel(example2Fixture)).toEqual(expected); expect(new ConditionModel(example2Fixture)).toEqual(expected);
}); });
it('should parse example3.json', () => { it('should parse example3.json', () => {
@ -67,6 +68,7 @@ describe('ConditionModel', () => {
expected.clinical_status = 'resolved' expected.clinical_status = 'resolved'
expected.date_recorded = '2013-04-04' expected.date_recorded = '2013-04-04'
expected.onset_datetime = '2013-04-02' expected.onset_datetime = '2013-04-02'
expected.code ={ coding: [{ system: 'http://snomed.info/sct', code: '386661006', display: 'Fever' }] }
expect(new ConditionModel(example3Fixture)).toEqual(expected); expect(new ConditionModel(example3Fixture)).toEqual(expected);
}); });