@openmrs/esm-appointments-app 10.0.3-pre.8636 → 10.0.3-pre.8644

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.
@@ -5,4 +5,4 @@
5
5
  │ 6973.js (315.022 KiB)
6
6
  
7
7
 
8
- Rspack compiled with 1 warning in 21.43 s
8
+ Rspack compiled with 1 warning in 27.33 s
package/dist/routes.json CHANGED
@@ -1 +1 @@
1
- {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":">=2.2.0","appointments":">=2.0.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"},"order":2},{"component":"root","name":"clinical-appointments-dashboard","slot":"clinical-appointments-dashboard-slot"},{"name":"appointments-dashboard","slot":"appointments-dashboard-slot","component":"appointmentsDashboard"},{"name":"appointments-calendar-dashboard-link","slot":"calendar-dashboard-slot","component":"appointmentsCalendarDashboardLink"},{"name":"todays-appointments-dashboard","slot":"todays-appointment-slot","component":"homeAppointments"},{"name":"early-appointments-panel","component":"earlyAppointments"},{"name":"patient-appointments-summary-dashboard","component":"patientAppointmentsSummaryDashboardLink","slot":"patient-chart-dashboard-slot","order":11,"meta":{"columns":1,"columnSpan":1,"hideDashboardTitle":true,"path":"appointments","slot":"patient-chart-appointments-dashboard-slot","title":"Appointments"}},{"name":"appointments-details-widget","component":"patientAppointmentsDetailedSummary","slot":"patient-chart-appointments-dashboard-slot","meta":{"columnSpan":1}},{"name":"patient-upcoming-appointment-widget","component":"patientUpcomingAppointmentsWidget","slot":"visit-form-top-slot"},{"name":"home-appointments-tile","slot":"home-metrics-tiles-slot","component":"homeAppointmentsTile"},{"name":"metrics-card-scheduled-appointments","component":"metricsCardScheduledAppointments","slot":"appointments-metrics-slot","order":1},{"name":"metrics-card-highest-volume-service","component":"metricsCardHighestVolumeService","slot":"appointments-metrics-slot","order":2},{"name":"metrics-card-providers-booked","component":"metricsCardProvidersBooked","slot":"appointments-metrics-slot","order":3}],"modals":[{"name":"end-appointment-modal","component":"endAppointmentModal"},{"name":"cancel-appointment-modal","component":"cancelAppointmentModal"},{"name":"batch-change-appointments-statuses-modal","component":"batchChangeAppointmentStatusesModal"}],"workspaceGroups2":[{"name":"appointments-group","scopePattern":"/home/appointments"}],"workspaceWindows2":[{"name":"appointments-window","group":"appointments-group"}],"workspaces2":[{"name":"appointments-form-workspace","component":"appointmentsFormWorkspace","window":"appointments-window"},{"name":"appointments-patient-search-workspace","component":"@openmrs/esm-patient-search-app#patientSearchWorkspace2","window":"appointments-window"},{"name":"appointments-start-visit-workspace","component":"@openmrs/esm-patient-chart-app#exportedVisitForm","window":"appointments-window"}],"version":"10.0.3-pre.8636"}
1
+ {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":">=2.2.0","appointments":">=2.0.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"},"order":2},{"component":"root","name":"clinical-appointments-dashboard","slot":"clinical-appointments-dashboard-slot"},{"name":"appointments-dashboard","slot":"appointments-dashboard-slot","component":"appointmentsDashboard"},{"name":"appointments-calendar-dashboard-link","slot":"calendar-dashboard-slot","component":"appointmentsCalendarDashboardLink"},{"name":"todays-appointments-dashboard","slot":"todays-appointment-slot","component":"homeAppointments"},{"name":"early-appointments-panel","component":"earlyAppointments"},{"name":"patient-appointments-summary-dashboard","component":"patientAppointmentsSummaryDashboardLink","slot":"patient-chart-dashboard-slot","order":11,"meta":{"columns":1,"columnSpan":1,"hideDashboardTitle":true,"path":"appointments","slot":"patient-chart-appointments-dashboard-slot","title":"Appointments"}},{"name":"appointments-details-widget","component":"patientAppointmentsDetailedSummary","slot":"patient-chart-appointments-dashboard-slot","meta":{"columnSpan":1}},{"name":"patient-upcoming-appointment-widget","component":"patientUpcomingAppointmentsWidget","slot":"visit-form-top-slot"},{"name":"home-appointments-tile","slot":"home-metrics-tiles-slot","component":"homeAppointmentsTile"},{"name":"metrics-card-scheduled-appointments","component":"metricsCardScheduledAppointments","slot":"appointments-metrics-slot","order":1},{"name":"metrics-card-highest-volume-service","component":"metricsCardHighestVolumeService","slot":"appointments-metrics-slot","order":2},{"name":"metrics-card-providers-booked","component":"metricsCardProvidersBooked","slot":"appointments-metrics-slot","order":3}],"modals":[{"name":"end-appointment-modal","component":"endAppointmentModal"},{"name":"cancel-appointment-modal","component":"cancelAppointmentModal"},{"name":"batch-change-appointments-statuses-modal","component":"batchChangeAppointmentStatusesModal"}],"workspaceGroups2":[{"name":"appointments-group","scopePattern":"/home/appointments"}],"workspaceWindows2":[{"name":"appointments-window","group":"appointments-group"}],"workspaces2":[{"name":"appointments-form-workspace","component":"appointmentsFormWorkspace","window":"appointments-window"},{"name":"appointments-patient-search-workspace","component":"@openmrs/esm-patient-search-app#patientSearchWorkspace2","window":"appointments-window"},{"name":"appointments-start-visit-workspace","component":"@openmrs/esm-patient-chart-app#exportedVisitForm","window":"appointments-window"}],"version":"10.0.3-pre.8644"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-appointments-app",
3
- "version": "10.0.3-pre.8636",
3
+ "version": "10.0.3-pre.8644",
4
4
  "description": "Appointments front-end module for O3",
5
5
  "browser": "dist/openmrs-esm-appointments-app.js",
6
6
  "main": "src/index.ts",
@@ -14,9 +14,9 @@
14
14
  "build": "rspack --mode production",
15
15
  "analyze": "rspack --mode=production --env analyze=true",
16
16
  "lint": "eslint src --ext tsx",
17
- "test": "cross-env TZ=UTC jest --config jest.config.js --verbose false --passWithNoTests --color",
18
- "test-watch": "cross-env TZ=UTC jest --watch --config jest.config.js",
19
- "coverage": "yarn test --coverage",
17
+ "test": "vitest run --passWithNoTests",
18
+ "test:watch": "vitest watch",
19
+ "coverage": "vitest run --coverage --passWithNoTests",
20
20
  "typescript": "tsc",
21
21
  "extract-translations": "i18next 'src/**/*.component.tsx' 'src/**/*.extension.tsx' 'src/**/*modal.tsx' 'src/**/*.workspace.tsx' 'src/index.ts' 'src/constants.ts' --config ../../tools/i18next-parser.config.js"
22
22
  },
@@ -56,7 +56,8 @@
56
56
  "swr": "2.x"
57
57
  },
