@openmrs/esm-service-queues-app 5.2.2-pre.2409 → 5.2.2-pre.2415
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 +1 -1
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/active-visits/active-visits-table.test.tsx +2 -2
- package/src/active-visits/change-status-dialog.test.tsx +5 -5
- package/src/add-provider-queue-room/add-provider-queue-room.test.tsx +15 -12
- package/src/clear-queue-entries-dialog/clear-queue-entries-dialog.test.tsx +6 -3
- package/src/current-visit/current-visit-summary.test.tsx +7 -11
- package/src/overlay.test.tsx +6 -4
- package/src/patient-search/visit-form/base-visit-type.test.tsx +10 -5
- package/src/patient-search/visit-form-queue-fields/visit-form-queue-fields.test.tsx +8 -5
- package/src/queue-patient-linelists/queue-linelist-filter.test.tsx +26 -14
- package/src/queue-patient-linelists/queue-linelist.test.tsx +6 -3
- package/src/queue-patient-linelists/scheduled-appointments-table.test.tsx +7 -3
- package/src/queue-rooms/queue-room-form.test.tsx +22 -11
- package/src/queue-services/queue-service-form.test.tsx +10 -5
- package/src/remove-queue-entry-dialog/remove-queue-entry.test.tsx +6 -3
- package/src/transition-queue-entry/transition-queue-entry-dialog.test.tsx +13 -12
package/.turbo/turbo-build.log
CHANGED
package/dist/routes.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":"^2.2.0"},"extensions":[{"name":"outpatient-side-nav-ext","component":"outpatientSideNav","slot":"outpatient-sidebar-slot","online":true,"offline":true},{"name":"service-queues-dashboard-link","component":"serviceQueuesDashboardLink","slot":"homepage-dashboard-slot","meta":{"name":"service-queues","slot":"service-queues-dashboard-slot","title":"Service queues"},"online":true,"offline":true},{"component":"root","name":"service-queues-dashboard","slot":"service-queues-dashboard-slot"},{"name":"edit-queue-entry-status-modal","component":"editQueueEntryStatusModal"},{"name":"patient-info-banner-slot","component":"patientInfoBannerSlot"},{"name":"add-patient-to-queue","component":"addPatientToQueue","slot":"add-patient-to-queue-slot"},{"name":"remove-queue-entry","component":"removeQueueEntry"},{"name":"clear-all-queue-entries","component":"clearAllQueueEntries"},{"name":"add-visit-to-queue-modal","component":"addVisitToQueueModal"},{"name":"transition-queue-entry-status-modal","component":"transitionQueueEntryStatusModal"},{"name":"previous-visit-summary-widget","component":"pastVisitSummary","slot":"previous-visit-summary-slot"},{"name":"add-provider-to-room-modal","component":"addProviderToRoomModal"},{"name":"add-queue-entry-widget","component":"addQueueEntry","slot":"add-queue-entry-slot"}],"version":"5.2.2-pre.
|
|
1
|
+
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":"^2.2.0"},"extensions":[{"name":"outpatient-side-nav-ext","component":"outpatientSideNav","slot":"outpatient-sidebar-slot","online":true,"offline":true},{"name":"service-queues-dashboard-link","component":"serviceQueuesDashboardLink","slot":"homepage-dashboard-slot","meta":{"name":"service-queues","slot":"service-queues-dashboard-slot","title":"Service queues"},"online":true,"offline":true},{"component":"root","name":"service-queues-dashboard","slot":"service-queues-dashboard-slot"},{"name":"edit-queue-entry-status-modal","component":"editQueueEntryStatusModal"},{"name":"patient-info-banner-slot","component":"patientInfoBannerSlot"},{"name":"add-patient-to-queue","component":"addPatientToQueue","slot":"add-patient-to-queue-slot"},{"name":"remove-queue-entry","component":"removeQueueEntry"},{"name":"clear-all-queue-entries","component":"clearAllQueueEntries"},{"name":"add-visit-to-queue-modal","component":"addVisitToQueueModal"},{"name":"transition-queue-entry-status-modal","component":"transitionQueueEntryStatusModal"},{"name":"previous-visit-summary-widget","component":"pastVisitSummary","slot":"previous-visit-summary-slot"},{"name":"add-provider-to-room-modal","component":"addProviderToRoomModal"},{"name":"add-queue-entry-widget","component":"addQueueEntry","slot":"add-queue-entry-slot"}],"version":"5.2.2-pre.2415"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { screen
|
|
2
|
+
import { screen } from '@testing-library/react';
|
|
3
3
|
import { ConfigObject, useConfig, usePagination, useSession } from '@openmrs/esm-framework';
|
|
4
4
|
import { of } from 'rxjs';
|
|
5
5
|
import { renderWithSwr } from '../../../../tools/test-helpers';
|
|
@@ -103,7 +103,7 @@ describe('ActiveVisitsTable: ', () => {
|
|
|
103
103
|
|
|
104
104
|
renderActiveVisitsTable();
|
|
105
105
|
|
|
106
|
-
await
|
|
106
|
+
await screen.findByRole('table');
|
|
107
107
|
|
|
108
108
|
expect(screen.getByText(/patients currently in queue/i)).toBeInTheDocument();
|
|
109
109
|
expect(screen.queryByText(/no patients to display/i)).not.toBeInTheDocument();
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { screen, render, within } from '@testing-library/react';
|
|
3
4
|
import { mockServices } from '../../__mocks__/active-visits.mock';
|
|
4
5
|
import { mockPriorities, mockStatus } from '../../../../__mocks__/metrics.mock';
|
|
5
6
|
import { mockSession } from '../../../../__mocks__/session.mock';
|
|
6
7
|
import { mockLocations } from '../../../../__mocks__/locations.mock';
|
|
7
8
|
import { ConfigObject, showToast, useConfig, showNotification } from '@openmrs/esm-framework';
|
|
8
|
-
import ChangeStatus from './change-status-dialog.component';
|
|
9
9
|
import { mockQueueEntry } from '../../../../__mocks__/queue-entry.mock';
|
|
10
|
-
import userEvent from '@testing-library/user-event';
|
|
11
10
|
import { updateQueueEntry } from './active-visits-table.resource';
|
|
11
|
+
import ChangeStatus from './change-status-dialog.component';
|
|
12
12
|
|
|
13
13
|
const mockedUseConfig = useConfig as jest.Mock;
|
|
14
14
|
const mockShowToast = showToast as jest.Mock;
|
|
@@ -61,7 +61,7 @@ describe('Queue entry details', () => {
|
|
|
61
61
|
expect(screen.getByText(/queue service/i)).toBeInTheDocument();
|
|
62
62
|
expect(screen.getByText(/queue priority/i)).toBeInTheDocument();
|
|
63
63
|
|
|
64
|
-
await
|
|
64
|
+
await user.click(screen.getByRole('button', { name: /move to next service/i }));
|
|
65
65
|
|
|
66
66
|
expect(mockShowToast).toHaveBeenCalledTimes(1);
|
|
67
67
|
expect(mockShowToast).toHaveBeenCalledWith({
|
|
@@ -93,7 +93,7 @@ describe('Queue entry details', () => {
|
|
|
93
93
|
expect(within(queueServiceTypes).getAllByRole('option')[0]).toHaveValue('176052c7-5fd4-4b33-89cc-7bae6848c65a');
|
|
94
94
|
expect(within(queueServiceTypes).getAllByRole('option')[1]).toHaveValue('d80ff12a-06a7-11ed-b939-0242ac120002');
|
|
95
95
|
|
|
96
|
-
await
|
|
96
|
+
await user.click(screen.getByRole('button', { name: /move to next service/i }));
|
|
97
97
|
|
|
98
98
|
expect(mockShowNotification).toHaveBeenCalledWith({
|
|
99
99
|
description: 'Internal Server Error',
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
4
|
import { showSnackbar } from '@openmrs/esm-framework';
|
|
5
|
+
import AddProviderQueueRoom from './add-provider-queue-room.component';
|
|
5
6
|
|
|
6
7
|
jest.mock('@openmrs/esm-framework', () => ({
|
|
7
8
|
...jest.requireActual('@openmrs/esm-framework'),
|
|
@@ -61,37 +62,39 @@ describe('AddProviderQueueRoom', () => {
|
|
|
61
62
|
expect(screen.getByText('Save')).toBeInTheDocument();
|
|
62
63
|
});
|
|
63
64
|
|
|
64
|
-
it('updates queue room selection', () => {
|
|
65
|
+
it('updates the queue room selection', async () => {
|
|
66
|
+
const user = userEvent.setup();
|
|
65
67
|
render(<AddProviderQueueRoom providerUuid={providerUuid} closeModal={jest.fn()} />);
|
|
66
68
|
|
|
67
69
|
const selectQueueRoom: HTMLInputElement = screen.getByRole('combobox');
|
|
68
|
-
|
|
70
|
+
await user.selectOptions(selectQueueRoom, 'Room 1');
|
|
69
71
|
|
|
70
72
|
expect(selectQueueRoom.value).toBe('6b3e233d-2b44-40ca-b0c8-c5a57a8c51b6');
|
|
71
73
|
});
|
|
72
74
|
|
|
73
|
-
it('should update the retain location checkbox', () => {
|
|
75
|
+
it('should update the retain location checkbox', async () => {
|
|
76
|
+
const user = userEvent.setup();
|
|
74
77
|
render(<AddProviderQueueRoom providerUuid={providerUuid} closeModal={jest.fn()} />);
|
|
75
78
|
|
|
76
79
|
const retainLocationCheckbox: HTMLInputElement = screen.getByRole('checkbox');
|
|
77
|
-
|
|
80
|
+
await user.click(retainLocationCheckbox);
|
|
78
81
|
|
|
79
82
|
expect(retainLocationCheckbox.checked).toBe(true);
|
|
80
83
|
});
|
|
81
84
|
|
|
82
85
|
it('should submit the form and add provider to queue room when all fields are filled', async () => {
|
|
86
|
+
const user = userEvent.setup();
|
|
83
87
|
const mockCloseModal = jest.fn();
|
|
88
|
+
|
|
84
89
|
render(<AddProviderQueueRoom providerUuid={providerUuid} closeModal={mockCloseModal} />);
|
|
85
90
|
|
|
86
91
|
const queueRoomSelect = screen.getByRole('combobox');
|
|
87
92
|
const submitButton = screen.getByText('Save');
|
|
88
93
|
|
|
89
|
-
|
|
90
|
-
|
|
94
|
+
await user.selectOptions(queueRoomSelect, '6b3e233d-2b44-40ca-b0c8-c5a57a8c51b6');
|
|
95
|
+
await user.click(submitButton);
|
|
91
96
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
expect(showSnackbar).toHaveBeenCalled();
|
|
95
|
-
});
|
|
97
|
+
expect(mockCloseModal).toHaveBeenCalled();
|
|
98
|
+
expect(showSnackbar).toHaveBeenCalled();
|
|
96
99
|
});
|
|
97
100
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
4
|
import { batchClearQueueEntries } from './clear-queue-entries-dialog.resource';
|
|
5
|
+
import ClearQueueEntriesDialog from './clear-queue-entries-dialog.component';
|
|
5
6
|
|
|
6
7
|
const mockBatchClearQueueEntries = batchClearQueueEntries as jest.Mock;
|
|
7
8
|
|
|
@@ -31,11 +32,13 @@ describe('ClearQueueEntriesDialog Component', () => {
|
|
|
31
32
|
});
|
|
32
33
|
|
|
33
34
|
it('should close modal when clicked on cancel', async () => {
|
|
35
|
+
const user = userEvent.setup();
|
|
34
36
|
const closeModalMock = jest.fn();
|
|
37
|
+
|
|
35
38
|
mockBatchClearQueueEntries.mockImplementationOnce(() => Promise.resolve());
|
|
36
39
|
render(<ClearQueueEntriesDialog visitQueueEntries={visitQueueEntriesMock} closeModal={closeModalMock} />);
|
|
37
40
|
|
|
38
|
-
|
|
41
|
+
await user.click(screen.getByText('Cancel'));
|
|
39
42
|
|
|
40
43
|
expect(closeModalMock).toHaveBeenCalled();
|
|
41
44
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render, screen
|
|
3
|
-
import CurrentVisit from './current-visit-summary.component';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
4
3
|
import { useVisit } from './current-visit.resource';
|
|
5
4
|
import { mockPastVisit } from '../../__mocks__/visits.mock';
|
|
5
|
+
import CurrentVisit from './current-visit-summary.component';
|
|
6
6
|
|
|
7
7
|
const useVisitMock = useVisit as jest.Mock;
|
|
8
8
|
|
|
@@ -24,12 +24,10 @@ describe('CurrentVisit', () => {
|
|
|
24
24
|
it('renders visit details correctly', async () => {
|
|
25
25
|
render(<CurrentVisit patientUuid={patientUuid} visitUuid={visitUuid} />);
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
expect(screen.getByText('On time')).toBeInTheDocument();
|
|
32
|
-
});
|
|
27
|
+
expect(screen.queryByRole('progressbar')).toBeNull();
|
|
28
|
+
expect(screen.getByText('Visit Type')).toBeInTheDocument();
|
|
29
|
+
expect(screen.getByText('Scheduled for today')).toBeInTheDocument();
|
|
30
|
+
expect(screen.getByText('On time')).toBeInTheDocument();
|
|
33
31
|
});
|
|
34
32
|
it('should render skeleton when loading', async () => {
|
|
35
33
|
useVisitMock.mockImplementationOnce(() => ({
|
|
@@ -40,8 +38,6 @@ describe('CurrentVisit', () => {
|
|
|
40
38
|
|
|
41
39
|
render(<CurrentVisit patientUuid={patientUuid} visitUuid={visitUuid} />);
|
|
42
40
|
|
|
43
|
-
|
|
44
|
-
expect(screen.getByRole('progressbar')).toBeInTheDocument();
|
|
45
|
-
});
|
|
41
|
+
expect(screen.getByRole('progressbar')).toBeInTheDocument();
|
|
46
42
|
});
|
|
47
43
|
});
|
package/src/overlay.test.tsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
4
|
import { useLayoutType, isDesktop } from '@openmrs/esm-framework';
|
|
5
|
+
import Overlay from './overlay.component';
|
|
5
6
|
|
|
6
7
|
const mockUseLayoutType = useLayoutType as jest.Mock;
|
|
7
8
|
const mockIsDesktop = isDesktop as jest.Mock;
|
|
@@ -11,7 +12,8 @@ jest.mock('@openmrs/esm-framework');
|
|
|
11
12
|
const headerText = 'Test Header';
|
|
12
13
|
|
|
13
14
|
describe('Overlay Component', () => {
|
|
14
|
-
it('renders desktop layout with close button', () => {
|
|
15
|
+
it('renders desktop layout with close button', async () => {
|
|
16
|
+
const user = userEvent.setup();
|
|
15
17
|
const closePanelMock = jest.fn();
|
|
16
18
|
|
|
17
19
|
mockIsDesktop.mockImplementation(() => true);
|
|
@@ -24,7 +26,7 @@ describe('Overlay Component', () => {
|
|
|
24
26
|
expect(headerContent).toBeInTheDocument();
|
|
25
27
|
expect(closeButton).toBeInTheDocument();
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
await user.click(closeButton);
|
|
28
30
|
expect(closePanelMock).toHaveBeenCalled();
|
|
29
31
|
});
|
|
30
32
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
3
|
import BaseVisitType from './base-visit-type.component';
|
|
4
|
+
import { render, screen } from '@testing-library/react';
|
|
4
5
|
import { mockVisitTypes } from '../../../__mocks__/visits.mock';
|
|
5
6
|
|
|
6
7
|
jest.mock('@openmrs/esm-framework', () => ({
|
|
@@ -21,21 +22,25 @@ describe('BaseVisitType', () => {
|
|
|
21
22
|
});
|
|
22
23
|
});
|
|
23
24
|
|
|
24
|
-
it('handles search input correctly', () => {
|
|
25
|
+
it('handles search input correctly', async () => {
|
|
26
|
+
const user = userEvent.setup();
|
|
27
|
+
|
|
25
28
|
render(<BaseVisitType onChange={() => {}} visitTypes={mockVisitTypes} />);
|
|
26
29
|
|
|
27
30
|
const searchInput: HTMLInputElement = screen.getByRole('searchbox');
|
|
28
|
-
|
|
31
|
+
await user.type(searchInput, 'Visit Type 1');
|
|
29
32
|
|
|
30
33
|
expect(searchInput.value).toBe('Visit Type 1');
|
|
31
34
|
});
|
|
32
35
|
|
|
33
|
-
it('calls onChange when a visit type is selected', () => {
|
|
36
|
+
it('calls onChange when a visit type is selected', async () => {
|
|
37
|
+
const user = userEvent.setup();
|
|
38
|
+
|
|
34
39
|
const mockOnChange = jest.fn();
|
|
35
40
|
render(<BaseVisitType onChange={mockOnChange} visitTypes={mockVisitTypes} />);
|
|
36
41
|
|
|
37
42
|
const radioButton: HTMLInputElement = screen.getByLabelText(mockVisitTypes[0].display);
|
|
38
|
-
|
|
43
|
+
await user.click(radioButton);
|
|
39
44
|
expect(radioButton.checked).toBe(true);
|
|
40
45
|
});
|
|
41
46
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { render } from '@testing-library/react';
|
|
3
4
|
import StartVisitQueueFields from './visit-form-queue-fields.component';
|
|
4
5
|
|
|
5
6
|
jest.mock('@openmrs/esm-framework', () => ({
|
|
@@ -46,20 +47,22 @@ describe('StartVisitQueueFields', () => {
|
|
|
46
47
|
expect(getByLabelText('Sort weight')).toBeInTheDocument();
|
|
47
48
|
});
|
|
48
49
|
|
|
49
|
-
it('updates the selected queue location', () => {
|
|
50
|
+
it('updates the selected queue location', async () => {
|
|
51
|
+
const user = userEvent.setup();
|
|
50
52
|
const { getByLabelText } = render(<StartVisitQueueFields />);
|
|
51
53
|
|
|
52
54
|
const selectQueueLocation = getByLabelText('Select a queue location') as HTMLInputElement;
|
|
53
|
-
|
|
55
|
+
await user.type(selectQueueLocation, '1');
|
|
54
56
|
|
|
55
57
|
expect(selectQueueLocation.value).toBe('1');
|
|
56
58
|
});
|
|
57
59
|
|
|
58
|
-
it('updates the selected service', () => {
|
|
60
|
+
it('updates the selected service', async () => {
|
|
61
|
+
const user = userEvent.setup();
|
|
59
62
|
const { getByLabelText } = render(<StartVisitQueueFields />);
|
|
60
63
|
|
|
61
64
|
const selectService = getByLabelText('Select a service') as HTMLInputElement;
|
|
62
|
-
|
|
65
|
+
await user.type(selectService, 'service-1');
|
|
63
66
|
|
|
64
67
|
expect(selectService.value).toBe('e2ec9cf0-ec38-4d2b-af6c-59c82fa30b90');
|
|
65
68
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
4
|
import { mockVisitTypes } from '../../__mocks__/visits.mock';
|
|
5
|
+
import QueueLinelistFilter from './queue-linelist-filter.component';
|
|
5
6
|
|
|
6
7
|
jest.mock('@openmrs/esm-framework', () => ({
|
|
7
8
|
...jest.requireActual('@openmrs/esm-framework'),
|
|
@@ -9,7 +10,6 @@ jest.mock('@openmrs/esm-framework', () => ({
|
|
|
9
10
|
useVisitTypes: jest.fn(() => mockVisitTypes),
|
|
10
11
|
toOpemrsIsoString: jest.fn(),
|
|
11
12
|
}));
|
|
12
|
-
// Additional mock functions if needed
|
|
13
13
|
|
|
14
14
|
describe('QueueLinelistFilter', () => {
|
|
15
15
|
it('renders the form with filter elements', () => {
|
|
@@ -26,50 +26,62 @@ describe('QueueLinelistFilter', () => {
|
|
|
26
26
|
expect(screen.getByText('Apply filters')).toBeInTheDocument();
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
it('calls closePanel function when cancel button is clicked', () => {
|
|
29
|
+
it('calls closePanel function when cancel button is clicked', async () => {
|
|
30
|
+
const user = userEvent.setup();
|
|
30
31
|
const closePanelMock = jest.fn();
|
|
32
|
+
|
|
31
33
|
render(<QueueLinelistFilter closePanel={closePanelMock} />);
|
|
32
34
|
|
|
33
35
|
const cancelButton = screen.getByText('Cancel');
|
|
34
|
-
|
|
36
|
+
await user.click(cancelButton);
|
|
35
37
|
|
|
36
38
|
expect(closePanelMock).toHaveBeenCalledTimes(1);
|
|
37
39
|
});
|
|
38
40
|
|
|
39
|
-
it('updates gender state when a radio button is selected', () => {
|
|
41
|
+
it('updates gender state when a radio button is selected', async () => {
|
|
42
|
+
const user = userEvent.setup();
|
|
43
|
+
|
|
40
44
|
render(<QueueLinelistFilter closePanel={jest.fn()} />);
|
|
41
45
|
|
|
42
46
|
const maleRadioButton = screen.getByLabelText('Male');
|
|
43
|
-
|
|
47
|
+
await user.click(maleRadioButton);
|
|
44
48
|
|
|
45
49
|
expect(maleRadioButton).toBeChecked();
|
|
46
50
|
});
|
|
47
51
|
|
|
48
|
-
it('updates startAge state when a number is entered', () => {
|
|
52
|
+
it('updates startAge state when a number is entered', async () => {
|
|
53
|
+
const user = userEvent.setup();
|
|
49
54
|
render(<QueueLinelistFilter closePanel={jest.fn()} />);
|
|
50
55
|
|
|
51
56
|
const startAgeInput = screen.getByLabelText('Between');
|
|
52
|
-
|
|
57
|
+
await user.type(startAgeInput, '10');
|
|
53
58
|
|
|
54
59
|
expect(startAgeInput).toHaveValue(10);
|
|
55
60
|
});
|
|
56
61
|
|
|
57
|
-
it('updates returnDate state when date input changes', () => {
|
|
62
|
+
it('updates returnDate state when date input changes', async () => {
|
|
63
|
+
const user = userEvent.setup();
|
|
64
|
+
|
|
58
65
|
render(<QueueLinelistFilter closePanel={jest.fn()} />);
|
|
59
66
|
|
|
60
67
|
const returnDateInput = screen.getByLabelText('Date');
|
|
61
|
-
|
|
68
|
+
|
|
69
|
+
await user.clear(returnDateInput);
|
|
70
|
+
await user.type(returnDateInput, '2023-08-20');
|
|
62
71
|
|
|
63
72
|
expect(returnDateInput).toHaveValue('2023-08-20');
|
|
64
73
|
});
|
|
65
74
|
|
|
66
|
-
it('should open the visit type dropdown and close after selection', () => {
|
|
75
|
+
it('should open the visit type dropdown and close after selection', async () => {
|
|
76
|
+
const user = userEvent.setup();
|
|
77
|
+
|
|
67
78
|
render(<QueueLinelistFilter closePanel={jest.fn()} />);
|
|
68
79
|
|
|
69
80
|
const visitTypeDropdown = screen.getByRole('button', { name: /Select visit type/i });
|
|
70
|
-
|
|
81
|
+
await user.click(visitTypeDropdown);
|
|
82
|
+
|
|
71
83
|
const type1Option = screen.getByText('Outpatient Visit');
|
|
72
|
-
|
|
84
|
+
await user.click(type1Option);
|
|
73
85
|
|
|
74
86
|
expect(visitTypeDropdown).toHaveTextContent('Open menu');
|
|
75
87
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
3
4
|
import QueueLinelist from './queue-linelist.component';
|
|
4
5
|
|
|
5
6
|
describe('QueueLinelist', () => {
|
|
@@ -10,11 +11,13 @@ describe('QueueLinelist', () => {
|
|
|
10
11
|
expect(filterContent).toBeInTheDocument();
|
|
11
12
|
});
|
|
12
13
|
|
|
13
|
-
it('toggles between filter content and null', () => {
|
|
14
|
+
it('toggles between filter content and null', async () => {
|
|
15
|
+
const user = userEvent.setup();
|
|
16
|
+
|
|
14
17
|
render(<QueueLinelist closePanel={jest.fn()} />);
|
|
15
18
|
|
|
16
19
|
const closeButton = screen.getByText('Close overlay');
|
|
17
|
-
|
|
20
|
+
await user.click(closeButton);
|
|
18
21
|
|
|
19
22
|
const filterContent = screen.queryByTestId('filter-content');
|
|
20
23
|
expect(filterContent).not.toBeInTheDocument();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
3
4
|
import AppointmentsTable from './scheduled-appointments-table.component';
|
|
4
5
|
import { mockAppointmentsData } from '../../__mocks__/appointments-data.mock';
|
|
5
6
|
|
|
@@ -30,11 +31,14 @@ describe('AppointmentsTable', () => {
|
|
|
30
31
|
expect(appointmentName).toBeInTheDocument();
|
|
31
32
|
});
|
|
32
33
|
|
|
33
|
-
it('filters appointments based on status selection', () => {
|
|
34
|
+
it('filters appointments based on status selection', async () => {
|
|
35
|
+
const user = userEvent.setup();
|
|
36
|
+
|
|
34
37
|
render(<AppointmentsTable />);
|
|
35
38
|
|
|
36
39
|
const statusDropdown = screen.getAllByLabelText('Status:');
|
|
37
|
-
|
|
40
|
+
|
|
41
|
+
await user.type(statusDropdown[0], 'Completed');
|
|
38
42
|
|
|
39
43
|
const filteredAppointmentName = screen.getByText('Hungai Kevin');
|
|
40
44
|
expect(filteredAppointmentName).toBeInTheDocument();
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
4
|
import { mockServices } from '../../__mocks__/active-visits.mock';
|
|
5
|
+
import QueueRoomForm from './queue-room-form.component';
|
|
5
6
|
|
|
6
7
|
jest.mock('@openmrs/esm-framework', () => ({
|
|
7
8
|
...jest.requireActual('@openmrs/esm-framework'),
|
|
@@ -28,37 +29,47 @@ describe('QueueRoomForm', () => {
|
|
|
28
29
|
expect(screen.getByText('Save')).toBeInTheDocument();
|
|
29
30
|
});
|
|
30
31
|
|
|
31
|
-
it('displays error notification if queue room name is missing on submission', () => {
|
|
32
|
+
it('displays error notification if queue room name is missing on submission', async () => {
|
|
33
|
+
const user = userEvent.setup();
|
|
34
|
+
|
|
32
35
|
render(<QueueRoomForm toggleSearchType={jest.fn()} closePanel={jest.fn()} />);
|
|
33
36
|
|
|
34
|
-
|
|
37
|
+
await user.click(screen.getByText('Save'));
|
|
35
38
|
|
|
36
39
|
expect(screen.getByText('Missing queue room name')).toBeInTheDocument();
|
|
37
40
|
});
|
|
38
41
|
|
|
39
|
-
it('displays error notification if queue room service is missing on submission', () => {
|
|
42
|
+
it('displays error notification if queue room service is missing on submission', async () => {
|
|
43
|
+
const user = userEvent.setup();
|
|
44
|
+
|
|
40
45
|
render(<QueueRoomForm toggleSearchType={jest.fn()} closePanel={jest.fn()} />);
|
|
41
46
|
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
const queueRoomNameInput = screen.getByLabelText('Queue room name');
|
|
48
|
+
|
|
49
|
+
await user.type(queueRoomNameInput, 'Room 123');
|
|
50
|
+
await user.click(screen.getByText('Save'));
|
|
44
51
|
|
|
45
52
|
expect(screen.getByText('Missing queue room service')).toBeInTheDocument();
|
|
46
53
|
});
|
|
47
54
|
|
|
48
|
-
it('calls closePanel when Cancel button is clicked', () => {
|
|
55
|
+
it('calls closePanel when Cancel button is clicked', async () => {
|
|
56
|
+
const user = userEvent.setup();
|
|
57
|
+
|
|
49
58
|
const closePanelMock = jest.fn();
|
|
50
59
|
render(<QueueRoomForm toggleSearchType={jest.fn()} closePanel={closePanelMock} />);
|
|
51
60
|
|
|
52
|
-
|
|
61
|
+
await user.click(screen.getByText('Cancel'));
|
|
53
62
|
|
|
54
63
|
expect(closePanelMock).toHaveBeenCalledTimes(1);
|
|
55
64
|
});
|
|
56
65
|
|
|
57
|
-
it('updates queue room name state when a value is entered', () => {
|
|
66
|
+
it('updates queue room name state when a value is entered', async () => {
|
|
67
|
+
const user = userEvent.setup();
|
|
68
|
+
|
|
58
69
|
render(<QueueRoomForm toggleSearchType={jest.fn()} closePanel={jest.fn()} />);
|
|
59
70
|
|
|
60
71
|
const queueRoomNameInput = screen.getByLabelText('Queue room name');
|
|
61
|
-
|
|
72
|
+
await user.type(queueRoomNameInput, 'Room 123');
|
|
62
73
|
|
|
63
74
|
expect(queueRoomNameInput).toHaveValue('Room 123');
|
|
64
75
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
3
4
|
import QueueServiceForm from './queue-service-form.component';
|
|
4
5
|
|
|
5
6
|
jest.mock('@openmrs/esm-framework', () => ({
|
|
@@ -28,25 +29,29 @@ jest.mock('../patient-search/hooks/useQueueLocations', () => ({
|
|
|
28
29
|
|
|
29
30
|
describe('QueueServiceForm', () => {
|
|
30
31
|
it('should display required error messages when form is submitted with missing fields', async () => {
|
|
32
|
+
const user = userEvent.setup();
|
|
33
|
+
|
|
31
34
|
render(<QueueServiceForm toggleSearchType={() => {}} closePanel={() => {}} />);
|
|
32
35
|
|
|
33
36
|
const submitButton = screen.getByText('Save');
|
|
34
37
|
|
|
35
|
-
|
|
38
|
+
await user.click(submitButton);
|
|
36
39
|
|
|
37
40
|
expect(screen.getByText('Missing queue name')).toBeInTheDocument();
|
|
38
41
|
});
|
|
39
42
|
|
|
40
43
|
it('should submit the form when all fields are filled', async () => {
|
|
44
|
+
const user = userEvent.setup();
|
|
45
|
+
|
|
41
46
|
render(<QueueServiceForm toggleSearchType={() => {}} closePanel={() => {}} />);
|
|
42
47
|
|
|
43
48
|
const queueNameInput = screen.getByLabelText('Queue name');
|
|
44
49
|
const serviceSelect = screen.getByLabelText('Select a service type');
|
|
45
50
|
const locationSelect = screen.getByLabelText('Select a location');
|
|
46
51
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
await user.type(queueNameInput, 'Test Queue');
|
|
53
|
+
await user.selectOptions(serviceSelect, '6f017eb0-b035-4acd-b284-da45f5067502');
|
|
54
|
+
await user.selectOptions(locationSelect, '34567eb0-b035-4acd-b284-da45f5067502');
|
|
50
55
|
|
|
51
56
|
expect(queueNameInput).toHaveValue('Test Queue');
|
|
52
57
|
expect(serviceSelect).toHaveValue('6f017eb0-b035-4acd-b284-da45f5067502');
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
3
4
|
import RemoveQueueEntryDialog from './remove-queue-entry.component';
|
|
4
5
|
|
|
5
6
|
jest.mock('@openmrs/esm-framework', () => ({
|
|
@@ -31,11 +32,13 @@ describe('RemoveQueueEntryDialog', () => {
|
|
|
31
32
|
expect(screen.getByText('End visit')).toBeInTheDocument();
|
|
32
33
|
});
|
|
33
34
|
|
|
34
|
-
it('calls closeModal when Cancel button is clicked', () => {
|
|
35
|
+
it('calls closeModal when Cancel button is clicked', async () => {
|
|
36
|
+
const user = userEvent.setup();
|
|
35
37
|
const closeModal = jest.fn();
|
|
38
|
+
|
|
36
39
|
render(<RemoveQueueEntryDialog queueEntry={queueEntry} closeModal={closeModal} />);
|
|
37
40
|
|
|
38
|
-
|
|
41
|
+
await user.click(screen.getByText('Cancel'));
|
|
39
42
|
|
|
40
43
|
expect(closeModal).toHaveBeenCalledTimes(1);
|
|
41
44
|
});
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render, screen
|
|
3
|
-
import
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
4
|
import { navigate } from '@openmrs/esm-framework';
|
|
5
5
|
import { serveQueueEntry, updateQueueEntry } from '../active-visits/active-visits-table.resource';
|
|
6
6
|
import { requeueQueueEntry } from './transition-queue-entry.resource';
|
|
7
|
+
import TransitionQueueEntryModal from './transition-queue-entry-dialog.component';
|
|
7
8
|
|
|
8
9
|
const mockedNavigate = navigate as jest.Mock;
|
|
9
10
|
|
|
@@ -70,26 +71,26 @@ describe('TransitionQueueEntryModal', () => {
|
|
|
70
71
|
});
|
|
71
72
|
|
|
72
73
|
it('handles requeueing patient', async () => {
|
|
74
|
+
const user = userEvent.setup();
|
|
75
|
+
|
|
73
76
|
const closeModal = jest.fn();
|
|
74
77
|
render(<TransitionQueueEntryModal queueEntry={queueEntry} closeModal={closeModal} />);
|
|
75
78
|
|
|
76
|
-
|
|
79
|
+
await user.click(screen.getByText('Requeue'));
|
|
77
80
|
|
|
78
|
-
|
|
79
|
-
expect(requeueQueueEntry).toHaveBeenCalledWith('Requeued', queueEntry.queueUuid, queueEntry.queueEntryUuid);
|
|
80
|
-
});
|
|
81
|
+
expect(requeueQueueEntry).toHaveBeenCalledWith('Requeued', queueEntry.queueUuid, queueEntry.queueEntryUuid);
|
|
81
82
|
});
|
|
82
83
|
|
|
83
84
|
it('handles serving patient', async () => {
|
|
85
|
+
const user = userEvent.setup();
|
|
86
|
+
|
|
84
87
|
const closeModal = jest.fn();
|
|
85
88
|
render(<TransitionQueueEntryModal queueEntry={queueEntry} closeModal={closeModal} />);
|
|
86
89
|
|
|
87
|
-
|
|
90
|
+
await user.click(screen.getByText('Serve'));
|
|
88
91
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
expect(mockedNavigate).toHaveBeenCalled();
|
|
93
|
-
});
|
|
92
|
+
expect(updateQueueEntry).toHaveBeenCalled();
|
|
93
|
+
expect(serveQueueEntry).toHaveBeenCalled();
|
|
94
|
+
expect(mockedNavigate).toHaveBeenCalled();
|
|
94
95
|
});
|
|
95
96
|
});
|