@openmrs/esm-patient-orders-app 11.3.1-patch.9310 → 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 +15 -18
- package/dist/1119.js +1 -1
- package/dist/1197.js +1 -1
- package/dist/1571.js +1 -0
- package/dist/1571.js.map +1 -0
- 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/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/4937.js.map +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/6468.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/795.js +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 -0
- package/dist/8625.js.map +1 -0
- package/dist/8803.js +1 -0
- package/dist/8803.js.map +1 -0
- package/dist/890.js +1 -1
- package/dist/8960.js +1 -0
- package/dist/8960.js.map +1 -0
- 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 +276 -259
- package/dist/openmrs-esm-patient-orders-app.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +2 -2
- package/src/api/api.ts +25 -0
- package/src/components/order-details-table.component.tsx +40 -53
- package/src/components/test-order.component.tsx +53 -49
- package/src/index.ts +9 -12
- package/src/lab-results/lab-results-form.component.tsx +343 -0
- package/src/lab-results/lab-results-form.test.tsx +455 -306
- package/src/lab-results/lab-results-schema.resource.tsx +13 -4
- package/src/lab-results/lab-results.resource.ts +113 -0
- package/src/order-basket/general-order-type/general-order-form/general-order-form.component.tsx +25 -71
- package/src/order-basket/general-order-type/{general-order-panel.component.tsx → general-order-type.component.tsx} +41 -23
- package/src/order-basket/general-order-type/{add-general-order/add-general-order.component.tsx → orderable-concept-search/orderable-concept-search.workspace.tsx} +83 -78
- package/src/order-basket/general-order-type/{add-general-order → orderable-concept-search}/search-results.component.tsx +14 -15
- package/src/order-basket/general-order-type/resources.ts +2 -3
- package/src/order-basket/order-basket.workspace.tsx +251 -35
- package/src/order-basket-action-button/order-basket-action-button.extension.tsx +31 -0
- package/src/order-basket-action-button/order-basket-action-button.test.tsx +36 -27
- package/src/order-cancellation-form/cancel-order-form.component.tsx +85 -82
- package/src/routes.json +25 -17
- package/src/utils/index.ts +3 -15
- 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 +12 -4
- package/translations/en_US.json +6 -20
- package/translations/es.json +6 -20
- package/translations/es_MX.json +6 -20
- package/translations/fr.json +7 -21
- 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/1253.js +0 -1
- package/dist/1253.js.map +0 -1
- package/dist/1268.js +0 -2
- package/dist/1268.js.map +0 -1
- package/dist/375.js +0 -1
- package/dist/375.js.map +0 -1
- package/dist/4341.js +0 -1
- package/dist/4341.js.map +0 -1
- package/dist/4687.js +0 -1
- package/dist/4687.js.map +0 -1
- package/dist/6364.js +0 -1
- package/dist/6364.js.map +0 -1
- package/dist/6473.js +0 -1
- package/dist/6473.js.map +0 -1
- package/dist/8416.js +0 -1
- package/dist/8416.js.map +0 -1
- package/src/lab-results/exported-lab-results-form.workspace.tsx +0 -264
- package/src/lab-results/lab-results-form.workspace.tsx +0 -25
- package/src/order-basket/exported-order-basket.workspace.tsx +0 -54
- package/src/order-basket/general-order-type/add-general-order/add-general-order.workspace.tsx +0 -35
- package/src/order-basket/general-order-type/add-general-order/exported-add-general-order.workspace.tsx +0 -32
- package/src/order-basket/order-basket.component.tsx +0 -213
- package/src/order-basket-action-button/order-basket-action-button.component.tsx +0 -35
- /package/dist/{1268.js.LICENSE.txt → 5134.js.LICENSE.txt} +0 -0
- /package/src/order-basket/general-order-type/{add-general-order → orderable-concept-search}/orderable-concept-search.scss +0 -0
- /package/src/order-basket/general-order-type/{add-general-order → orderable-concept-search}/search-results.scss +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
|
|
14
|
-
import
|
|
13
|
+
import { usePatient } from '@openmrs/esm-framework/src';
|
|
14
|
+
import LabResultsForm from './lab-results-form.component';
|
|
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 = {
|
|
@@ -39,43 +42,37 @@ const mockOrder = {
|
|
|
39
42
|
orderer: { uuid: 'orderer-uuid' },
|
|
40
43
|
};
|
|
41
44
|
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
visitContext: null,
|
|
53
|
-
mutateVisitContext: null,
|
|
54
|
-
},
|
|
55
|
-
launchChildWorkspace: jest.fn(),
|
|
56
|
-
windowProps: {},
|
|
57
|
-
workspaceName: '',
|
|
58
|
-
windowName: '',
|
|
59
|
-
isRootWorkspace: false,
|
|
45
|
+
const testProps = {
|
|
46
|
+
closeWorkspace: jest.fn(),
|
|
47
|
+
closeWorkspaceWithSavedChanges: jest.fn(),
|
|
48
|
+
order: mockOrder as Order,
|
|
49
|
+
promptBeforeClosing: jest.fn(),
|
|
50
|
+
setTitle: jest.fn(),
|
|
51
|
+
patientUuid: mockPatient.id,
|
|
52
|
+
patient: mockPatient,
|
|
53
|
+
visitContext: null,
|
|
54
|
+
mutateVisitContext: null,
|
|
60
55
|
};
|
|
61
56
|
|
|
62
57
|
describe('LabResultsForm', () => {
|
|
63
58
|
beforeEach(() => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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[],
|
|
79
76
|
isLoading: false,
|
|
80
77
|
error: null,
|
|
81
78
|
isValidating: false,
|
|
@@ -95,12 +92,18 @@ describe('LabResultsForm', () => {
|
|
|
95
92
|
isValidating: false,
|
|
96
93
|
mutate: jest.fn(),
|
|
97
94
|
});
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
mockUseCompletedLabResultsArray.mockReturnValue({
|
|
96
|
+
completeLabResults: [],
|
|
100
97
|
isLoading: false,
|
|
101
98
|
error: null,
|
|
102
99
|
mutate: jest.fn(),
|
|
103
100
|
});
|
|
101
|
+
mockUsePatient.mockReturnValue({
|
|
102
|
+
isLoading: false,
|
|
103
|
+
patient: mockPatient,
|
|
104
|
+
patientUuid: '',
|
|
105
|
+
error: null,
|
|
106
|
+
});
|
|
104
107
|
});
|
|
105
108
|
|
|
106
109
|
test('validates numeric input correctly', async () => {
|
|
@@ -121,21 +124,23 @@ describe('LabResultsForm', () => {
|
|
|
121
124
|
test('validate when we have a concept with allowDecimal set to true', async () => {
|
|
122
125
|
const user = userEvent.setup();
|
|
123
126
|
// if allowDecimal is true, we should allow decimal values
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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[],
|
|
139
144
|
isLoading: false,
|
|
140
145
|
error: null,
|
|
141
146
|
isValidating: false,
|
|
@@ -201,20 +206,22 @@ describe('LabResultsForm', () => {
|
|
|
201
206
|
|
|
202
207
|
test('validate numeric input with concept having only hiAbsolute', async () => {
|
|
203
208
|
const user = userEvent.setup();
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
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[],
|
|
218
225
|
isLoading: false,
|
|
219
226
|
error: null,
|
|
220
227
|
isValidating: false,
|
|
@@ -237,20 +244,22 @@ describe('LabResultsForm', () => {
|
|
|
237
244
|
|
|
238
245
|
test('validate numeric input with concept having only lowAbsolute', async () => {
|
|
239
246
|
const user = userEvent.setup();
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
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[],
|
|
254
263
|
isLoading: false,
|
|
255
264
|
error: null,
|
|
256
265
|
isValidating: false,
|
|
@@ -271,11 +280,76 @@ describe('LabResultsForm', () => {
|
|
|
271
280
|
});
|
|
272
281
|
});
|
|
273
282
|
|
|
274
|
-
test('
|
|
283
|
+
test('validate numeric input for multiple fields', async () => {
|
|
275
284
|
const user = userEvent.setup();
|
|
276
|
-
|
|
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
|
+
});
|
|
277
321
|
render(<LabResultsForm {...testProps} />);
|
|
278
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
|
+
|
|
340
|
+
test('submits form with valid data', async () => {
|
|
341
|
+
const user = userEvent.setup();
|
|
342
|
+
const mockCloseWorkspace = jest.fn();
|
|
343
|
+
const mockCloseWorkspaceWithSavedChanges = jest.fn();
|
|
344
|
+
|
|
345
|
+
render(
|
|
346
|
+
<LabResultsForm
|
|
347
|
+
{...testProps}
|
|
348
|
+
closeWorkspace={mockCloseWorkspace}
|
|
349
|
+
closeWorkspaceWithSavedChanges={mockCloseWorkspaceWithSavedChanges}
|
|
350
|
+
/>,
|
|
351
|
+
);
|
|
352
|
+
|
|
279
353
|
const input = await screen.findByLabelText(`Test Concept (0 - 100 mg/dL)`);
|
|
280
354
|
await user.type(input, '50');
|
|
281
355
|
|
|
@@ -283,53 +357,118 @@ describe('LabResultsForm', () => {
|
|
|
283
357
|
await user.click(saveButton);
|
|
284
358
|
|
|
285
359
|
await waitFor(() => {
|
|
286
|
-
expect(
|
|
360
|
+
expect(mockCloseWorkspaceWithSavedChanges).toHaveBeenCalled();
|
|
361
|
+
});
|
|
362
|
+
});
|
|
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();
|
|
287
424
|
});
|
|
288
425
|
});
|
|
289
426
|
|
|
290
427
|
test('validate numeric input where concept is a set', async () => {
|
|
291
428
|
const user = userEvent.setup();
|
|
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
|
-
|
|
331
|
-
|
|
332
|
-
|
|
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[],
|
|
333
472
|
isLoading: false,
|
|
334
473
|
error: null,
|
|
335
474
|
isValidating: false,
|
|
@@ -363,20 +502,22 @@ describe('LabResultsForm', () => {
|
|
|
363
502
|
|
|
364
503
|
test('lab results form submits the correct lab result payload when the concept is not a set', async () => {
|
|
365
504
|
const user = userEvent.setup();
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
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[],
|
|
380
521
|
isLoading: false,
|
|
381
522
|
error: null,
|
|
382
523
|
isValidating: false,
|
|
@@ -410,48 +551,50 @@ describe('LabResultsForm', () => {
|
|
|
410
551
|
|
|
411
552
|
test('lab results forms submits correct payload when the concept is a set and one set member is keyed', async () => {
|
|
412
553
|
const user = userEvent.setup();
|
|
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
|
-
|
|
453
|
-
|
|
454
|
-
|
|
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[],
|
|
455
598
|
isLoading: false,
|
|
456
599
|
error: null,
|
|
457
600
|
isValidating: false,
|
|
@@ -514,48 +657,50 @@ describe('LabResultsForm', () => {
|
|
|
514
657
|
|
|
515
658
|
test('lab results form submits correct payload when the concept is a set and both set members are keyed', async () => {
|
|
516
659
|
const user = userEvent.setup();
|
|
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
|
-
|
|
557
|
-
|
|
558
|
-
|
|
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[],
|
|
559
704
|
isLoading: false,
|
|
560
705
|
error: null,
|
|
561
706
|
isValidating: false,
|
|
@@ -630,13 +775,15 @@ describe('LabResultsForm', () => {
|
|
|
630
775
|
});
|
|
631
776
|
|
|
632
777
|
test('display error notification when the concept datatype is N/A', async () => {
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
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[],
|
|
640
787
|
isLoading: false,
|
|
641
788
|
error: null,
|
|
642
789
|
isValidating: false,
|
|
@@ -655,78 +802,80 @@ describe('LabResultsForm', () => {
|
|
|
655
802
|
|
|
656
803
|
test('should display second level of set members for a given concept, if present', () => {
|
|
657
804
|
const user = userEvent.setup();
|
|
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
|
-
|
|
728
|
-
|
|
729
|
-
|
|
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[],
|
|
730
879
|
isLoading: false,
|
|
731
880
|
error: null,
|
|
732
881
|
isValidating: false,
|