58
58
  "devDependencies": {
59
- "openmrs": "next"
59
+ "openmrs": "next",
60
+ "vitest": "^4.1.2"
60
61
  },
61
62
  "stableVersion": "10.0.2"
62
63
  }
@@ -1,14 +1,15 @@
1
1
  import React from 'react';
2
+ import { vi, describe, it, expect } from 'vitest';
2
3
  import { screen } from '@testing-library/react';
3
4
  import { type FetchResponse, openmrsFetch } from '@openmrs/esm-framework';
4
5
  import { renderWithSwr, waitForLoadingToFinish } from 'tools';
5
6
  import { mockAppointmentsData } from '__mocks__';
6
7
  import AppointmentTabs from './appointment-tabs.component';
7
8
 
8
- const mockOpenmrsFetch = jest.mocked(openmrsFetch);
9
+ const mockOpenmrsFetch = vi.mocked(openmrsFetch);
9
10
 
10
11
  describe('AppointmentTabs', () => {
11
- xit(`renders tabs showing different appointment lists`, async () => {
12
+ it.skip(`renders tabs showing different appointment lists`, async () => {
12
13
  mockOpenmrsFetch.mockResolvedValue({ ...mockAppointmentsData } as unknown as FetchResponse);
13
14
 
14
15
  renderWithSwr(<AppointmentTabs appointmentServiceTypes={['service-type-uuid']} />);
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { vi, describe, it, expect, afterAll, type Mock } from 'vitest';
2
3
  import { render, screen } from '@testing-library/react';
3
4
  import { getDefaultsFromConfigSchema, useConfig } from '@openmrs/esm-framework';
4
5
  import { type ConfigObject, configSchema } from '../../config-schema';
@@ -7,8 +8,8 @@ import AppointmentActions from './appointments-actions.component';
7
8
  import { changeAppointmentStatus } from '../../patient-appointments/patient-appointments.resource';
8
9
  import userEvent from '@testing-library/user-event';
9
10
 
10
- jest.mock('../../patient-appointments/patient-appointments.resource');
11
- const mockChangeAppointmentStatus = changeAppointmentStatus as jest.Mock;
11
+ vi.mock('../../patient-appointments/patient-appointments.resource');
12
+ const mockChangeAppointmentStatus = changeAppointmentStatus as Mock;
12
13
 
13
14
  const appointment: Appointment = {
14
15
  uuid: '7cd38a6d-377e-491b-8284-b04cf8b8c6d8',
@@ -59,11 +60,11 @@ const defaultProps = {
59
60
  hasActiveVisit: false,
60
61
  };
61
62
 
62
- const mockUseConfig = jest.mocked(useConfig<ConfigObject>);
63
+ const mockUseConfig = vi.mocked(useConfig<ConfigObject>);
63
64
 
64
65
  describe('AppointmentActions', () => {
65
66
  afterAll(() => {
66
- jest.useRealTimers();
67
+ vi.useRealTimers();
67
68
  });
68
69
 
69
70
  it('renders the check in button when appointment is scheduled and check in button is enabled', () => {
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { vi, describe, it, expect, beforeEach } from 'vitest';
2
3
  import userEvent from '@testing-library/user-event';
3
4
  import { render, screen } from '@testing-library/react';
4
5
  import { getDefaultsFromConfigSchema, useConfig } from '@openmrs/esm-framework';
@@ -61,13 +62,13 @@ const mockAppointments = [
61
62
  },
62
63
  ] as unknown as Array<Appointment>;
63
64
 
64
- const mockUseConfig = jest.mocked(useConfig<ConfigObject>);
65
- const mockExportAppointmentsToSpreadsheet = jest.mocked(exportAppointmentsToSpreadsheet);
65
+ const mockUseConfig = vi.mocked(useConfig<ConfigObject>);
66
+ const mockExportAppointmentsToSpreadsheet = vi.mocked(exportAppointmentsToSpreadsheet);
66
67
 
67
- jest.mock('../../helpers/excel', () => {
68
+ vi.mock('../../helpers/excel', async () => {
68
69
  return {
69
- ...jest.requireActual('../../helpers/excel'),
70
- exportAppointmentsToSpreadsheet: jest.fn(),
70
+ ...((await vi.importActual('../../helpers/excel')) as object),
71
+ exportAppointmentsToSpreadsheet: vi.fn(),
71
72
  };
72
73
  });
73
74
 
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { vi, describe, it, expect, beforeEach } from 'vitest';
2
3
  import { render, screen } from '@testing-library/react';
3
4
  import userEvent from '@testing-library/user-event';
4
5
  import { getDefaultsFromConfigSchema, showSnackbar, useConfig } from '@openmrs/esm-framework';
@@ -8,23 +9,23 @@ import { type Appointment, AppointmentKind, AppointmentStatus } from '../../type
8
9
  import { type ConfigObject, configSchema } from '../../config-schema';
9
10
  import BatchChangeAppointmentStatusesModal from './batch-change-appointment-statuses.modal';
10
11
 
11
- const mockCloseModal = jest.fn();
12
- const mockMutateAppointments = jest.fn();
13
- const mockChangeAppointmentStatus = jest.mocked(changeAppointmentStatus);
14
- const mockShowSnackbar = jest.mocked(showSnackbar);
15
- const mockUseConfig = jest.mocked(useConfig<ConfigObject>);
16
- const mockUseMutateAppointments = jest.mocked(useMutateAppointments);
12
+ const mockCloseModal = vi.fn();
13
+ const mockMutateAppointments = vi.fn();
14
+ const mockChangeAppointmentStatus = vi.mocked(changeAppointmentStatus);
15
+ const mockShowSnackbar = vi.mocked(showSnackbar);
16
+ const mockUseConfig = vi.mocked(useConfig<ConfigObject>);
17
+ const mockUseMutateAppointments = vi.mocked(useMutateAppointments);
17
18
 
18
- jest.mock('../../patient-appointments/patient-appointments.resource', () => ({
19
- changeAppointmentStatus: jest.fn(),
19
+ vi.mock('../../patient-appointments/patient-appointments.resource', () => ({
20
+ changeAppointmentStatus: vi.fn(),
20
21
  }));
21
22
 
22
- jest.mock('./batch-change-appointment-statuses.resources', () => ({
23
- getActiveVisitsForPatient: jest.fn(),
23
+ vi.mock('./batch-change-appointment-statuses.resources', () => ({
24
+ getActiveVisitsForPatient: vi.fn(),
24
25
  }));
25
26
 
26
- jest.mock('../../hooks/useMutateAppointments', () => ({
27
- useMutateAppointments: jest.fn(),
27
+ vi.mock('../../hooks/useMutateAppointments', () => ({
28
+ useMutateAppointments: vi.fn(),
28
29
  }));
29
30
 
30
31
  const mockAppointment1: Appointment = {
@@ -85,7 +86,7 @@ const mockAppointment2: Appointment = {
85
86
 
86
87
  describe('BatchChangeAppointmentStatusesModal', () => {
87
88
  beforeEach(() => {
88
- jest.clearAllMocks();
89
+ vi.clearAllMocks();
89
90
  mockUseConfig.mockReturnValue({
90
91
  ...getDefaultsFromConfigSchema(configSchema),
91
92
  checkOutButton: { enabled: true, customUrl: '' },
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { vi, describe, it, expect, beforeEach } from 'vitest';
2
3
  import { render, screen } from '@testing-library/react';
3
4
  import userEvent from '@testing-library/user-event';
4
5
  import {
@@ -12,16 +13,16 @@ import {
12
13
  import { changeAppointmentStatus } from '../../patient-appointments/patient-appointments.resource';
13
14
  import EndAppointmentModal from './end-appointment.modal';
14
15
 
15
- const closeModal = jest.fn();
16
- const mockUseVisit = jest.mocked(useVisit);
17
- const mockUpdateVisit = jest.mocked(updateVisit);
16
+ const closeModal = vi.fn();
17
+ const mockUseVisit = vi.mocked(useVisit);
18
+ const mockUpdateVisit = vi.mocked(updateVisit);
18
19
 
19
- jest.mock('../../patient-appointments/patient-appointments.resource', () => ({
20
- changeAppointmentStatus: jest.fn().mockResolvedValue({}),
20
+ vi.mock('../../patient-appointments/patient-appointments.resource', () => ({
21
+ changeAppointmentStatus: vi.fn().mockResolvedValue({}),
21
22
  }));
22
23
 
23
- jest.mock('../../hooks/useMutateAppointments', () => ({
24
- useMutateAppointments: jest.fn().mockReturnValue({ mutateAppointments: jest.fn() }),
24
+ vi.mock('../../hooks/useMutateAppointments', () => ({
25
+ useMutateAppointments: vi.fn().mockReturnValue({ mutateAppointments: vi.fn() }),
25
26
  }));
26
27
 
27
28
  describe('EndAppointmentModal', () => {
@@ -65,7 +66,7 @@ describe('EndAppointmentModal', () => {
65
66
 
66
67
  mockUseVisit.mockReturnValue({
67
68
  activeVisit: { location: { uuid: 'def' }, visitType: { uuid: 'ghi' }, startDatetime: new Date() },
68
- mutate: jest.fn(),
69
+ mutate: vi.fn(),
69
70
  } as unknown as VisitReturnType);
70
71
 
71
72
  render(<EndAppointmentModal appointmentUuid={'abc'} patientUuid={'123'} closeModal={closeModal} />);
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { vi, expect, test } from 'vitest';
2
3
  import { render, screen } from '@testing-library/react';
3
4
  import { usePatient } from '@openmrs/esm-framework';
4
5
  import { mockPatient } from 'tools';
@@ -50,9 +51,9 @@ const appointment: Appointment = {
50
51
  extensions: [],
51
52
  };
52
53
 
53
- const mockUsePatient = jest.mocked(usePatient);
54
+ const mockUsePatient = vi.mocked(usePatient);
54
55
 
55
- jest.mock('../../hooks/usePatientAppointmentHistory', () => ({
56
+ vi.mock('../../hooks/usePatientAppointmentHistory', () => ({
56
57
  usePatientAppointmentHistory: () => ({
57
58
  appointmentsCount: {
58
59
  completedAppointments: 1,
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { vi, describe, it, expect, beforeEach } from 'vitest';
2
3
  import userEvent from '@testing-library/user-event';
3
4
  import { render, screen } from '@testing-library/react';
4
5
  import { getDefaultsFromConfigSchema, useConfig } from '@openmrs/esm-framework';
@@ -8,21 +9,21 @@ import { getByTextWithMarkup } from 'tools';
8
9
  import { useUnscheduledAppointments } from '../../hooks/useUnscheduledAppointments';
9
10
  import UnscheduledAppointments from './unscheduled-appointments.component';
10
11
 
11
- const mockExportUnscheduledAppointmentsToSpreadsheet = jest.mocked(exportUnscheduledAppointmentsToSpreadsheet);
12
- const mockUseUnscheduledAppointments = jest.mocked(useUnscheduledAppointments);
13
- const mockUseConfig = jest.mocked(useConfig<ConfigObject>);
12
+ const mockExportUnscheduledAppointmentsToSpreadsheet = vi.mocked(exportUnscheduledAppointmentsToSpreadsheet);
13
+ const mockUseUnscheduledAppointments = vi.mocked(useUnscheduledAppointments);
14
+ const mockUseConfig = vi.mocked(useConfig<ConfigObject>);
14
15
 
15
- jest.mock('../../helpers/excel', () => {
16
+ vi.mock('../../helpers/excel', async () => {
16
17
  return {
17
- ...jest.requireActual('../../helpers/excel'),
18
- exportUnscheduledAppointmentsToSpreadsheet: jest.fn(),
18
+ ...((await vi.importActual('../../helpers/excel')) as object),
19
+ exportUnscheduledAppointmentsToSpreadsheet: vi.fn(),
19
20
  };
20
21
  });
21
22
 
22
- jest.mock('../../hooks/useUnscheduledAppointments', () => {
23
+ vi.mock('../../hooks/useUnscheduledAppointments', async () => {
23
24
  return {
24
- ...jest.requireActual('../../hooks/useUnscheduledAppointments'),
25
- useUnscheduledAppointments: jest.fn(),
25
+ ...((await vi.importActual('../../hooks/useUnscheduledAppointments')) as object),
26
+ useUnscheduledAppointments: vi.fn(),
26
27
  };
27
28
  });
28
29
 
@@ -1,11 +1,12 @@
1
1
  import React from 'react';
2
+ import { vi, describe, it, expect, beforeEach } from 'vitest';
2
3
  import { render, screen } from '@testing-library/react';
3
4
  import { useConfig, getDefaultsFromConfigSchema } from '@openmrs/esm-framework';
4
5
  import Appointments from './appointments.component';
5
6
  import { type ConfigObject, configSchema } from './config-schema';
6
7
  import { BrowserRouter } from 'react-router-dom';
7
8
 
8
- const mockUseConfig = jest.mocked(useConfig<ConfigObject>);
9
+ const mockUseConfig = vi.mocked(useConfig<ConfigObject>);
9
10
 
10
11
  describe('Appointments', () => {
11
12
  beforeEach(() => {
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { vi, describe, it, expect } from 'vitest';
2
3
  import dayjs from 'dayjs';
3
4
  import userEvent from '@testing-library/user-event';
4
5
  import { render, screen } from '@testing-library/react';
@@ -6,11 +7,11 @@ import { BrowserRouter } from 'react-router-dom';
6
7
  import AppointmentsCalendarView from './appointments-calendar-view.component';
7
8
  import { useAppointmentsCalendar } from '../hooks/useAppointmentsCalendar';
8
9
 
9
- jest.mock('../hooks/useAppointmentsCalendar', () => ({
10
- useAppointmentsCalendar: jest.fn().mockReturnValue({ calendarEvents: [], isLoading: false, error: null }),
10
+ vi.mock('../hooks/useAppointmentsCalendar', () => ({
11
+ useAppointmentsCalendar: vi.fn().mockReturnValue({ calendarEvents: [], isLoading: false, error: null }),
11
12
  }));
12
13
 
13
- const mockUseAppointmentsCalendar = jest.mocked(useAppointmentsCalendar);
14
+ const mockUseAppointmentsCalendar = vi.mocked(useAppointmentsCalendar);
14
15
 
15
16
  function renderCalendar() {
16
17
  return render(
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { vi, describe, it, expect, test, beforeEach } from 'vitest';
2
3
  import userEvent from '@testing-library/user-event';
3
4
  import { fireEvent, screen } from '@testing-library/react';
4
5
  import {
@@ -49,7 +50,7 @@ const existingAppointment = {
49
50
  };
50
51
 
51
52
  const defaultProps = {
52
- closeWorkspace: jest.fn(),
53
+ closeWorkspace: vi.fn(),
53
54
  workspaceProps: {
54
55
  patientUuid: mockPatient.id,
55
56
  },
@@ -58,36 +59,36 @@ const defaultProps = {
58
59
  workspaceName: 'appointments-form',
59
60
  windowName: 'test-window',
60
61
  isRootWorkspace: true,
61
- launchChildWorkspace: jest.fn(),
62
+ launchChildWorkspace: vi.fn(),
62
63
  };
63
64
 
64
- const mockOpenmrsFetch = jest.mocked(openmrsFetch);
65
- const mockSaveAppointment = jest.mocked(saveAppointment);
66
- const mockCheckAppointmentConflict = jest.mocked(checkAppointmentConflict);
67
- const mockShowSnackbar = jest.mocked(showSnackbar);
68
- const mockUseConfig = jest.mocked(useConfig<ConfigObject>);
69
- const mockUseLocations = jest.mocked(useLocations);
70
- const mockUseProviders = jest.mocked(useProviders);
71
- const mockUseSession = jest.mocked(useSession);
72
-
73
- jest.mock('./appointments-form.resource', () => ({
74
- ...jest.requireActual('./appointments-form.resource'),
75
- saveAppointment: jest.fn(),
76
- checkAppointmentConflict: jest.fn(),
65
+ const mockOpenmrsFetch = vi.mocked(openmrsFetch);
66
+ const mockSaveAppointment = vi.mocked(saveAppointment);
67
+ const mockCheckAppointmentConflict = vi.mocked(checkAppointmentConflict);
68
+ const mockShowSnackbar = vi.mocked(showSnackbar);
69
+ const mockUseConfig = vi.mocked(useConfig<ConfigObject>);
70
+ const mockUseLocations = vi.mocked(useLocations);
71
+ const mockUseProviders = vi.mocked(useProviders);
72
+ const mockUseSession = vi.mocked(useSession);
73
+
74
+ vi.mock('./appointments-form.resource', async () => ({
75
+ ...((await vi.importActual('./appointments-form.resource')) as object),
76
+ saveAppointment: vi.fn(),
77
+ checkAppointmentConflict: vi.fn(),
77
78
  }));
78
79
 
79
- jest.mock('../hooks/useProviders', () => ({
80
- ...jest.requireActual('../hooks/useProviders'),
81
- useProviders: jest.fn(),
80
+ vi.mock('../hooks/useProviders', async () => ({
81
+ ...((await vi.importActual('../hooks/useProviders')) as object),
82
+ useProviders: vi.fn(),
82
83
  }));
83
84
 
84
- jest.mock('../workload/workload.resource', () => ({
85
- ...jest.requireActual('../workload/workload.resource'),
86
- getMonthlyCalendarDistribution: jest.fn(),
87
- useAppointmentSummary: jest.fn(),
88
- useCalendarDistribution: jest.fn(),
89
- useMonthlyCalendarDistribution: jest.fn().mockReturnValue([]),
90
- useMonthlyAppointmentSummary: jest.fn().mockReturnValue([]),
85
+ vi.mock('../workload/workload.resource', async () => ({
86
+ ...((await vi.importActual('../workload/workload.resource')) as object),
87
+ getMonthlyCalendarDistribution: vi.fn(),
88
+ useAppointmentSummary: vi.fn(),
89
+ useCalendarDistribution: vi.fn(),
90
+ useMonthlyCalendarDistribution: vi.fn().mockReturnValue([]),
91
+ useMonthlyAppointmentSummary: vi.fn().mockReturnValue([]),
91
92
  }));
92
93
 
93
94
  describe('AppointmentForm', () => {
@@ -1,4 +1,5 @@
1
1
  import { convertTime12to24 } from '../time';
2
+ import { vi, describe, it, expect } from 'vitest';
2
3
 
3
4
  describe('convertTime12to24', () => {
4
5
  describe('AM conversion', () => {
@@ -1,4 +1,5 @@
1
1
  import { AppointmentStatus } from '../types';
2
+ import { vi, describe, it, expect } from 'vitest';
2
3
  import { canTransition } from './functions';
3
4
 
4
5
  describe('canTransition', () => {
@@ -1,18 +1,19 @@
1
1
  import React from 'react';
2
+ import { vi, describe, it, expect, beforeEach } from 'vitest';
2
3
  import { renderHook, waitFor } from '@testing-library/react';
3
4
  import { SWRConfig } from 'swr';
4
5
  import { type FetchResponse, openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
5
6
  import { usePatientAppointmentHistory } from './usePatientAppointmentHistory';
6
7
 
7
- const mockOpenmrsFetch = jest.mocked(openmrsFetch);
8
+ const mockOpenmrsFetch = vi.mocked(openmrsFetch);
8
9
 
9
- jest.mock('./useSelectedDate', () => ({
10
- useSelectedDate: jest.fn(),
10
+ vi.mock('./useSelectedDate', () => ({
11
+ useSelectedDate: vi.fn(),
11
12
  }));
12
13
 
13
14
  import { useSelectedDate } from './useSelectedDate';
14
15
 
15
- const mockUseSelectedDate = jest.mocked(useSelectedDate);
16
+ const mockUseSelectedDate = vi.mocked(useSelectedDate);
16
17
 
17
18
  const wrapper = ({ children }: { children: React.ReactNode }) => (
18
19
  <SWRConfig
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { vi, describe, it, expect } from 'vitest';
2
3
  import { screen } from '@testing-library/react';
3
4
  import userEvent from '@testing-library/user-event';
4
5
  import { type FetchResponse, openmrsFetch } from '@openmrs/esm-framework';
@@ -17,10 +18,10 @@ import AppointmentsDetailedSummary from './patient-appointments-detailed-summary
17
18
  const testProps = {
18
19
  basePath: patientChartBasePath,
19
20
  patientUuid: mockPatient.id,
20
- launchAppointmentForm: jest.fn(),
21
+ launchAppointmentForm: vi.fn(),
21
22
  };
22
23
 
23
- const mockOpenmrsFetch = jest.mocked(openmrsFetch);
24
+ const mockOpenmrsFetch = vi.mocked(openmrsFetch);
24
25
 
25
26
  describe('AppointmentsDetailedSummary', () => {
26
27
  it('renders an empty state if appointments data is unavailable', async () => {
@@ -1,10 +1,11 @@
1
1
  import React from 'react';
2
+ import { vi, describe, it, expect, beforeEach } from 'vitest';
2
3
  import { renderHook, waitFor } from '@testing-library/react';
3
4
  import { SWRConfig } from 'swr';
4
5
  import { type FetchResponse, openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
5
6
  import { usePatientAppointments } from './patient-appointments.resource';
6
7
 
7
- const mockOpenmrsFetch = jest.mocked(openmrsFetch);
8
+ const mockOpenmrsFetch = vi.mocked(openmrsFetch);
8
9
 
9
10
  const wrapper = ({ children }: { children: React.ReactNode }) => (
10
11
  <SWRConfig
@@ -0,0 +1,4 @@
1
+ import { mergeConfig } from 'vitest/config';
2
+ import sharedConfig from '../../tools/vitest.shared';
3
+
4
+ export default mergeConfig(sharedConfig, {});
package/jest.config.js DELETED
@@ -1,3 +0,0 @@
1
- const rootConfig = require('../../jest.config.js');
2
-
3
- module.exports = rootConfig;