@openmrs/esm-patient-orders-app 11.3.1-patch.9064 → 11.3.1-patch.9508
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +22 -27
- package/dist/1119.js +1 -1
- package/dist/1197.js +1 -1
- package/dist/1571.js +1 -1
- package/dist/1571.js.map +1 -1
- package/dist/2146.js +1 -1
- package/dist/2690.js +1 -1
- package/dist/2717.js +1 -0
- package/dist/2717.js.map +1 -0
- package/dist/3099.js +1 -1
- package/dist/3584.js +1 -1
- package/dist/3685.js +1 -1
- package/dist/4055.js +1 -1
- package/dist/4132.js +1 -1
- package/dist/4300.js +1 -1
- package/dist/4335.js +1 -1
- package/dist/439.js +1 -0
- package/dist/4618.js +1 -1
- package/dist/4652.js +1 -1
- package/dist/4937.js +1 -1
- package/dist/4944.js +1 -1
- package/dist/5134.js +2 -0
- package/dist/5134.js.map +1 -0
- package/dist/5173.js +1 -1
- package/dist/5241.js +1 -1
- package/dist/5442.js +1 -1
- package/dist/5661.js +1 -1
- package/dist/5670.js +1 -1
- package/dist/5670.js.map +1 -1
- package/dist/6022.js +1 -1
- package/dist/6336.js +1 -0
- package/dist/6336.js.map +1 -0
- package/dist/6411.js +1 -1
- package/dist/6468.js +1 -1
- package/dist/6542.js +1 -1
- package/dist/6589.js +1 -0
- package/dist/6679.js +1 -1
- package/dist/6840.js +1 -1
- package/dist/6859.js +1 -1
- package/dist/7097.js +1 -1
- package/dist/7159.js +1 -1
- package/dist/723.js +1 -1
- package/dist/7617.js +1 -1
- package/dist/7657.js +2 -0
- package/dist/7657.js.map +1 -0
- package/dist/795.js +1 -1
- package/dist/8154.js +1 -1
- package/dist/8154.js.map +1 -1
- package/dist/8163.js +1 -1
- package/dist/8349.js +1 -1
- package/dist/8371.js +1 -0
- package/dist/8618.js +1 -1
- package/dist/8625.js +1 -1
- package/dist/8625.js.map +1 -1
- package/dist/8803.js +1 -1
- package/dist/8803.js.map +1 -1
- package/dist/890.js +1 -1
- package/dist/8960.js +1 -1
- package/dist/8960.js.map +1 -1
- package/dist/9214.js +1 -1
- package/dist/9538.js +1 -1
- package/dist/9569.js +1 -1
- package/dist/986.js +1 -1
- package/dist/9879.js +1 -1
- package/dist/9895.js +1 -1
- package/dist/9900.js +1 -1
- package/dist/9913.js +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-patient-orders-app.js +1 -1
- package/dist/openmrs-esm-patient-orders-app.js.buildmanifest.json +291 -246
- package/dist/openmrs-esm-patient-orders-app.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +3 -3
- package/src/api/api.ts +23 -12
- package/src/components/order-details-table.component.tsx +16 -6
- package/src/components/test-order.component.tsx +53 -49
- package/src/lab-results/lab-results-form-field.component.tsx +8 -5
- package/src/lab-results/lab-results-form.component.tsx +121 -41
- package/src/lab-results/lab-results-form.test.tsx +434 -283
- package/src/lab-results/lab-results-schema.resource.tsx +13 -4
- package/src/lab-results/lab-results.resource.ts +113 -0
- package/src/lab-results/print-results/print-modal/print-results-modal.tsx +5 -1
- package/src/order-basket/general-order-type/general-order-form/general-order-form.component.tsx +3 -2
- package/src/order-basket/general-order-type/general-order-type.component.tsx +3 -2
- package/src/order-basket/general-order-type/orderable-concept-search/orderable-concept-search.workspace.tsx +19 -5
- package/src/order-basket/general-order-type/orderable-concept-search/search-results.component.tsx +6 -1
- package/src/order-basket/order-basket.workspace.tsx +39 -17
- package/src/order-basket-action-button/order-basket-action-button.extension.tsx +11 -3
- package/src/order-basket-action-button/order-basket-action-button.test.tsx +6 -30
- package/src/routes.json +2 -2
- package/translations/am.json +6 -20
- package/translations/ar.json +6 -20
- package/translations/ar_SY.json +6 -20
- package/translations/bn.json +6 -20
- package/translations/cs.json +114 -0
- package/translations/de.json +6 -20
- package/translations/en.json +2 -0
- package/translations/en_US.json +6 -20
- package/translations/es.json +6 -20
- package/translations/es_MX.json +6 -20
- package/translations/fr.json +11 -25
- package/translations/he.json +6 -20
- package/translations/hi.json +6 -20
- package/translations/hi_IN.json +6 -20
- package/translations/id.json +6 -20
- package/translations/it.json +6 -20
- package/translations/ka.json +6 -20
- package/translations/km.json +6 -20
- package/translations/ku.json +6 -20
- package/translations/ky.json +6 -20
- package/translations/lg.json +6 -20
- package/translations/ne.json +6 -20
- package/translations/pl.json +6 -20
- package/translations/pt.json +6 -20
- package/translations/pt_BR.json +6 -20
- package/translations/qu.json +6 -20
- package/translations/ro_RO.json +6 -20
- package/translations/ru_RU.json +6 -20
- package/translations/si.json +6 -20
- package/translations/sq.json +114 -0
- package/translations/sw.json +6 -20
- package/translations/sw_KE.json +6 -20
- package/translations/tr.json +6 -20
- package/translations/tr_TR.json +6 -20
- package/translations/uk.json +6 -20
- package/translations/uz.json +6 -20
- package/translations/uz@Latn.json +6 -20
- package/translations/uz_UZ.json +6 -20
- package/translations/vi.json +6 -20
- package/translations/zh.json +6 -20
- package/translations/zh_CN.json +6 -20
- package/translations/zh_TW.json +114 -0
- package/dist/2537.js +0 -1
- package/dist/2537.js.map +0 -1
- package/dist/2981.js +0 -2
- package/dist/2981.js.map +0 -1
- package/dist/4918.js +0 -1
- package/dist/4918.js.map +0 -1
- package/dist/6783.js +0 -2
- package/dist/6783.js.map +0 -1
- package/dist/7202.js +0 -1
- package/dist/7202.js.map +0 -1
- /package/dist/{6783.js.LICENSE.txt → 5134.js.LICENSE.txt} +0 -0
- /package/dist/{2981.js.LICENSE.txt → 7657.js.LICENSE.txt} +0 -0
|
@@ -2,31 +2,34 @@ import React from 'react';
|
|
|
2
2
|
import { render, screen, waitFor } from '@testing-library/react';
|
|
3
3
|
import userEvent from '@testing-library/user-event';
|
|
4
4
|
import {
|
|
5
|
-
|
|
5
|
+
useOrderConceptsByUuids,
|
|
6
6
|
useLabEncounter,
|
|
7
7
|
useObservation,
|
|
8
8
|
type LabOrderConcept,
|
|
9
9
|
updateOrderResult,
|
|
10
10
|
type Datatype,
|
|
11
|
-
|
|
11
|
+
useCompletedLabResultsArray,
|
|
12
12
|
} from './lab-results.resource';
|
|
13
|
+
import { usePatient } from '@openmrs/esm-framework/src';
|
|
13
14
|
import LabResultsForm from './lab-results-form.component';
|
|
14
15
|
import { type Order } from '@openmrs/esm-patient-common-lib';
|
|
15
16
|
import { type Encounter } from '../types/encounter';
|
|
16
17
|
import { mockPatient } from 'tools';
|
|
17
18
|
|
|
18
|
-
const
|
|
19
|
+
const mockUseOrderConceptByUuids = jest.mocked(useOrderConceptsByUuids);
|
|
19
20
|
const mockUseLabEncounter = jest.mocked(useLabEncounter);
|
|
20
21
|
const mockUseObservation = jest.mocked(useObservation);
|
|
21
|
-
const
|
|
22
|
+
const mockUseCompletedLabResultsArray = jest.mocked(useCompletedLabResultsArray);
|
|
23
|
+
const mockUsePatient = jest.mocked(usePatient);
|
|
22
24
|
|
|
23
25
|
jest.mock('./lab-results.resource', () => ({
|
|
24
26
|
...jest.requireActual('./lab-results.resource'),
|
|
25
27
|
useOrderConceptByUuid: jest.fn(),
|
|
28
|
+
useOrderConceptsByUuids: jest.fn(),
|
|
26
29
|
useLabEncounter: jest.fn(),
|
|
27
30
|
useObservation: jest.fn(),
|
|
28
31
|
updateOrderResult: jest.fn().mockResolvedValue({}),
|
|
29
|
-
|
|
32
|
+
useCompletedLabResultsArray: jest.fn(),
|
|
30
33
|
}));
|
|
31
34
|
|
|
32
35
|
const mockOrder = {
|
|
@@ -47,25 +50,29 @@ const testProps = {
|
|
|
47
50
|
setTitle: jest.fn(),
|
|
48
51
|
patientUuid: mockPatient.id,
|
|
49
52
|
patient: mockPatient,
|
|
53
|
+
visitContext: null,
|
|
54
|
+
mutateVisitContext: null,
|
|
50
55
|
};
|
|
51
56
|
|
|
52
57
|
describe('LabResultsForm', () => {
|
|
53
58
|
beforeEach(() => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
59
|
+
mockUseOrderConceptByUuids.mockReturnValue({
|
|
60
|
+
concepts: [
|
|
61
|
+
{
|
|
62
|
+
uuid: 'concept-uuid',
|
|
63
|
+
display: 'Test Concept',
|
|
64
|
+
setMembers: [],
|
|
65
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
66
|
+
hiAbsolute: 100,
|
|
67
|
+
hiCritical: 80,
|
|
68
|
+
hiNormal: 70,
|
|
69
|
+
lowAbsolute: 0,
|
|
70
|
+
lowCritical: 40,
|
|
71
|
+
lowNormal: 50,
|
|
72
|
+
units: 'mg/dL',
|
|
73
|
+
allowDecimal: false,
|
|
74
|
+
},
|
|
75
|
+
] as LabOrderConcept[],
|
|
69
76
|
isLoading: false,
|
|
70
77
|
error: null,
|
|
71
78
|
isValidating: false,
|
|
@@ -85,12 +92,18 @@ describe('LabResultsForm', () => {
|
|
|
85
92
|
isValidating: false,
|
|
86
93
|
mutate: jest.fn(),
|
|
87
94
|
});
|
|
88
|
-
|
|
89
|
-
|
|
95
|
+
mockUseCompletedLabResultsArray.mockReturnValue({
|
|
96
|
+
completeLabResults: [],
|
|
90
97
|
isLoading: false,
|
|
91
98
|
error: null,
|
|
92
99
|
mutate: jest.fn(),
|
|
93
100
|
});
|
|
101
|
+
mockUsePatient.mockReturnValue({
|
|
102
|
+
isLoading: false,
|
|
103
|
+
patient: mockPatient,
|
|
104
|
+
patientUuid: '',
|
|
105
|
+
error: null,
|
|
106
|
+
});
|
|
94
107
|
});
|
|
95
108
|
|
|
96
109
|
test('validates numeric input correctly', async () => {
|
|
@@ -111,21 +124,23 @@ describe('LabResultsForm', () => {
|
|
|
111
124
|
test('validate when we have a concept with allowDecimal set to true', async () => {
|
|
112
125
|
const user = userEvent.setup();
|
|
113
126
|
// if allowDecimal is true, we should allow decimal values
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
mockUseOrderConceptByUuids.mockReturnValue({
|
|
128
|
+
concepts: [
|
|
129
|
+
{
|
|
130
|
+
uuid: 'concept-uuid',
|
|
131
|
+
display: 'Test Concept',
|
|
132
|
+
setMembers: [],
|
|
133
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
134
|
+
hiAbsolute: 100,
|
|
135
|
+
lowAbsolute: null,
|
|
136
|
+
lowCritical: null,
|
|
137
|
+
lowNormal: null,
|
|
138
|
+
hiCritical: null,
|
|
139
|
+
hiNormal: null,
|
|
140
|
+
units: 'mg/dL',
|
|
141
|
+
allowDecimal: true,
|
|
142
|
+
},
|
|
143
|
+
] as LabOrderConcept[],
|
|
129
144
|
isLoading: false,
|
|
130
145
|
error: null,
|
|
131
146
|
isValidating: false,
|
|
@@ -191,20 +206,22 @@ describe('LabResultsForm', () => {
|
|
|
191
206
|
|
|
192
207
|
test('validate numeric input with concept having only hiAbsolute', async () => {
|
|
193
208
|
const user = userEvent.setup();
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
209
|
+
mockUseOrderConceptByUuids.mockReturnValue({
|
|
210
|
+
concepts: [
|
|
211
|
+
{
|
|
212
|
+
uuid: 'concept-uuid',
|
|
213
|
+
display: 'Test Concept',
|
|
214
|
+
setMembers: [],
|
|
215
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
216
|
+
hiAbsolute: 100,
|
|
217
|
+
lowAbsolute: null,
|
|
218
|
+
lowCritical: null,
|
|
219
|
+
lowNormal: null,
|
|
220
|
+
hiCritical: null,
|
|
221
|
+
hiNormal: null,
|
|
222
|
+
units: 'mg/dL',
|
|
223
|
+
},
|
|
224
|
+
] as LabOrderConcept[],
|
|
208
225
|
isLoading: false,
|
|
209
226
|
error: null,
|
|
210
227
|
isValidating: false,
|
|
@@ -227,20 +244,22 @@ describe('LabResultsForm', () => {
|
|
|
227
244
|
|
|
228
245
|
test('validate numeric input with concept having only lowAbsolute', async () => {
|
|
229
246
|
const user = userEvent.setup();
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
247
|
+
mockUseOrderConceptByUuids.mockReturnValue({
|
|
248
|
+
concepts: [
|
|
249
|
+
{
|
|
250
|
+
uuid: 'concept-uuid',
|
|
251
|
+
display: 'Test Concept',
|
|
252
|
+
setMembers: [],
|
|
253
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
254
|
+
lowAbsolute: 0,
|
|
255
|
+
lowCritical: null,
|
|
256
|
+
lowNormal: null,
|
|
257
|
+
hiCritical: null,
|
|
258
|
+
hiNormal: null,
|
|
259
|
+
hiAbsolute: null,
|
|
260
|
+
units: 'mg/dL',
|
|
261
|
+
},
|
|
262
|
+
] as LabOrderConcept[],
|
|
244
263
|
isLoading: false,
|
|
245
264
|
error: null,
|
|
246
265
|
isValidating: false,
|
|
@@ -261,6 +280,63 @@ describe('LabResultsForm', () => {
|
|
|
261
280
|
});
|
|
262
281
|
});
|
|
263
282
|
|
|
283
|
+
test('validate numeric input for multiple fields', async () => {
|
|
284
|
+
const user = userEvent.setup();
|
|
285
|
+
mockUseOrderConceptByUuids.mockReturnValue({
|
|
286
|
+
concepts: [
|
|
287
|
+
{
|
|
288
|
+
uuid: 'concept-uuid',
|
|
289
|
+
display: 'Test Concept',
|
|
290
|
+
setMembers: [],
|
|
291
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
292
|
+
hiAbsolute: 60,
|
|
293
|
+
lowAbsolute: 0,
|
|
294
|
+
lowCritical: null,
|
|
295
|
+
lowNormal: null,
|
|
296
|
+
hiCritical: null,
|
|
297
|
+
hiNormal: null,
|
|
298
|
+
units: 'mg/dL',
|
|
299
|
+
allowDecimal: true,
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
uuid: 'concept-uuid2',
|
|
303
|
+
display: 'Test Concept Percentage',
|
|
304
|
+
setMembers: [],
|
|
305
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
306
|
+
hiAbsolute: 100,
|
|
307
|
+
lowAbsolute: 0,
|
|
308
|
+
lowCritical: null,
|
|
309
|
+
lowNormal: null,
|
|
310
|
+
hiCritical: null,
|
|
311
|
+
hiNormal: null,
|
|
312
|
+
units: '%',
|
|
313
|
+
allowDecimal: true,
|
|
314
|
+
},
|
|
315
|
+
] as LabOrderConcept[],
|
|
316
|
+
isLoading: false,
|
|
317
|
+
error: null,
|
|
318
|
+
isValidating: false,
|
|
319
|
+
mutate: jest.fn(),
|
|
320
|
+
});
|
|
321
|
+
render(<LabResultsForm {...testProps} />);
|
|
322
|
+
|
|
323
|
+
const input = await screen.findByLabelText(`Test Concept (0 - 60 mg/dL)`);
|
|
324
|
+
await user.type(input, '80');
|
|
325
|
+
|
|
326
|
+
const input2 = await screen.findByLabelText(`Test Concept Percentage (0 - 100 %)`);
|
|
327
|
+
await user.type(input2, '120');
|
|
328
|
+
|
|
329
|
+
const saveButton = screen.getByRole('button', { name: /Save and close/i });
|
|
330
|
+
await user.click(saveButton);
|
|
331
|
+
|
|
332
|
+
await waitFor(() => {
|
|
333
|
+
expect(screen.getByText('Test Concept must be between 0 and 60')).toBeInTheDocument();
|
|
334
|
+
});
|
|
335
|
+
await waitFor(() => {
|
|
336
|
+
expect(screen.getByText('Test Concept Percentage must be between 0 and 100')).toBeInTheDocument();
|
|
337
|
+
});
|
|
338
|
+
});
|
|
339
|
+
|
|
264
340
|
test('submits form with valid data', async () => {
|
|
265
341
|
const user = userEvent.setup();
|
|
266
342
|
const mockCloseWorkspace = jest.fn();
|
|
@@ -285,49 +361,114 @@ describe('LabResultsForm', () => {
|
|
|
285
361
|
});
|
|
286
362
|
});
|
|
287
363
|
|
|
364
|
+
test('submits form with valid data for multiple Results', async () => {
|
|
365
|
+
const user = userEvent.setup();
|
|
366
|
+
mockUseOrderConceptByUuids.mockReturnValue({
|
|
367
|
+
concepts: [
|
|
368
|
+
{
|
|
369
|
+
uuid: 'concept-uuid',
|
|
370
|
+
display: 'Test Concept',
|
|
371
|
+
setMembers: [],
|
|
372
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
373
|
+
hiAbsolute: 60,
|
|
374
|
+
lowAbsolute: 0,
|
|
375
|
+
lowCritical: null,
|
|
376
|
+
lowNormal: null,
|
|
377
|
+
hiCritical: null,
|
|
378
|
+
hiNormal: null,
|
|
379
|
+
units: 'mg/dL',
|
|
380
|
+
allowDecimal: true,
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
uuid: 'concept-uuid2',
|
|
384
|
+
display: 'Test Concept Percentage',
|
|
385
|
+
setMembers: [],
|
|
386
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
387
|
+
hiAbsolute: 100,
|
|
388
|
+
lowAbsolute: 0,
|
|
389
|
+
lowCritical: null,
|
|
390
|
+
lowNormal: null,
|
|
391
|
+
hiCritical: null,
|
|
392
|
+
hiNormal: null,
|
|
393
|
+
units: '%',
|
|
394
|
+
allowDecimal: true,
|
|
395
|
+
},
|
|
396
|
+
] as LabOrderConcept[],
|
|
397
|
+
isLoading: false,
|
|
398
|
+
error: null,
|
|
399
|
+
isValidating: false,
|
|
400
|
+
mutate: jest.fn(),
|
|
401
|
+
});
|
|
402
|
+
const mockCloseWorkspace = jest.fn();
|
|
403
|
+
const mockCloseWorkspaceWithSavedChanges = jest.fn();
|
|
404
|
+
|
|
405
|
+
render(
|
|
406
|
+
<LabResultsForm
|
|
407
|
+
{...testProps}
|
|
408
|
+
closeWorkspace={mockCloseWorkspace}
|
|
409
|
+
closeWorkspaceWithSavedChanges={mockCloseWorkspaceWithSavedChanges}
|
|
410
|
+
/>,
|
|
411
|
+
);
|
|
412
|
+
|
|
413
|
+
const input = await screen.findByLabelText(`Test Concept (0 - 60 mg/dL)`);
|
|
414
|
+
await user.type(input, '50');
|
|
415
|
+
|
|
416
|
+
const input2 = await screen.findByLabelText(`Test Concept Percentage (0 - 100 %)`);
|
|
417
|
+
await user.type(input2, '90');
|
|
418
|
+
|
|
419
|
+
const saveButton = screen.getByRole('button', { name: /Save and close/i });
|
|
420
|
+
await user.click(saveButton);
|
|
421
|
+
|
|
422
|
+
await waitFor(() => {
|
|
423
|
+
expect(mockCloseWorkspaceWithSavedChanges).toHaveBeenCalled();
|
|
424
|
+
});
|
|
425
|
+
});
|
|
426
|
+
|
|
288
427
|
test('validate numeric input where concept is a set', async () => {
|
|
289
428
|
const user = userEvent.setup();
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
429
|
+
mockUseOrderConceptByUuids.mockReturnValue({
|
|
430
|
+
concepts: [
|
|
431
|
+
{
|
|
432
|
+
uuid: 'concept-uuid',
|
|
433
|
+
display: 'Test Concept',
|
|
434
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
435
|
+
lowAbsolute: 0,
|
|
436
|
+
lowCritical: null,
|
|
437
|
+
lowNormal: null,
|
|
438
|
+
hiCritical: null,
|
|
439
|
+
hiNormal: null,
|
|
440
|
+
hiAbsolute: null,
|
|
441
|
+
units: 'mg/dL',
|
|
442
|
+
setMembers: [
|
|
443
|
+
{
|
|
444
|
+
uuid: 'set-member-uuid',
|
|
445
|
+
display: 'Set Member',
|
|
446
|
+
setMembers: [],
|
|
447
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
448
|
+
lowAbsolute: 50,
|
|
449
|
+
lowCritical: 70,
|
|
450
|
+
lowNormal: 80,
|
|
451
|
+
hiCritical: 140,
|
|
452
|
+
hiNormal: 120,
|
|
453
|
+
hiAbsolute: 150,
|
|
454
|
+
units: 'mg/dL',
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
uuid: 'set-member-uuid-2',
|
|
458
|
+
display: 'Set Member 2',
|
|
459
|
+
setMembers: [],
|
|
460
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
461
|
+
lowAbsolute: 5,
|
|
462
|
+
lowCritical: 10,
|
|
463
|
+
lowNormal: 15,
|
|
464
|
+
hiCritical: 20,
|
|
465
|
+
hiNormal: 25,
|
|
466
|
+
hiAbsolute: 30,
|
|
467
|
+
units: 'mg/dL',
|
|
468
|
+
},
|
|
469
|
+
],
|
|
470
|
+
},
|
|
471
|
+
] as LabOrderConcept[],
|
|
331
472
|
isLoading: false,
|
|
332
473
|
error: null,
|
|
333
474
|
isValidating: false,
|
|
@@ -361,20 +502,22 @@ describe('LabResultsForm', () => {
|
|
|
361
502
|
|
|
362
503
|
test('lab results form submits the correct lab result payload when the concept is not a set', async () => {
|
|
363
504
|
const user = userEvent.setup();
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
505
|
+
mockUseOrderConceptByUuids.mockReturnValue({
|
|
506
|
+
concepts: [
|
|
507
|
+
{
|
|
508
|
+
uuid: 'concept-uuid',
|
|
509
|
+
display: 'Test Concept',
|
|
510
|
+
setMembers: [],
|
|
511
|
+
datatype: { display: 'Text', hl7Abbreviation: 'ST' } as Datatype,
|
|
512
|
+
hiAbsolute: 100,
|
|
513
|
+
lowAbsolute: 0,
|
|
514
|
+
lowCritical: null,
|
|
515
|
+
lowNormal: null,
|
|
516
|
+
hiCritical: null,
|
|
517
|
+
hiNormal: null,
|
|
518
|
+
units: 'mg/dL',
|
|
519
|
+
},
|
|
520
|
+
] as LabOrderConcept[],
|
|
378
521
|
isLoading: false,
|
|
379
522
|
error: null,
|
|
380
523
|
isValidating: false,
|
|
@@ -408,48 +551,50 @@ describe('LabResultsForm', () => {
|
|
|
408
551
|
|
|
409
552
|
test('lab results forms submits correct payload when the concept is a set and one set member is keyed', async () => {
|
|
410
553
|
const user = userEvent.setup();
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
554
|
+
mockUseOrderConceptByUuids.mockReturnValue({
|
|
555
|
+
concepts: [
|
|
556
|
+
{
|
|
557
|
+
uuid: 'concept-uuid',
|
|
558
|
+
display: 'Test Concept',
|
|
559
|
+
set: true,
|
|
560
|
+
setMembers: [
|
|
561
|
+
{
|
|
562
|
+
uuid: 'set-member-uuid-1',
|
|
563
|
+
display: 'Set Member 1',
|
|
564
|
+
concept: { uuid: 'concept-uuid-1', display: 'Concept 1' },
|
|
565
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' } as Datatype,
|
|
566
|
+
hiAbsolute: 100,
|
|
567
|
+
lowAbsolute: 0,
|
|
568
|
+
lowCritical: null,
|
|
569
|
+
lowNormal: null,
|
|
570
|
+
hiCritical: null,
|
|
571
|
+
hiNormal: null,
|
|
572
|
+
units: 'mg/dL',
|
|
573
|
+
},
|
|
574
|
+
{
|
|
575
|
+
uuid: 'set-member-uuid-2',
|
|
576
|
+
display: 'Set Member 2',
|
|
577
|
+
concept: { uuid: 'concept-uuid-2', display: 'Concept 2' },
|
|
578
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' } as Datatype,
|
|
579
|
+
hiAbsolute: 80,
|
|
580
|
+
lowAbsolute: 0,
|
|
581
|
+
lowCritical: null,
|
|
582
|
+
lowNormal: null,
|
|
583
|
+
hiCritical: null,
|
|
584
|
+
hiNormal: null,
|
|
585
|
+
units: 'mmol/L',
|
|
586
|
+
},
|
|
587
|
+
],
|
|
588
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
589
|
+
hiAbsolute: 100,
|
|
590
|
+
lowAbsolute: 0,
|
|
591
|
+
lowCritical: null,
|
|
592
|
+
lowNormal: null,
|
|
593
|
+
hiCritical: null,
|
|
594
|
+
hiNormal: null,
|
|
595
|
+
units: 'mg/dL',
|
|
596
|
+
},
|
|
597
|
+
] as unknown as LabOrderConcept[],
|
|
453
598
|
isLoading: false,
|
|
454
599
|
error: null,
|
|
455
600
|
isValidating: false,
|
|
@@ -512,48 +657,50 @@ describe('LabResultsForm', () => {
|
|
|
512
657
|
|
|
513
658
|
test('lab results form submits correct payload when the concept is a set and both set members are keyed', async () => {
|
|
514
659
|
const user = userEvent.setup();
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
660
|
+
mockUseOrderConceptByUuids.mockReturnValue({
|
|
661
|
+
concepts: [
|
|
662
|
+
{
|
|
663
|
+
uuid: 'concept-uuid',
|
|
664
|
+
display: 'Test Concept',
|
|
665
|
+
set: true,
|
|
666
|
+
setMembers: [
|
|
667
|
+
{
|
|
668
|
+
uuid: 'set-member-uuid-1',
|
|
669
|
+
display: 'Set Member 1',
|
|
670
|
+
concept: { uuid: 'concept-uuid-1', display: 'Concept 1' },
|
|
671
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
672
|
+
hiAbsolute: 100,
|
|
673
|
+
lowAbsolute: 0,
|
|
674
|
+
lowCritical: null,
|
|
675
|
+
lowNormal: null,
|
|
676
|
+
hiCritical: null,
|
|
677
|
+
hiNormal: null,
|
|
678
|
+
units: 'mg/dL',
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
uuid: 'set-member-uuid-2',
|
|
682
|
+
display: 'Set Member 2',
|
|
683
|
+
concept: { uuid: 'concept-uuid-2', display: 'Concept 2' },
|
|
684
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
685
|
+
hiAbsolute: 80,
|
|
686
|
+
lowAbsolute: 0,
|
|
687
|
+
lowCritical: null,
|
|
688
|
+
lowNormal: null,
|
|
689
|
+
hiCritical: null,
|
|
690
|
+
hiNormal: null,
|
|
691
|
+
units: 'mmol/L',
|
|
692
|
+
},
|
|
693
|
+
],
|
|
694
|
+
datatype: { display: 'Numeric' },
|
|
695
|
+
hiAbsolute: 100,
|
|
696
|
+
lowAbsolute: 0,
|
|
697
|
+
lowCritical: null,
|
|
698
|
+
lowNormal: null,
|
|
699
|
+
hiCritical: null,
|
|
700
|
+
hiNormal: null,
|
|
701
|
+
units: 'mg/dL',
|
|
702
|
+
},
|
|
703
|
+
] as unknown as LabOrderConcept[],
|
|
557
704
|
isLoading: false,
|
|
558
705
|
error: null,
|
|
559
706
|
isValidating: false,
|
|
@@ -628,13 +775,15 @@ describe('LabResultsForm', () => {
|
|
|
628
775
|
});
|
|
629
776
|
|
|
630
777
|
test('display error notification when the concept datatype is N/A', async () => {
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
778
|
+
mockUseOrderConceptByUuids.mockReturnValue({
|
|
779
|
+
concepts: [
|
|
780
|
+
{
|
|
781
|
+
uuid: 'concept-uuid',
|
|
782
|
+
display: 'Test Concept',
|
|
783
|
+
setMembers: [],
|
|
784
|
+
datatype: { display: 'N/A' },
|
|
785
|
+
},
|
|
786
|
+
] as LabOrderConcept[],
|
|
638
787
|
isLoading: false,
|
|
639
788
|
error: null,
|
|
640
789
|
isValidating: false,
|
|
@@ -653,78 +802,80 @@ describe('LabResultsForm', () => {
|
|
|
653
802
|
|
|
654
803
|
test('should display second level of set members for a given concept, if present', () => {
|
|
655
804
|
const user = userEvent.setup();
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
805
|
+
mockUseOrderConceptByUuids.mockReturnValue({
|
|
806
|
+
concepts: [
|
|
807
|
+
{
|
|
808
|
+
uuid: 'concept-uuid',
|
|
809
|
+
display: 'Test Concept',
|
|
810
|
+
set: true,
|
|
811
|
+
setMembers: [
|
|
812
|
+
{
|
|
813
|
+
uuid: 'set-member-uuid-1',
|
|
814
|
+
display: 'Set Member 1',
|
|
815
|
+
concept: { uuid: 'concept-uuid-1', display: 'Concept 1' },
|
|
816
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
817
|
+
hiAbsolute: 100,
|
|
818
|
+
lowAbsolute: 0,
|
|
819
|
+
lowCritical: null,
|
|
820
|
+
lowNormal: null,
|
|
821
|
+
hiCritical: null,
|
|
822
|
+
hiNormal: null,
|
|
823
|
+
units: 'mg/dL',
|
|
824
|
+
},
|
|
825
|
+
{
|
|
826
|
+
uuid: 'set-member-uuid-2',
|
|
827
|
+
display: 'Set Member 2',
|
|
828
|
+
concept: { uuid: 'concept-uuid-2', display: 'Concept 2' },
|
|
829
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
830
|
+
hiAbsolute: 80,
|
|
831
|
+
lowAbsolute: 0,
|
|
832
|
+
lowCritical: null,
|
|
833
|
+
lowNormal: null,
|
|
834
|
+
hiCritical: null,
|
|
835
|
+
hiNormal: null,
|
|
836
|
+
units: 'mmol/L',
|
|
837
|
+
},
|
|
838
|
+
{
|
|
839
|
+
uuid: 'set-member-uuid-3',
|
|
840
|
+
display: 'Set Member 3',
|
|
841
|
+
concept: { uuid: 'concept-uuid-3', display: 'Concept 3' },
|
|
842
|
+
datatype: { display: 'N/A', hl7Abbreviation: 'ZZ' },
|
|
843
|
+
set: true,
|
|
844
|
+
setMembers: [
|
|
845
|
+
{
|
|
846
|
+
uuid: 'set-member-uuid-3.1',
|
|
847
|
+
display: 'Set Member 3.1',
|
|
848
|
+
concept: { uuid: 'concept-uuid-3.1', display: 'Concept 3.1' },
|
|
849
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
850
|
+
hiAbsolute: 80,
|
|
851
|
+
lowAbsolute: 0,
|
|
852
|
+
lowCritical: null,
|
|
853
|
+
lowNormal: null,
|
|
854
|
+
units: 'mg/dL',
|
|
855
|
+
},
|
|
856
|
+
{
|
|
857
|
+
uuid: 'set-member-uuid-3.2',
|
|
858
|
+
display: 'Set Member 3.2',
|
|
859
|
+
concept: { uuid: 'concept-uuid-3.2', display: 'Concept 3.2' },
|
|
860
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
861
|
+
hiAbsolute: 80,
|
|
862
|
+
lowAbsolute: 0,
|
|
863
|
+
lowCritical: null,
|
|
864
|
+
units: 'mg/dL',
|
|
865
|
+
},
|
|
866
|
+
],
|
|
867
|
+
},
|
|
868
|
+
],
|
|
869
|
+
datatype: { display: 'Numeric' },
|
|
870
|
+
hiAbsolute: 100,
|
|
871
|
+
lowAbsolute: 0,
|
|
872
|
+
lowCritical: null,
|
|
873
|
+
lowNormal: null,
|
|
874
|
+
hiCritical: null,
|
|
875
|
+
hiNormal: null,
|
|
876
|
+
units: 'mg/dL',
|
|
877
|
+
},
|
|
878
|
+
] as unknown as LabOrderConcept[],
|
|
728
879
|
isLoading: false,
|
|
729
880
|
error: null,
|
|
730
881
|
isValidating: false,
|