@openmrs/esm-appointments-app 5.2.2-pre.2432 → 5.2.2-pre.2445

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.
@@ -80,10 +80,10 @@
80
80
  "initial": true,
81
81
  "entry": true,
82
82
  "recorded": false,
83
- "size": 4539072,
83
+ "size": 4539075,
84
84
  "sizes": {
85
85
  "consume-shared": 252,
86
- "javascript": 4518150,
86
+ "javascript": 4518153,
87
87
  "share-init": 252,
88
88
  "runtime": 20418
89
89
  },
@@ -100,7 +100,7 @@
100
100
  "auxiliaryFiles": [
101
101
  "main.js.map"
102
102
  ],
103
- "hash": "a7e8f660b86ec22e",
103
+ "hash": "dec2b68504957b7c",
104
104
  "childrenByOrder": {}
105
105
  },
106
106
  {
@@ -422,9 +422,9 @@
422
422
  "initial": false,
423
423
  "entry": false,
424
424
  "recorded": false,
425
- "size": 480625,
425
+ "size": 480628,
426
426
  "sizes": {
427
- "javascript": 480457,
427
+ "javascript": 480460,
428
428
  "consume-shared": 168
429
429
  },
430
430
  "names": [],
@@ -438,7 +438,7 @@
438
438
  "auxiliaryFiles": [
439
439
  "755.js.map"
440
440
  ],
441
- "hash": "ec0e13a531b07fa9",
441
+ "hash": "d3b687a28836d475",
442
442
  "childrenByOrder": {}
443
443
  },
444
444
  {
package/dist/routes.json CHANGED
@@ -1 +1 @@
1
- {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":"^2.2.0"},"extensions":[{"name":"home-appointments","slot":"homepage-widgets-slot","component":"homeAppointments","order":1},{"name":"clinical-appointments-dashboard-link","slot":"homepage-dashboard-slot","component":"appointmentsDashboardLink","meta":{"name":"appointments","slot":"clinical-appointments-dashboard-slot","title":"Appointments"}},{"component":"root","name":"clinical-appointments-dashboard","slot":"clinical-appointments-dashboard-slot"},{"name":"appointments-calendar-dashboard-link","slot":"calendar-dashboard-slot","component":"appointmentsCalendarDashboardLink"},{"name":"check-in-appointment-modal","slot":"todays-appointment-slot","component":"checkInModal"},{"name":"todays-appointments-dashboard","slot":"todays-appointment-slot","component":"homeAppointments"},{"name":"expected-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"checked-in-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"completed-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"missed-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"cancelled-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"early-appointments-panel","component":"earlyAppointments"}],"version":"5.2.2-pre.2432"}
1
+ {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":"^2.2.0"},"extensions":[{"name":"home-appointments","slot":"homepage-widgets-slot","component":"homeAppointments","order":1},{"name":"clinical-appointments-dashboard-link","slot":"homepage-dashboard-slot","component":"appointmentsDashboardLink","meta":{"name":"appointments","slot":"clinical-appointments-dashboard-slot","title":"Appointments"}},{"component":"root","name":"clinical-appointments-dashboard","slot":"clinical-appointments-dashboard-slot"},{"name":"appointments-calendar-dashboard-link","slot":"calendar-dashboard-slot","component":"appointmentsCalendarDashboardLink"},{"name":"check-in-appointment-modal","slot":"todays-appointment-slot","component":"checkInModal"},{"name":"todays-appointments-dashboard","slot":"todays-appointment-slot","component":"homeAppointments"},{"name":"expected-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"checked-in-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"completed-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"missed-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"cancelled-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"early-appointments-panel","component":"earlyAppointments"}],"version":"5.2.2-pre.2445"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-appointments-app",
3
- "version": "5.2.2-pre.2432",
3
+ "version": "5.2.2-pre.2445",
4
4
  "description": "Appointments front-end module for the OpenMRS SPA",
5
5
  "browser": "dist/openmrs-esm-appointments-app.js",
6
6
  "main": "src/index.ts",
@@ -2,12 +2,12 @@ import React, { useState } from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
3
  import { Tab, TabList, Tabs, TabPanel, TabPanels } from '@carbon/react';
4
4
 
5
+ import { type ConfigObject } from '../config-schema';
6
+ import { useConfig } from '@openmrs/esm-framework';
5
7
  import { useVisits } from '../hooks/useVisits';
6
8
  import ScheduledAppointments from './scheduled/scheduled-appointments.component';
7
9
  import UnscheduledAppointments from './unscheduled/unscheduled-appointments.component';
8
10
  import styles from './appointment-tabs.scss';
9
- import { ConfigObject } from '../config-schema';
10
- import { useConfig } from '@openmrs/esm-framework';
11
11
 
