Skip to content

Commit 26eb241

Browse files
committed
Move resources used in population/extraction into separate file
1 parent 1deecbe commit 26eb241

4 files changed

Lines changed: 519 additions & 459 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { render } from '@testing-library/react';
2+
import { AboriginalForm, runExtract } from './aboriginalFormUtils';
3+
import { condition, patient, resolvedCondition } from './aboriginalFormIntegrationData';
4+
import { FhirResource } from 'fhir/r4';
5+
6+
vi.mock('fhirclient', () => ({
7+
client: () => ({})
8+
}));
9+
10+
beforeAll(() => {
11+
globalThis.ResizeObserver = class ResizeObserver {
12+
observe() {}
13+
unobserve() {}
14+
disconnect() {}
15+
};
16+
});
17+
18+
describe('Extraction workflow for', () => {
19+
test('Conditions', async () => {
20+
const { container } = render(<AboriginalForm patient={patient} requestDefinitions={[]} />);
21+
22+
// Fill condition table with data from condition
23+
// Fill condition table with data from resolvedCondition
24+
25+
const extractedBundle = await runExtract({}, {});
26+
expect(extractedBundle.entry).toHaveLength(2);
27+
28+
expect(extractedBundle.entry?.[0]?.resource).toStrictEqual(removeId(condition));
29+
expect(extractedBundle.entry?.[1]?.resource).toStrictEqual(removeId(resolvedCondition));
30+
});
31+
});
32+
33+
function removeId(resource: FhirResource) {
34+
const { id, ...resourceWithoutId } = resource;
35+
return resourceWithoutId;
36+
}

0 commit comments

Comments
 (0)