@openmrs/esm-form-engine-lib 2.1.0-pre.1462 → 2.1.0-pre.1464

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-form-engine-lib",
3
- "version": "2.1.0-pre.1462",
3
+ "version": "2.1.0-pre.1464",
4
4
  "description": "React Form Engine for O3",
5
5
  "browser": "dist/openmrs-esm-form-engine-lib.js",
6
6
  "main": "src/index.ts",
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { act, render, screen } from '@testing-library/react';
3
- import { userEvent } from '@testing-library/user-event';
3
+ import userEvent from '@testing-library/user-event'; // Correct import for userEvent
4
4
  import { type FetchResponse, openmrsFetch, usePatient, useSession } from '@openmrs/esm-framework';
5
5
  import { type FormSchema } from '../../../types';
6
6
  import { mockPatient } from '__mocks__/patient.mock';
@@ -31,7 +31,7 @@ jest.mock('../../../api', () => {
31
31
  });
32
32
 
33
33
  const renderForm = async () => {
34
- await act(() =>
34
+ await act(async () => {
35
35
  render(
36
36
  <FormEngine
37
37
  formJson={multiSelectFormSchema as unknown as FormSchema}
@@ -40,11 +40,11 @@ const renderForm = async () => {
40
40
  formSessionIntent={undefined}
41
41
  visit={visit}
42
42
  />,
43
- ),
44
- );
43
+ );
44
+ });
45
45
  };
46
46
 
47
- describe.skip('MultiSelect Component', () => {
47
+ describe('MultiSelect Component', () => {
48
48
  beforeEach(() => {
49
49
  mockOpenmrsFetch.mockResolvedValue({
50
50
  data: { results: [{ ...multiSelectFormSchema }] },
@@ -69,22 +69,20 @@ describe.skip('MultiSelect Component', () => {
69
69
  it('should disable checkbox option if the field value depends on evaluates the expression to true', async () => {
70
70
  const user = userEvent.setup();
71
71
  await renderForm();
72
-
73
72
  await user.click(screen.getByRole('combobox', { name: /Patient covered by NHIF/i }));
74
73
  await user.click(screen.getByRole('option', { name: /no/i }));
75
-
76
74
  await user.click(screen.getByText('Was this visit scheduled?'));
77
- expect(screen.getByRole('option', { name: /Unscheduled visit early/i })).toHaveAttribute('disabled');
75
+ const unscheduledVisitOption = screen.getByRole('option', { name: /Unscheduled visit early/i });
76
+ expect(unscheduledVisitOption).toHaveAttribute('disabled');
78
77
  });
79
78
 
80
79
  it('should enable checkbox option if the field value depends on evaluates the expression to false', async () => {
81
80
  const user = userEvent.setup();
82
81
  await renderForm();
83
-
84
82
  await user.click(screen.getByRole('combobox', { name: /patient covered by nhif/i }));
85
83
  await user.click(screen.getByRole('option', { name: /yes/i }));
86
-
87
84
  await user.click(screen.getByText('Was this visit scheduled?'));
88
- expect(screen.getByRole('option', { name: /Unscheduled visit early/i })).not.toHaveAttribute('disabled');
85
+ const unscheduledVisitOption = screen.getByRole('option', { name: /Unscheduled visit early/i });
86
+ expect(unscheduledVisitOption).not.toBeDisabled();
89
87
  });
90
88
  });