From 2029a0157759da75284fdf176fe9cccffea9b290 Mon Sep 17 00:00:00 2001 From: Ayush Date: Thu, 13 Jul 2023 19:27:04 +0530 Subject: [PATCH] using navigate as mock --- .../src/widgets/edit-patient-details-button.test.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/esm-patient-registration-app/src/widgets/edit-patient-details-button.test.tsx b/packages/esm-patient-registration-app/src/widgets/edit-patient-details-button.test.tsx index 99880a210..4c4ac58b9 100644 --- a/packages/esm-patient-registration-app/src/widgets/edit-patient-details-button.test.tsx +++ b/packages/esm-patient-registration-app/src/widgets/edit-patient-details-button.test.tsx @@ -5,6 +5,7 @@ import { navigate } from '@openmrs/esm-framework'; describe('EditPatientDetailsButton', () => { it('should navigate to the edit page when clicked', () => { + const mockNavigate = navigate as jest.Mock; jest.mock('@openmrs/esm-framework', () => { const originalModule = jest.requireActual('@openmrs/esm-framework'); return { @@ -18,7 +19,7 @@ describe('EditPatientDetailsButton', () => { const button = screen.getByRole('menuitem'); fireEvent.click(button); - expect(navigate).toHaveBeenCalledWith({ to: expect.stringContaining(`/patient/${patientUuid}/edit`) }); + expect(mockNavigate).toHaveBeenCalledWith({ to: expect.stringContaining(`/patient/${patientUuid}/edit`) }); }); it('should call the onTransition function when provided', () => {