@openmrs/esm-form-builder-app 3.4.2-pre.3477 → 3.4.2-pre.3479
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/dist/4701.js +2 -2
- package/dist/4701.js.map +1 -1
- package/dist/5491.js +2 -2
- package/dist/5491.js.map +1 -1
- package/dist/openmrs-esm-form-builder-app.js.buildmanifest.json +6 -6
- package/dist/routes.json +1 -1
- package/package.json +12 -13
- package/src/components/dashboard/dashboard.test.tsx +7 -6
- package/src/components/interactive-builder/drag-and-drop-helpers.test.ts +1 -0
- package/src/components/interactive-builder/interactive-builder.test.tsx +3 -2
- package/src/components/interactive-builder/modals/add-form-reference/add-form-reference.test.tsx +4 -3
- package/src/components/interactive-builder/modals/question/question-form/common/concept-search/concept-search.test.tsx +15 -14
- package/src/components/interactive-builder/modals/question/question-form/question/question.test.tsx +3 -2
- package/src/components/interactive-builder/modals/question/question-form/question-types/inputs/obs/obs-type-question.test.tsx +14 -13
- package/src/components/interactive-builder/modals/question/question-form/question-types/inputs/patient-identifier/patient-identifier-type.test.tsx +8 -7
- package/src/components/interactive-builder/modals/question/question-form/question-types/inputs/person-attribute/person-attribute-type-question.test.tsx +7 -6
- package/src/components/interactive-builder/modals/question/question-form/question-types/inputs/program-state/program-state.test.tsx +14 -13
- package/src/components/interactive-builder/modals/question/question-form/question-types/inputs/test-order/test-order-type-question.test.tsx +15 -14
- package/src/components/interactive-builder/modals/question/question-form/question-types/question-type.test.tsx +5 -4
- package/src/components/interactive-builder/modals/question/question-form/rendering-types/inputs/date/date.test.tsx +4 -3
- package/src/components/interactive-builder/modals/question/question-form/rendering-types/inputs/number/number.test.tsx +4 -3
- package/src/components/interactive-builder/modals/question/question-form/rendering-types/inputs/select/select-answers.test.tsx +9 -8
- package/src/components/interactive-builder/modals/question/question-form/rendering-types/inputs/text/text.test.tsx +4 -3
- package/src/components/interactive-builder/modals/question/question-form/rendering-types/inputs/text-area/textarea.test.tsx +4 -3
- package/src/components/interactive-builder/modals/question/question-form/rendering-types/inputs/toggle/toggle.test.tsx +4 -3
- package/src/components/interactive-builder/modals/question/question-form/rendering-types/inputs/ui-select-extended/ui-select-extended.test.tsx +4 -3
- package/src/components/interactive-builder/modals/question/question-form/rendering-types/rendering-type.test.tsx +5 -4
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
|
2
3
|
import { render, screen, within } from '@testing-library/react';
|
|
3
4
|
import SelectAnswers from './select-answers.component';
|
|
4
5
|
import { useConceptId } from '@hooks/useConceptId';
|
|
@@ -36,15 +37,15 @@ const concepts: Array<Concept> = [
|
|
|
36
37
|
},
|
|
37
38
|
];
|
|
38
39
|
|
|
39
|
-
const mockUseConceptLookup =
|
|
40
|
-
|
|
41
|
-
...
|
|
42
|
-
useConceptLookup:
|
|
40
|
+
const mockUseConceptLookup = vi.mocked(useConceptLookup);
|
|
41
|
+
vi.mock('@hooks/useConceptLookup', async () => ({
|
|
42
|
+
...((await vi.importActual('@hooks/useConceptLookup')) as object),
|
|
43
|
+
useConceptLookup: vi.fn(),
|
|
43
44
|
}));
|
|
44
|
-
const mockUseConceptId =
|
|
45
|
-
|
|
46
|
-
...
|
|
47
|
-
useConceptId:
|
|
45
|
+
const mockUseConceptId = vi.mocked(useConceptId);
|
|
46
|
+
vi.mock('@hooks/useConceptId', async () => ({
|
|
47
|
+
...((await vi.importActual('@hooks/useConceptId')) as object),
|
|
48
|
+
useConceptId: vi.fn(),
|
|
48
49
|
}));
|
|
49
50
|
|
|
50
51
|
describe('Select answers component', () => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { vi, describe, it, expect } from 'vitest';
|
|
2
3
|
import { render, screen } from '@testing-library/react';
|
|
3
4
|
import userEvent from '@testing-library/user-event';
|
|
4
5
|
import Text from './text.component';
|
|
@@ -6,7 +7,7 @@ import { FormFieldProvider } from '../../../../form-field-context';
|
|
|
6
7
|
|
|
7
8
|
import type { FormField } from '@openmrs/esm-form-engine-lib';
|
|
8
9
|
|
|
9
|
-
const mockSetFormField =
|
|
10
|
+
const mockSetFormField = vi.fn();
|
|
10
11
|
const formField: FormField = {
|
|
11
12
|
datePickerFormat: 'both',
|
|
12
13
|
type: 'obs',
|
|
@@ -14,8 +15,8 @@ const formField: FormField = {
|
|
|
14
15
|
id: '1',
|
|
15
16
|
};
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
...
|
|
18
|
+
vi.mock('../../../../form-field-context', async () => ({
|
|
19
|
+
...((await vi.importActual('../../../../form-field-context')) as object),
|
|
19
20
|
useFormField: () => ({ formField, setFormField: mockSetFormField }),
|
|
20
21
|
}));
|
|
21
22
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { vi, describe, it, expect } from 'vitest';
|
|
2
3
|
import { render, screen } from '@testing-library/react';
|
|
3
4
|
import userEvent from '@testing-library/user-event';
|
|
4
5
|
import TextArea from './textarea.component';
|
|
5
6
|
import { FormFieldProvider } from '../../../../form-field-context';
|
|
6
7
|
import type { FormField } from '@openmrs/esm-form-engine-lib';
|
|
7
8
|
|
|
8
|
-
const mockSetFormField =
|
|
9
|
+
const mockSetFormField = vi.fn();
|
|
9
10
|
const formField: FormField = {
|
|
10
11
|
datePickerFormat: 'both',
|
|
11
12
|
type: 'obs',
|
|
@@ -13,8 +14,8 @@ const formField: FormField = {
|
|
|
13
14
|
id: '1',
|
|
14
15
|
};
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
...
|
|
17
|
+
vi.mock('../../../../form-field-context', async () => ({
|
|
18
|
+
...((await vi.importActual('../../../../form-field-context')) as object),
|
|
18
19
|
useFormField: () => ({ formField, setFormField: mockSetFormField }),
|
|
19
20
|
}));
|
|
20
21
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { vi, describe, it, expect } from 'vitest';
|
|
2
3
|
import { fireEvent, render, screen } from '@testing-library/react';
|
|
3
4
|
import Toggle from './toggle.component';
|
|
4
5
|
import { FormFieldProvider } from '../../../../form-field-context';
|
|
5
6
|
import type { FormField } from '@openmrs/esm-form-engine-lib';
|
|
6
7
|
|
|
7
|
-
const mockSetFormField =
|
|
8
|
+
const mockSetFormField = vi.fn();
|
|
8
9
|
const formField: FormField = {
|
|
9
10
|
datePickerFormat: 'both',
|
|
10
11
|
type: 'obs',
|
|
@@ -12,8 +13,8 @@ const formField: FormField = {
|
|
|
12
13
|
id: '1',
|
|
13
14
|
};
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
...
|
|
16
|
+
vi.mock('../../../../form-field-context', async () => ({
|
|
17
|
+
...((await vi.importActual('../../../../form-field-context')) as object),
|
|
17
18
|
useFormField: () => ({ formField, setFormField: mockSetFormField }),
|
|
18
19
|
}));
|
|
19
20
|
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { vi, describe, it, expect } from 'vitest';
|
|
2
3
|
import { render, screen } from '@testing-library/react';
|
|
3
4
|
import userEvent from '@testing-library/user-event';
|
|
4
5
|
import UiSelectExtended from './ui-select-extended.component';
|
|
5
6
|
import { FormFieldProvider } from '../../../../form-field-context';
|
|
6
7
|
import type { FormField } from '@openmrs/esm-form-engine-lib';
|
|
7
8
|
|
|
8
|
-
const mockSetFormField =
|
|
9
|
+
const mockSetFormField = vi.fn();
|
|
9
10
|
const formField: FormField = {
|
|
10
11
|
type: 'obs',
|
|
11
12
|
questionOptions: { rendering: 'ui-select-extended', isSearchable: false },
|
|
12
13
|
id: '1',
|
|
13
14
|
};
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
...
|
|
16
|
+
vi.mock('../../../../form-field-context', async () => ({
|
|
17
|
+
...((await vi.importActual('../../../../form-field-context')) as object),
|
|
17
18
|
useFormField: () => ({ formField, setFormField: mockSetFormField }),
|
|
18
19
|
}));
|
|
19
20
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { vi, describe, it, expect } from 'vitest';
|
|
2
3
|
import { render, screen } from '@testing-library/react';
|
|
3
4
|
import RenderingTypeComponent from './rendering-type.component';
|
|
4
5
|
import { FormFieldProvider } from '../../form-field-context';
|
|
5
6
|
import type { FormField } from '@openmrs/esm-form-engine-lib';
|
|
6
7
|
|
|
7
|
-
const mockSetFormField =
|
|
8
|
+
const mockSetFormField = vi.fn();
|
|
8
9
|
const formField: FormField = {
|
|
9
10
|
datePickerFormat: 'both',
|
|
10
11
|
type: 'obs',
|
|
@@ -12,8 +13,8 @@ const formField: FormField = {
|
|
|
12
13
|
id: '1',
|
|
13
14
|
};
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
...
|
|
16
|
+
vi.mock('../../form-field-context', async () => ({
|
|
17
|
+
...((await vi.importActual('../../form-field-context')) as object),
|
|
17
18
|
useFormField: () => ({ formField, setFormField: mockSetFormField }),
|
|
18
19
|
}));
|
|
19
20
|
|
|
@@ -78,7 +79,7 @@ describe('RenderingType Component', () => {
|
|
|
78
79
|
});
|
|
79
80
|
|
|
80
81
|
it('renders component only if rendering type is allowed', () => {
|
|
81
|
-
const consoleErrorSpy =
|
|
82
|
+
const consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
82
83
|
formField.type = 'encounterLocation';
|
|
83
84
|
formField.questionOptions.rendering = 'date';
|
|
84
85
|
renderRenderingTypeComponent();
|