@openmrs/esm-patient-vitals-app 11.3.1-patch.9064 → 11.3.1-patch.9310

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.
Files changed (55) hide show
  1. package/.turbo/turbo-build.log +21 -18
  2. package/dist/3174.js +2 -0
  3. package/dist/3174.js.map +1 -0
  4. package/dist/4341.js +1 -0
  5. package/dist/4341.js.map +1 -0
  6. package/dist/5652.js +1 -0
  7. package/dist/5652.js.map +1 -0
  8. package/dist/5670.js +1 -1
  9. package/dist/5670.js.map +1 -1
  10. package/dist/6336.js +1 -0
  11. package/dist/6336.js.map +1 -0
  12. package/dist/7299.js +1 -1
  13. package/dist/7437.js +1 -0
  14. package/dist/7437.js.map +1 -0
  15. package/dist/8953.js +1 -1
  16. package/dist/9228.js +1 -0
  17. package/dist/9228.js.map +1 -0
  18. package/dist/main.js +1 -1
  19. package/dist/main.js.map +1 -1
  20. package/dist/openmrs-esm-patient-vitals-app.js +1 -1
  21. package/dist/openmrs-esm-patient-vitals-app.js.buildmanifest.json +155 -130
  22. package/dist/openmrs-esm-patient-vitals-app.js.map +1 -1
  23. package/dist/routes.json +1 -1
  24. package/package.json +4 -3
  25. package/src/biometrics/biometrics-base.component.tsx +4 -2
  26. package/src/biometrics/biometrics-main.component.tsx +11 -2
  27. package/src/biometrics/biometrics-overview.component.tsx +11 -2
  28. package/src/biometrics/biometrics-overview.test.tsx +3 -0
  29. package/src/biometrics/paginated-biometrics.component.tsx +3 -1
  30. package/src/common/data.resource.ts +20 -18
  31. package/src/common/helpers.ts +38 -9
  32. package/src/common/types.ts +13 -1
  33. package/src/components/action-menu/vitals-biometrics-action-menu.component.tsx +5 -5
  34. package/src/index.ts +6 -2
  35. package/src/routes.json +10 -4
  36. package/src/utils.ts +2 -1
  37. package/src/vitals/paginated-vitals.component.tsx +3 -1
  38. package/src/vitals/vitals-overview.component.tsx +2 -1
  39. package/src/vitals-and-biometrics-header/{vitals-header.component.tsx → vitals-header.extension.tsx} +31 -21
  40. package/src/vitals-and-biometrics-header/vitals-header.test.tsx +107 -11
  41. package/src/vitals-biometrics-form/exported-vitals-biometrics-form.workspace.tsx +640 -0
  42. package/src/vitals-biometrics-form/vitals-biometrics-form.test.tsx +38 -17
  43. package/src/vitals-biometrics-form/vitals-biometrics-form.workspace.tsx +19 -604
  44. package/src/vitals-biometrics-form/vitals-biometrics-input.component.tsx +4 -1
  45. package/dist/5415.js +0 -1
  46. package/dist/5415.js.map +0 -1
  47. package/dist/5639.js +0 -1
  48. package/dist/5639.js.map +0 -1
  49. package/dist/5810.js +0 -1
  50. package/dist/5810.js.map +0 -1
  51. package/dist/6712.js +0 -2
  52. package/dist/6712.js.map +0 -1
  53. package/dist/8803.js +0 -1
  54. package/dist/8803.js.map +0 -1
  55. /package/dist/{6712.js.LICENSE.txt → 3174.js.LICENSE.txt} +0 -0
@@ -2,11 +2,12 @@ import React from 'react';
2
2
  import { screen, render } from '@testing-library/react';
3
3
  import userEvent from '@testing-library/user-event';
4
4
  import { type FetchResponse, showSnackbar, useConfig, getDefaultsFromConfigSchema } from '@openmrs/esm-framework';
5
+ import { type PatientWorkspace2DefinitionProps } from '@openmrs/esm-patient-common-lib';
5
6
  import { createOrUpdateVitalsAndBiometrics, useEncounterVitalsAndBiometrics } from '../common';
6
7
  import { type ConfigObject, configSchema } from '../config-schema';
7
8
  import { mockConceptUnits, mockVitalsConceptMetadata, mockVitalsConfig } from '__mocks__';
8
9
  import { mockPatient } from 'tools';
9
- import VitalsAndBiometricsForm from './vitals-biometrics-form.workspace';
10
+ import VitalsAndBiometricsForm, { type VitalsAndBiometricsFormProps } from './vitals-biometrics-form.workspace';
10
11
 
11
12
  const heightValue = 180;
12
13
  const muacValue = 23;
@@ -17,14 +18,22 @@ const weightValue = 62;
17
18
  const systolicBloodPressureValue = 120;
18
19
  const temperatureValue = 37;
19
20
 
