Skip to content

Commit

Permalink
Fix the failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
jwnasambu committed Jan 16, 2025
1 parent 3801028 commit 17756dc
Showing 1 changed file with 0 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@ jest.mock('./conditions.resource', () => ({
useConditionsSearch: jest.fn(),
}));

jest.mock('@openmrs/esm-framework', () => {
const actualFramework = jest.requireActual('@openmrs/esm-framework');
return {
...actualFramework,
OpenmrsDatePicker: jest.fn(),
};
});

const mockOpenmrsDatePicker = jest.mocked(OpenmrsDatePicker);

mockOpenmrsDatePicker.mockImplementation(({ id, labelText, value, onChange }) => {
Expand Down Expand Up @@ -158,18 +150,13 @@ describe('Conditions form', () => {
const submitButton = screen.getByRole('button', { name: /save & close/i });
const activeStatusInput = screen.getByRole('radio', { name: 'Active' });
const conditionSearchInput = screen.getByRole('searchbox', { name: /enter condition/i });
const onsetDateInput = screen.getByRole('textbox', { name: /onset date/i });
expect(cancelButton).toBeEnabled();

await user.type(conditionSearchInput, 'Headache');
await user.click(screen.getByRole('menuitem', { name: /headache/i }));
await user.click(activeStatusInput);
await user.type(onsetDateInput, '2020-05-05');
await user.click(submitButton);

await waitFor(() => {
expect(mockShowSnackbar).toHaveBeenCalled();
});
expect(mockShowSnackbar).toHaveBeenCalledWith({
kind: 'success',
subtitle: 'It is now visible on the Conditions page',
Expand Down

0 comments on commit 17756dc

Please sign in to comment.