Skip to content

Commit eae5d60

Browse files
committed
Remove unnecessary mrn references and BaseFHIRModule search spy from tests
1 parent 971897f commit eae5d60

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

test/extractors/BaseFHIRExtractor.test.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ const { baseFHIRModule } = baseFHIRExtractor;
3131
const baseFHIRModuleSearchSpy = jest.spyOn(baseFHIRModule, 'search');
3232
const moduleRequestHeadersSpy = jest.spyOn(baseFHIRModule, 'updateRequestHeaders');
3333

34-
when(baseFHIRModuleSearchSpy)
35-
.calledWith('Patient', { identifier: `MRN|${MOCK_PATIENT_MRN}` })
36-
.mockReturnValue(examplePatientBundle);
3734
// Ensure that data is returned for condition
3835
when(baseFHIRModuleSearchSpy)
3936
.calledWith('Condition', { patient: examplePatientBundle.entry[0].resource.id })
@@ -60,20 +57,20 @@ describe('BaseFhirExtractor', () => {
6057

6158
test('parametrizeArgsForFHIRModule parses data off of context if available', async () => {
6259
baseFHIRModuleSearchSpy.mockClear();
63-
const paramsBasedOnContext = await baseFHIRExtractor.parametrizeArgsForFHIRModule({ mrn: MOCK_PATIENT_MRN, context: MOCK_CONTEXT });
60+
const paramsBasedOnContext = await baseFHIRExtractor.parametrizeArgsForFHIRModule({ context: MOCK_CONTEXT });
6461
expect(baseFHIRModuleSearchSpy).not.toHaveBeenCalled();
6562
expect(paramsBasedOnContext).toHaveProperty('patient');
6663
expect(paramsBasedOnContext.patient).toEqual(MOCK_CONTEXT.entry[0].resource.id);
6764
});
6865

6966
test('parametrizeArgsForFHIRModule throws an error if context has no relevant ID', async () => {
7067
baseFHIRModuleSearchSpy.mockClear();
71-
await expect(baseFHIRExtractor.parametrizeArgsForFHIRModule({ mrn: MOCK_PATIENT_MRN })).rejects.toThrowError('BaseFHIRExtractor could not find Patient resource in context.');
68+
await expect(baseFHIRExtractor.parametrizeArgsForFHIRModule({})).rejects.toThrowError('BaseFHIRExtractor could not find Patient resource in context.');
7269
expect(baseFHIRModuleSearchSpy).not.toHaveBeenCalled();
7370
});
7471

7572
test('get should return a condition resource', async () => {
76-
const data = await baseFHIRExtractor.get({ mrn: MOCK_PATIENT_MRN, context: MOCK_CONTEXT });
73+
const data = await baseFHIRExtractor.get({ context: MOCK_CONTEXT });
7774
expect(data.resourceType).toEqual('Bundle');
7875
expect(data.entry).toBeDefined();
7976
expect(data.entry.length).toBeGreaterThan(0);

0 commit comments

Comments
 (0)