fixing frontend tests.

This commit is contained in:
Jason Kulatunga 2023-01-16 07:55:53 -08:00
parent b8ea3c8f97
commit 18f8b36a39
5 changed files with 78 additions and 10 deletions

View File

@ -1,8 +1,76 @@
import { FhirResourceOutletDirective } from './fhir-resource-outlet.directive';
import {
ComponentFactory, ComponentRef,
EmbeddedViewRef, EnvironmentInjector,
Injector,
NgModuleRef,
TemplateRef,
Type,
ViewContainerRef
} from '@angular/core';
class TestViewContainerRef extends ViewContainerRef {
get element(): import("@angular/core").ElementRef<any> {
throw new Error("Method not implemented.");
}
get injector(): import("@angular/core").Injector {
throw new Error("Method not implemented.");
}
get parentInjector(): import("@angular/core").Injector {
throw new Error("Method not implemented.");
}
clear(): void {
throw new Error("Method not implemented.");
}
get(index: number): import("@angular/core").ViewRef {
throw new Error("Method not implemented.");
}
get length(): number {
throw new Error("Method not implemented.");
}
// createEmbeddedView<C>(templateRef: import("@angular/core").TemplateRef<C>, context?: C, index?: number): import("@angular/core").EmbeddedViewRef<C> {
// throw new Error("Method not implemented.");
// }
// createComponent<C>(componentFactory: import("@angular/core").ComponentFactory<C>, index?: number, injector?: import("@angular/core").Injector, projectableNodes?: any[][], ngModule?: import("@angular/core").NgModuleRef<any>): import("@angular/core").ComponentRef<C> {
// throw new Error("Method not implemented.");
// }
insert(viewRef: import("@angular/core").ViewRef, index?: number): import("@angular/core").ViewRef {
throw new Error("Method not implemented.");
}
move(viewRef: import("@angular/core").ViewRef, currentIndex: number): import("@angular/core").ViewRef {
throw new Error("Method not implemented.");
}
indexOf(viewRef: import("@angular/core").ViewRef): number {
throw new Error("Method not implemented.");
}
remove(index?: number): void {
throw new Error("Method not implemented.");
}
detach(index?: number): import("@angular/core").ViewRef {
throw new Error("Method not implemented.");
}
createComponent<C>(componentType: Type<C>, options?: { index?: number; injector?: Injector; ngModuleRef?: NgModuleRef<unknown>; environmentInjector?: EnvironmentInjector | NgModuleRef<unknown>; projectableNodes?: Node[][] }): ComponentRef<C>;
createComponent<C>(componentFactory: ComponentFactory<C>, index?: number, injector?: Injector, projectableNodes?: any[][], environmentInjector?: EnvironmentInjector | NgModuleRef<any>): ComponentRef<C>;
createComponent<C>(componentType, options?: { index?: number; injector?: Injector; ngModuleRef?: NgModuleRef<unknown>; environmentInjector?: EnvironmentInjector | NgModuleRef<unknown>; projectableNodes?: Node[][] } | number, injector?: Injector, projectableNodes?: any[][], environmentInjector?: EnvironmentInjector | NgModuleRef<any>): ComponentRef<C> {
throw new Error("Method not implemented.");
}
createEmbeddedView<C>(templateRef: TemplateRef<C>, context?: C, options?: { index?: number; injector?: Injector }): EmbeddedViewRef<C>;
createEmbeddedView<C>(templateRef: TemplateRef<C>, context?: C, index?: number): EmbeddedViewRef<C>;
createEmbeddedView<C>(templateRef, context?, options?: { index?: number; injector?: Injector } | number): EmbeddedViewRef<C> {
throw new Error("Method not implemented.");
}
}
describe('FhirResourceOutletDirective', () => {
it('should create an instance', () => {
const directive = new FhirResourceOutletDirective();
const directive = new FhirResourceOutletDirective(new TestViewContainerRef());
expect(directive).toBeTruthy();
});
});

View File

@ -1,4 +1,4 @@
import * as moment from 'moment'
import moment from "moment";
/**
* Walks thru an object (ar array) and returns the value found at the provided

View File

@ -111,7 +111,7 @@ export class ReportMedicalHistoryConditionComponent implements OnInit {
this.encounters.push(resource as EncounterModel);
(resource as EncounterModel).participant.map((participant) => {
let id = participant.reference
let id = participant.reference.reference
involvedInCareMap[id] = _.mergeWith(
{},
involvedInCareMap[id],

View File

@ -12,11 +12,11 @@ export class CareTeamModel extends FastenDisplayModel {
period_start: string | undefined
period_end: string | undefined
participants: {
reference:string
display:string,
role:string,
periodStart: string,
periodEnd: string
reference?: string,
display?:string,
role?:string,
periodStart?: string,
periodEnd?: string
}[] | undefined
category: CodableConceptModel[] | undefined
subject: ReferenceModel | undefined

View File

@ -18,7 +18,7 @@ export class EncounterModel extends FastenDisplayModel {
participant: {
display?: string,
role?: string,
reference?: string,
reference?: ReferenceModel,
text?: string,
periodStart?:string
}[] | undefined
@ -85,7 +85,7 @@ export class EncounterModel extends FastenDisplayModel {
return {
role: _.get(item, 'type[0].text') || _.get(item, 'type[0].coding[0].display'),
display: _.get(item, 'individual.display'),
reference: _.get(item, 'individual.reference'),
reference: _.get(item, 'individual'),
text: _.get(item, 'type[0].text'),
periodStart,
};