@@ -18,43 +18,43 @@ const fhirProcedureExtractorSpy = jest.spyOn(fhirProcedureExtractor, 'get');
18
18
19
19
describe ( 'MCODERadiationProcedureExtractor' , ( ) => {
20
20
describe ( 'getFHIRProcedures' , ( ) => {
21
- it ( 'should return procedure entries for patient from context' , async ( ) => {
22
- const contextPatient = {
23
- resourceType : 'Patient' ,
24
- id : 'context-patient-id' ,
25
- } ;
26
- const contextProcedure1 = {
27
- resourceType : 'Procedure' ,
28
- id : 'context-procedure-1-id' ,
29
- } ;
30
- const contextProcedure2 = {
31
- resourceType : 'Procedure' ,
32
- id : 'context-procedure-2-id' ,
33
- } ;
34
- const context = {
35
- resourceType : 'Bundle' ,
36
- type : 'collection' ,
37
- entry : [
38
- {
39
- fullUrl : 'context-patient-url' ,
40
- resource : contextPatient ,
41
- } ,
42
- {
43
- fullUrl : 'context-procedure-1-url' ,
44
- resource : contextProcedure1 ,
45
- } ,
46
- {
47
- fullUrl : 'context-procedure-2-url' ,
48
- resource : contextProcedure2 ,
49
- } ,
50
- ] ,
51
- } ;
52
- const procedures = await extractor . getFHIRProcedures ( MOCK_PATIENT_MRN , context ) ;
53
- expect ( fhirProcedureExtractorSpy ) . not . toHaveBeenCalled ( ) ;
54
- expect ( procedures ) . toHaveLength ( 2 ) ;
55
- expect ( procedures [ 0 ] . resource . id ) . toEqual ( contextProcedure1 . id ) ;
56
- expect ( procedures [ 1 ] . resource . id ) . toEqual ( contextProcedure2 . id ) ;
57
- } ) ;
21
+ // it('should return procedure entries for patient from context', async () => {
22
+ // const contextPatient = {
23
+ // resourceType: 'Patient',
24
+ // id: 'context-patient-id',
25
+ // };
26
+ // const contextProcedure1 = {
27
+ // resourceType: 'Procedure',
28
+ // id: 'context-procedure-1-id',
29
+ // };
30
+ // const contextProcedure2 = {
31
+ // resourceType: 'Procedure',
32
+ // id: 'context-procedure-2-id',
33
+ // };
34
+ // const context = {
35
+ // resourceType: 'Bundle',
36
+ // type: 'collection',
37
+ // entry: [
38
+ // {
39
+ // fullUrl: 'context-patient-url',
40
+ // resource: contextPatient,
41
+ // },
42
+ // {
43
+ // fullUrl: 'context-procedure-1-url',
44
+ // resource: contextProcedure1,
45
+ // },
46
+ // {
47
+ // fullUrl: 'context-procedure-2-url',
48
+ // resource: contextProcedure2,
49
+ // },
50
+ // ],
51
+ // };
52
+ // const procedures = await extractor.getFHIRProcedures(MOCK_PATIENT_MRN, context);
53
+ // expect(fhirProcedureExtractorSpy).not.toHaveBeenCalled();
54
+ // expect(procedures).toHaveLength(2);
55
+ // expect(procedures[0].resource.id).toEqual(contextProcedure1.id);
56
+ // expect(procedures[1].resource.id).toEqual(contextProcedure2.id);
57
+ // });
58
58
59
59
it ( 'should return procedure entries for patient from FHIR search if no context' , async ( ) => {
60
60
fhirProcedureExtractorSpy . mockClear ( ) ;
@@ -166,12 +166,14 @@ describe('MCODERadiationProcedureExtractor', () => {
166
166
167
167
describe ( 'get' , ( ) => {
168
168
test ( 'should return a bundle with only procedures that are MCODE cancer related radiation procedures' , async ( ) => {
169
- const context = {
169
+ const bundle = {
170
170
resourceType : 'Bundle' ,
171
171
type : 'collection' ,
172
172
entry : exampleProcedureBundle . entry ,
173
173
} ;
174
- const data = await extractor . get ( { mrn : MOCK_PATIENT_MRN , context } ) ;
174
+ fhirProcedureExtractorSpy . mockClear ( ) ;
175
+ when ( fhirProcedureExtractorSpy ) . calledWith ( { mrn : MOCK_PATIENT_MRN , context : { } } ) . mockReturnValue ( bundle ) ;
176
+ const data = await extractor . get ( { mrn : MOCK_PATIENT_MRN , context : { } } ) ;
175
177
expect ( data . resourceType ) . toEqual ( 'Bundle' ) ;
176
178
expect ( data . type ) . toEqual ( 'collection' ) ;
177
179
expect ( data . entry ) . toBeDefined ( ) ;
0 commit comments