20
- const testProps = {
21
- closeWorkspace: () => {},
22
- closeWorkspaceWithSavedChanges: jest.fn(),
23
- patientUuid: mockPatient.id,
24
- patient: mockPatient,
25
- promptBeforeClosing: () => {},
26
- formContext: 'creating' as 'creating' | 'editing',
27
- setTitle: jest.fn(),
21
+ const defaultProps: PatientWorkspace2DefinitionProps<VitalsAndBiometricsFormProps, {}> = {
22
+ workspaceProps: {
23
+ formContext: 'creating',
24
+ },
25
+ windowProps: {},
26
+ groupProps: {
27
+ patientUuid: mockPatient.id,
28
+ patient: mockPatient,
29
+ visitContext: null,
30
+ mutateVisitContext: null,
31
+ },
32
+ workspaceName: '',
33
+ launchChildWorkspace: jest.fn(),
34
+ closeWorkspace: jest.fn(),
35
+ windowName: '',
36
+ isRootWorkspace: false,
28
37
  };
29
38
 
30
39
  const mockShowSnackbar = jest.mocked(showSnackbar);
@@ -145,10 +154,10 @@ function setupMockUseEncounterVitalsAndBiometrics() {
145
154
 
146
155
  describe('VitalsBiometricsForm', () => {
147
156
  it('renders the vitals and biometrics form', async () => {
148
- render(<VitalsAndBiometricsForm {...testProps} />);
157
+ renderVitalsAndBiometricsForm();
149
158
 
150
- expect(screen.getByText(/vitals/i)).toBeInTheDocument();
151
- expect(screen.getByText(/biometrics/i)).toBeInTheDocument();
159
+ expect(screen.getByText(/record vitals$/i)).toBeInTheDocument();
160
+ expect(screen.getByText(/record biometrics/i)).toBeInTheDocument();
152
161
  expect(screen.getByText(/blood pressure/i)).toBeInTheDocument();
153
162
  expect(screen.getByRole('spinbutton', { name: /systolic/i })).toBeInTheDocument();
154
163
  expect(screen.getByRole('spinbutton', { name: /diastolic/i })).toBeInTheDocument();
@@ -178,7 +187,7 @@ describe('VitalsBiometricsForm', () => {
178
187
  it("computes a patient's BMI from the given height and weight values", async () => {
179
188
  const user = userEvent.setup();
180
189
 
181
- render(<VitalsAndBiometricsForm {...testProps} />);
190
+ renderVitalsAndBiometricsForm();
182
191
 
183
192
  const heightInput = screen.getByRole('spinbutton', { name: /height/i });
184
193
  const weightInput = screen.getByRole('spinbutton', { name: /weight/i });
@@ -203,7 +212,7 @@ describe('VitalsBiometricsForm', () => {
203
212
  response as ReturnType<typeof createOrUpdateVitalsAndBiometrics>,
204
213
  );
205
214
 
206
- render(<VitalsAndBiometricsForm {...testProps} />);
215
+ renderVitalsAndBiometricsForm();
207
216
 
208
217
  const heightInput = screen.getByRole('spinbutton', { name: /height/i });
209
218
  const weightInput = screen.getByRole('spinbutton', { name: /weight/i });
@@ -272,7 +281,7 @@ describe('VitalsBiometricsForm', () => {
272
281
 
273
282
  it('correctly initializes the form with existing vitals and biometrics data while in edit mode', async () => {
274
283
  setupMockUseEncounterVitalsAndBiometrics();
275
- render(<VitalsAndBiometricsForm {...testProps} formContext="editing" editEncounterUuid="encounter-uuid" />);
284
+ renderVitalsAndBiometricsForm('editing', 'encounter-uuid');
276
285
 
277
286
  expect(screen.getByRole('spinbutton', { name: /height/i })).toHaveValue(170);
278
287
  expect(screen.getByRole('spinbutton', { name: /weight/i })).toHaveValue(65);
@@ -299,7 +308,7 @@ describe('VitalsBiometricsForm', () => {
299
308
  response as ReturnType<typeof createOrUpdateVitalsAndBiometrics>,
300
309
  );
301
310
 
302
- render(<VitalsAndBiometricsForm {...testProps} formContext="editing" editEncounterUuid="encounter-uuid" />);
311
+ renderVitalsAndBiometricsForm('editing', 'encounter-uuid');
303
312
 
304
313
  const weightInput = screen.getByRole('spinbutton', { name: /weight/i });
305
314
  const systolicInput = screen.getByRole('spinbutton', { name: /systolic/i });
@@ -368,7 +377,7 @@ describe('VitalsBiometricsForm', () => {
368
377
 
369
378
  mockCreateOrUpdateVitalsAndBiometrics.mockRejectedValueOnce(error);
370
379
 
371
- render(<VitalsAndBiometricsForm {...testProps} />);
380
+ renderVitalsAndBiometricsForm();
372
381
 
373
382
  const heightInput = screen.getByRole('spinbutton', { name: /height/i });
374
383
  const weightInput = screen.getByRole('spinbutton', { name: /weight/i });
@@ -401,3 +410,15 @@ describe('VitalsBiometricsForm', () => {
401
410
  });
402
411
  });
403
412
  });
413
+
414
+ function renderVitalsAndBiometricsForm(formContext?: 'creating' | 'editing', editEncounterUuid?: string) {
415
+ const props: PatientWorkspace2DefinitionProps<VitalsAndBiometricsFormProps, {}> = {
416
+ ...defaultProps,
417
+ workspaceProps: {
418
+ ...defaultProps.workspaceProps,
419
+ formContext: formContext ?? defaultProps.workspaceProps.formContext,
420
+ editEncounterUuid: editEncounterUuid ?? defaultProps.workspaceProps.editEncounterUuid,
421
+ },
422
+ };
423
+ return render(<VitalsAndBiometricsForm {...props} />);
424
+ }