12
12
  interface AppointmentTabsProps {
13
13
  appointmentServiceType: string;
@@ -2,13 +2,13 @@ import React from 'react';
2
2
  import { screen } from '@testing-library/react';
3
3
  import userEvent from '@testing-library/user-event';
4
4
  import { openmrsFetch } from '@openmrs/esm-framework';
5
- import { renderWithSwr, waitForLoadingToFinish } from '../../../../tools/test-helpers';
5
+ import { renderWithSwr, waitForLoadingToFinish } from 'tools';
6
+ import { mockAppointmentsData } from '__mocks__';
6
7
  import AppointmentTabs from './appointment-tabs.component';
7
- import { mockAppointmentsData } from '../../../../__mocks__/appointments.mock';
8
8
 
9
9
  const mockOpenmrsFetch = openmrsFetch as jest.Mock;
10
10
 
11
- jest.setTimeout(15000);
11
+ jest.setTimeout(10000);
12
12
 
13
13
  describe('AppointmentTabs', () => {
14
14
  xit(`renders tabs showing different appointment lists`, async () => {
@@ -53,5 +53,5 @@ describe('AppointmentTabs', () => {
53
53
  });
54
54
 
55
55
  function renderAppointmentTabs() {
56
- renderWithSwr(<AppointmentTabs />);
56
+ renderWithSwr(<AppointmentTabs appointmentServiceType="" />);
57
57
  }
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import userEvent from '@testing-library/user-event';
3
3
  import { screen, render } from '@testing-library/react';
4
- import { mockMappedAppointmentsData } from '../../../../../../__mocks__/appointments.mock';
5
4
  import { showNotification, showToast } from '@openmrs/esm-framework';
6
5
  import { cancelAppointment } from '../forms.resource';
6
+ import { mockMappedAppointmentsData } from '__mocks__';
7
7
  import CancelAppointment from './cancel-appointment.component';
8
8
 
9
9
  const testProps = {
@@ -185,7 +185,7 @@ const AppointmentForm: React.FC<AppointmentFormProps> = ({ appointment, patientU
185
185
  id="location"
186
186
  invalidText="Required"
187
187
  value={selectedLocation}
188
- defaultSelected={selectedLocation}
188
+ defaultValue={selectedLocation}
189
189
  onChange={(event) => setSelectedLocation(event.target.value)}>
190
190
  <LocationSelectOption
191
191
  selectedLocation={selectedLocation}
@@ -1,9 +1,7 @@
1
1
  import React from 'react';
2
2
  import { render, screen, within } from '@testing-library/react';
3
3
  import { useConfig, usePatient } from '@openmrs/esm-framework';
4
- import { mockPatient, mockServices, mockProviders } from '../../../../../../__mocks__/appointments.mock';
5
- import { mockLocations } from '../../../../../../__mocks__/locations.mock';
6
- import { mockSession } from '../../../../../../__mocks__/session.mock';
4
+ import { mockLocations, mockSession, mockPatient, mockServices, mockProviders } from '__mocks__';
7
5
  import { MappedAppointment } from '../../../types';
8
6
  import AppointmentForm from './appointments-form.component';
9
7
 
@@ -43,6 +41,7 @@ const mockedConfig = {
43
41
 
44
42
  describe('AppointmentForm', () => {
45
43
  const patient = mockPatient;
44
+
46
45
  beforeEach(() => {
47
46
  mockedUseConfig.mockReturnValue(mockedConfig);
48
47
  mockedUsePatient.mockReturnValue({
@@ -53,23 +52,29 @@ describe('AppointmentForm', () => {
53
52
  });
54
53
  });
55
54
 
56
- it('renders details of the correct patient in the patient banner', () => {
55
+ it('renders details of the correct patient in the patient banner', async () => {
57
56
  renderAppointmentsForm('creating', mockPatient.uuid);
58
57
 
58
+ await screen.findByText(/date and time/i);
59
59
  expect(screen.getByText(/Date and time/i)).toBeInTheDocument();
60
60
  });
61
61
 
62
- it('renders the form with all expected inputs in create mode', () => {
62
+ it('renders the form with all expected inputs in create mode', async () => {
63
63
  renderAppointmentsForm('creating', mockPatient.uuid);
64
64
 
65
+ await screen.findByLabelText(/select a location/i);
66
+
65
67
  expect(screen.getByRole('combobox', { name: /select a location/i })).toBeInTheDocument();
66
68
  expect(screen.getByRole('combobox', { name: /select a service/i })).toBeInTheDocument();
67
69
  expect(screen.getByRole('combobox', { name: /select an appointment type/i })).toBeInTheDocument();
68
70
  expect(screen.getByRole('combobox', { name: /select a provider/i })).toBeInTheDocument();
69
71
  });
70
72
 
71
- it('renders the expected appointment types', () => {
73
+ it('renders the expected appointment types', async () => {
72
74
  renderAppointmentsForm('creating', mockPatient.uuid);
75
+
76
+ await screen.findByLabelText(/select an appointment type/i);
77
+
73
78
  const appointmentTypeSelect = screen.getByLabelText('Select an appointment type');
74
79
 
75
80
  expect(within(appointmentTypeSelect).getAllByRole('option')).toHaveLength(3);
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { act, render, screen } from '@testing-library/react';
2
+ import { render, screen } from '@testing-library/react';
3
3
  import { openmrsFetch } from '@openmrs/esm-framework';
4
- import { mockAppointmentMetrics, mockProvidersCount, mockStartTime } from '../../../../__mocks__/appointments.mock';
4
+ import { mockAppointmentMetrics, mockProvidersCount, mockStartTime } from '__mocks__';
5
5
  import AppointmentsMetrics from './appointments-metrics.component';
6
6
 
7
7
  const mockedOpenmrsFetch = openmrsFetch as jest.Mock;
@@ -36,13 +36,11 @@ describe('Appointment metrics', () => {
36
36
 
37
37
  renderAppointmentMetrics();
38
38
 
39
- await act(() => {
40
- expect(screen.getByText(/appointment metrics/i)).toBeInTheDocument();
41
- expect(screen.getByText(/scheduled appointments/i)).toBeInTheDocument();
42
- expect(screen.getByText(/patients/i)).toBeInTheDocument();
43
- expect(screen.getByText(/16/i)).toBeInTheDocument();
44
- expect(screen.getByText(/4/i)).toBeInTheDocument();
45
- });
39
+ await screen.findByText(/appointment metrics/i);
40
+ expect(screen.getByText(/scheduled appointments/i)).toBeInTheDocument();
41
+ expect(screen.getByText(/patients/i)).toBeInTheDocument();
42
+ expect(screen.getByText(/16/i)).toBeInTheDocument();
43
+ expect(screen.getByText(/4/i)).toBeInTheDocument();
46
44
  });
47
45
  });
48
46
 
@@ -2,12 +2,14 @@ import React from 'react';
2
2
  import { render, screen } from '@testing-library/react';
3
3
  import ClinicalAppointments from './appointments.component';
4
4
 
5
- describe('ClinicalAppointments Component', () => {
5
+ describe('Clinical Appointments', () => {
6
6
  it('should render correctly', () => {
7
7
  render(<ClinicalAppointments />);
8
8
 
9
- expect(screen.getByTestId('appointments-header')).toBeInTheDocument();
10
- expect(screen.getByTestId('clinic-metrics')).toBeInTheDocument();
11
- expect(screen.getByTestId('appointment-list')).toBeInTheDocument();
9
+ expect(screen.getByTitle(/patient queue illustration/i)).toBeInTheDocument();
10
+ expect(screen.getByText(/^appointments$/i)).toBeInTheDocument();
11
+ expect(screen.getByText(/home/i)).toBeInTheDocument();
12
+ expect(screen.getByPlaceholderText(/DD-MMM-YYYY/i)).toBeInTheDocument();
13
+ expect(screen.getByRole('button', { name: /appointments calendar/i })).toBeInTheDocument();
12
14
  });
13
15
  });
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import { render, screen } from '@testing-library/react';
3
- import AppointmentsBaseTable from './appointments-list.component';
4
- import { mockSession } from '../../../../__mocks__/session.mock';
5
- import { useTodaysAppointments } from './appointments-table.resource';
3
+ import { mockSession } from '__mocks__';
6
4
  import { usePagination } from '@openmrs/esm-framework';
5
+ import { useTodaysAppointments } from './appointments-table.resource';
6
+ import AppointmentsBaseTable from './appointments-list.component';
7
7
 
8
8
  const useTodaysAppointmentsMock = useTodaysAppointments as jest.Mock;
9
9
  const usePaginationMock = usePagination as jest.Mock;
@@ -11,7 +11,7 @@ const Overlay: React.FC = () => {
11
11
  const overlayClass = layout !== 'tablet' ? styles.desktopOverlay : styles.tabletOverlay;
12
12
  return (
13
13
  <>
14
- {isOverlayOpen && (
14
+ {isOverlayOpen ? (
15
15
  <div className={overlayClass}>
16
16
  {layout === 'tablet' && (
17
17
  <Header onClick={() => closeOverlay()} aria-label="Tablet overlay" className={styles.tabletOverlayHeader}>
@@ -32,7 +32,7 @@ const Overlay: React.FC = () => {
32
32
  )}
33
33
  {component}
34
34
  </div>
35
- )}
35
+ ) : null}
36
36
  </>
37
37
  );
38
38
  };
package/tsconfig.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "extends": "../../tsconfig.json",
3
3
  "include": ["src/**/*"],
4
- "exclude": ["src/**/*.test.tsx", "src/**/*.outdated.tsx"]
4
+ "exclude": ["src/**/*.test.tsx"]
5
5
  }