Skip to content

Commit c90d26a

Browse files
committed
RNGR-41 Added test cases
1 parent 18f9456 commit c90d26a

7 files changed

+1646
-2
lines changed

src/tests/customMatchers.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,12 @@ function toHaveResponse (resp, expectedIn, fnCleanResource) {
278278
}
279279
if (Array.isArray(expected)) {
280280
expected.sort((a, b) => {
281-
const uuidA = a.identifier?.find(identifier => identifier.id === 'uuid')?.value;
282-
const uuidB = b.identifier?.find(identifier => identifier.id === 'uuid')?.value;
281+
const uuidA = Array.isArray(a.identifier)
282+
? a.identifier.find((identifier) => identifier.id === 'uuid')?.value
283+
: undefined;
284+
const uuidB = Array.isArray(b.identifier)
285+
? b.identifier.find((identifier) => identifier.id === 'uuid')?.value
286+
: undefined;
283287

284288
// Check if both UUIDs exist before comparing
285289
if (uuidA && uuidB) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,292 @@
1+
{
2+
"resourceType": "Composition",
3+
"id": "composition1",
4+
"meta": {
5+
"source": "https://www.icanbwell.com/intelligence-layer-pipeline",
6+
"security": [
7+
{
8+
"system": "https://www.icanbwell.com/owner",
9+
"code": "bwell"
10+
},
11+
{
12+
"system": "https://www.icanbwell.com/access",
13+
"code": "bwell"
14+
},
15+
{
16+
"system": "https://www.icanbwell.com/vendor",
17+
"code": "bwell"
18+
},
19+
{
20+
"system": "https://www.icanbwell.com/sourceAssigningAuthority",
21+
"code": "bwell"
22+
}
23+
]
24+
},
25+
"text": {
26+
"status": "generated",
27+
"div": "Encounter Summary Grouped by Encounter Class and Type"
28+
},
29+
"identifier": {
30+
"system": "https://www.icanbwell.com/intelligence-layer-pipeline/version",
31+
"value": "1.0"
32+
},
33+
"status": "preliminary",
34+
"type": {
35+
"coding": [
36+
{
37+
"system": "https://fhir.icanbwell.com/4_0_0/CodeSystem/composition/",
38+
"code": "encounter_summary_document",
39+
"display": "b.Well Encounter Summary Composition Document"
40+
},
41+
{
42+
"system": "https://fhir.icanbwell.com/4_0_0/CodeSystem/composition/type",
43+
"code": "encounter_group_class_and_type",
44+
"display": "Encounter Summary Composition Grouped by Encounter Class and Type"
45+
},
46+
{
47+
"system": "https://hl7.org/fhir/allergyintolerance",
48+
"code": "Encounter",
49+
"display": "FHIR resource type"
50+
}
51+
],
52+
"text": "Encounter Summary Composition Document"
53+
},
54+
"subject": {
55+
"extension": [
56+
{
57+
"id": "sourceId",
58+
"url": "https://www.icanbwell.com/sourceId",
59+
"valueString": "Patient/e8cfea6f-7051-5c11-b306-b995e6f6adf0"
60+
},
61+
{
62+
"id": "uuid",
63+
"url": "https://www.icanbwell.com/uuid",
64+
"valueString": "Patient/e8cfea6f-7051-5c11-b306-b995e6f6adf0"
65+
},
66+
{
67+
"id": "sourceAssigningAuthority",
68+
"url": "https://www.icanbwell.com/sourceAssigningAuthority",
69+
"valueString": "bwell"
70+
}
71+
],
72+
"reference": "Patient/e8cfea6f-7051-5c11-b306-b995e6f6adf0",
73+
"type": "Patient"
74+
},
75+
"date": "2024-03-14T16:52:11Z",
76+
"author": [
77+
{
78+
"extension": [
79+
{
80+
"id": "sourceId",
81+
"url": "https://www.icanbwell.com/sourceId",
82+
"valueString": "Organization/078cf112-f802-4e4b-9b62-ed44cdf05d27"
83+
},
84+
{
85+
"id": "uuid",
86+
"url": "https://www.icanbwell.com/uuid",
87+
"valueString": "Organization/078cf112-f802-4e4b-9b62-ed44cdf05d27"
88+
},
89+
{
90+
"id": "sourceAssigningAuthority",
91+
"url": "https://www.icanbwell.com/sourceAssigningAuthority",
92+
"valueString": "bwell"
93+
}
94+
],
95+
"reference": "Organization/078cf112-f802-4e4b-9b62-ed44cdf05d27",
96+
"type": "Organization",
97+
"display": "bwell Connected Health"
98+
}
99+
],
100+
"title": "Encounter Summary Grouped by Encounter Class and Type",
101+
"section": [
102+
{
103+
"id": "770500bd-1eb1-55a9-874c-b96abb5dd97c",
104+
"title": "Hov - outpatient",
105+
"code": {
106+
"coding": [
107+
{
108+
"system": "urn:oid:1.2.840.114350.1.72.1.7.7.10.696784.13260",
109+
"code": "4",
110+
"display": "HOV"
111+
},
112+
{
113+
"system": "urn:oid:1.2.840.114350.1.13.300.2.7.10.698084.10110",
114+
"code": "102",
115+
"display": "Outpatient"
116+
}
117+
]
118+
},
119+
"mode": "working",
120+
"orderedBy": {
121+
"coding": [
122+
{
123+
"system": "http://terminology.hl7.org/CodeSystem/list-order",
124+
"code": "event-date",
125+
"display": "Sorted by Event Date"
126+
}
127+
],
128+
"text": "Sorted by period.start DESC"
129+
},
130+
"entry": [
131+
{
132+
"id": "cfc6ef87-c267-5d61-9d3f-8f55366dfe63",
133+
"extension": [
134+
{
135+
"id": "sourceId",
136+
"url": "https://www.icanbwell.com/sourceId",
137+
"valueString": "Encounter/1343b1a3-f6b7-5559-9f63-ff5a2ab037ec"
138+
},
139+
{
140+
"id": "uuid",
141+
"url": "https://www.icanbwell.com/uuid",
142+
"valueString": "Encounter/1343b1a3-f6b7-5559-9f63-ff5a2ab037ec"
143+
},
144+
{
145+
"id": "sourceAssigningAuthority",
146+
"url": "https://www.icanbwell.com/sourceAssigningAuthority",
147+
"valueString": "bwell"
148+
}
149+
],
150+
"reference": "Encounter/1343b1a3-f6b7-5559-9f63-ff5a2ab037ec",
151+
"type": "Encounter"
152+
}
153+
],
154+
"section": [
155+
{
156+
"id": "f69bf24e-c309-5bef-b1db-91731b0bd74d",
157+
"title": "Visit Name",
158+
"text": {
159+
"status": "generated",
160+
"div": "Hov - outpatient"
161+
}
162+
},
163+
{
164+
"id": "0e19a6f5-72dc-5838-96ea-bcc527fb411e",
165+
"title": "class",
166+
"text": {
167+
"status": "generated",
168+
"div": "Hov"
169+
}
170+
},
171+
{
172+
"id": "14d71fbc-c3b7-5376-a56e-eed0d1ce8667",
173+
"title": "type",
174+
"text": {
175+
"status": "generated",
176+
"div": "Outpatient"
177+
}
178+
},
179+
{
180+
"id": "18aa1c7b-f46c-5314-a80c-b5eb740cba12",
181+
"title": "Source",
182+
"text": {
183+
"status": "generated",
184+
"div": "Ucla_medical_center"
185+
}
186+
},
187+
{
188+
"id": "125c6490-273f-51f6-8336-ba454963de7c",
189+
"title": "Date",
190+
"text": {
191+
"status": "generated",
192+
"div": "2020-04-17T00:49:21Z"
193+
}
194+
},
195+
{
196+
"id": "792debe2-a7db-5309-8a0c-a9e66475d857",
197+
"title": "Practitioner",
198+
"text": {
199+
"status": "generated",
200+
"div": "Joseph P. Luftman"
201+
}
202+
}
203+
]
204+
},
205+
{
206+
"id": "377beddd-028f-529e-922d-9c797efe4f06",
207+
"title": "Appointment - office visit",
208+
"code": {
209+
"coding": [
210+
{
211+
"system": "urn:oid:1.2.840.114350.1.72.1.7.7.10.696784.13260",
212+
"code": "5",
213+
"display": "Appointment"
214+
},
215+
{
216+
"system": "urn:oid:1.2.840.114350.1.13.300.2.7.10.698084.30",
217+
"code": "101",
218+
"display": "Office Visit"
219+
}
220+
]
221+
},
222+
"mode": "working",
223+
"orderedBy": {
224+
"coding": [
225+
{
226+
"system": "http://terminology.hl7.org/CodeSystem/list-order",
227+
"code": "event-date",
228+
"display": "Sorted by Event Date"
229+
}
230+
],
231+
"text": "Sorted by period.start DESC"
232+
},
233+
"entry": [
234+
{
235+
"id": "6809677f-79aa-55f3-8faa-4601958c7c7b",
236+
"reference": "Encounter/ab7f657f-f88e-557b-8ada-2c64a2dd7961",
237+
"type": "Encounter"
238+
}
239+
],
240+
"section": [
241+
{
242+
"id": "5247d36c-1450-5d0e-9c5c-222d36e43f4b",
243+
"title": "Visit Name",
244+
"text": {
245+
"status": "generated",
246+
"div": "Appointment - office visit"
247+
}
248+
},
249+
{
250+
"id": "6546294f-c7e3-5e97-aac2-0a7b0365aa9a",
251+
"title": "class",
252+
"text": {
253+
"status": "generated",
254+
"div": "Appointment"
255+
}
256+
},
257+
{
258+
"id": "935fd8d1-30df-5427-a230-16dc71f5d4a5",
259+
"title": "type",
260+
"text": {
261+
"status": "generated",
262+
"div": "Office visit"
263+
}
264+
},
265+
{
266+
"id": "7e3eb9c5-f76c-5c40-aff6-505934e7bd10",
267+
"title": "Source",
268+
"text": {
269+
"status": "generated",
270+
"div": "Ucla_medical_center"
271+
}
272+
},
273+
{
274+
"id": "abeaa1a3-7c6d-5efd-a7e7-59bbba7cb66f",
275+
"title": "Date",
276+
"text": {
277+
"status": "generated",
278+
"div": "2020-04-17T01:00:00Z"
279+
}
280+
},
281+
{
282+
"id": "6e82a98b-f3db-5eec-819d-1ebace56b019",
283+
"title": "Practitioner",
284+
"text": {
285+
"status": "generated",
286+
"div": "Joseph P. Luftman"
287+
}
288+
}
289+
]
290+
}
291+
]
292+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"resourceType": "Composition",
3+
"id": "composition2",
4+
"contained": [
5+
{
6+
"resourceType": "Organization",
7+
"id": "enrichHashReference",
8+
"meta": {
9+
"source": "https://www.anthem.com/medical_claims",
10+
"security": [
11+
{
12+
"system": "https://www.icanbwell.com/owner",
13+
"code": "bwell"
14+
}
15+
],
16+
"tag": [
17+
{
18+
"code": "random",
19+
"display": "random",
20+
"id": "random",
21+
"system": "https://fhir.icanbwell.com/4_0_0/CodeSystem/server-behavior"
22+
}
23+
]
24+
},
25+
"endpoint": [
26+
{
27+
"reference": "Endpoint/enp-2"
28+
}
29+
]
30+
}
31+
],
32+
"meta": {
33+
"source": "https://www.icanbwell.com/bwell",
34+
"security": [
35+
{
36+
"system": "https://www.icanbwell.com/owner",
37+
"code": "bwell"
38+
},
39+
{
40+
"system": "https://www.icanbwell.com/access",
41+
"code": "bwell"
42+
},
43+
{
44+
"system": "https://www.icanbwell.com/vendor",
45+
"code": "bwell"
46+
},
47+
{
48+
"system": "https://www.icanbwell.com/sourceAssigningAuthority",
49+
"code": "bwell"
50+
}
51+
]
52+
},
53+
"status": "preliminary",
54+
"type": {
55+
"coding": [
56+
{
57+
"system": "https://fhir.icanbwell.com/4_0_0/CodeSystem/composition/type",
58+
"code": "encounter_group_class_and_type",
59+
"display": "Encounter Summary Composition Grouped by Encounter Class and Type"
60+
}
61+
],
62+
"text": "Encounter Summary Composition Document"
63+
},
64+
"subject": {
65+
"reference": "Patient/5c51ffc6-b79e-4d0c-8eca-216d9e1d2c30",
66+
"type": "Patient"
67+
},
68+
"date": "2024-03-14T16:52:11Z",
69+
"author": [
70+
{
71+
"reference": "Organization/enrichHashReference"
72+
}
73+
],
74+
"title": "Encounter Summary Grouped by Encounter Class and Type"
75+
}

0 commit comments

Comments
 (0)