Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ayush-AI committed Jul 5, 2023
1 parent 68028fc commit 405f8ef
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, fireEvent } from '@testing-library/react';
import { render, fireEvent, screen } from '@testing-library/react';
import EditPatientDetailsButton from './edit-patient-details-button.component';
import * as esmFramework from '@openmrs/esm-framework';

Expand All @@ -9,9 +9,9 @@ describe('EditPatientDetailsButton', () => {
jest.spyOn(esmFramework, 'navigate').mockImplementation(navigateMock);

const patientUuid = '12345';
const { getByRole } = render(<EditPatientDetailsButton patientUuid={patientUuid} />);
render(<EditPatientDetailsButton patientUuid={patientUuid} />);

const button = getByRole('menuitem');
const button = screen.getByRole('menuitem');
fireEvent.click(button);

expect(navigateMock).toHaveBeenCalledWith({ to: expect.stringContaining(`/patient/${patientUuid}/edit`) });
Expand All @@ -20,11 +20,9 @@ describe('EditPatientDetailsButton', () => {
it('should call the onTransition function when provided', () => {
const patientUuid = '12345';
const onTransitionMock = jest.fn();
const { getByRole } = render(
<EditPatientDetailsButton patientUuid={patientUuid} onTransition={onTransitionMock} />,
);
render(<EditPatientDetailsButton patientUuid={patientUuid} onTransition={onTransitionMock} />);

const button = getByRole('menuitem');
const button = screen.getByRole('menuitem');
fireEvent.click(button);

expect(onTransitionMock).toHaveBeenCalled();
Expand Down

0 comments on commit 405f8ef

Please sign in to comment.