Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(feat) O3-4040: Add delete ability to program enrollments #2133

Open
wants to merge 60 commits into
base: main
Choose a base branch
from

Conversation

PiusKariuki
Copy link
Contributor

@PiusKariuki PiusKariuki commented Dec 5, 2024

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a conventional commit label. See existing PR titles for inspiration.
  • My work conforms to the OpenMRS 3.0 Styleguide and design documentation.
  • My work includes tests or is validated by existing tests.

Summary

This PR adds DELETE ability to program enrollments

Screenshots

Screenshot from 2024-12-05 13-49-19
Screenshot from 2024-12-05 13-49-26
Screenshot from 2024-12-05 13-49-38

Related Issue

https://openmrs.atlassian.net/browse/O3-4040

Other

@PiusKariuki
Copy link
Contributor Author

@vasharma05 @denniskigen can you please review this for me

@brandones brandones changed the title (feat) Add delete ability to program enrollments#4040 (feat) O3-4040: Add delete ability to program enrollments Dec 15, 2024
Copy link
Contributor

@brandones brandones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, @PiusKariuki ! The main thing is to clean up the user-facing text. We don't want to scare users by making them think they might be deleting a whole program, when they are in fact just deleting the patient's enrollment.

@PiusKariuki
Copy link
Contributor Author

@brandones @denniskigen . I resolved the failing E2E and suggestions too. Please review and revert incase of any more feedback

Copy link
Collaborator

@NethmiRodrigo NethmiRodrigo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @PiusKariuki! A few minor nitpicks

e2e/pages/program-page.ts Outdated Show resolved Hide resolved
Comment on lines 27 to 29
beforeEach(() => {
jest.clearAllMocks();
});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also please note this.

Comment on lines 11 to 14
jest.mock('@openmrs/esm-framework', () => ({
showSnackbar: jest.fn(),
getCoreTranslation: jest.fn((key, defaultText) => defaultText),
}));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And please update the mocks

Comment on lines +71 to +72
expect(mockDeleteProgramEnrollment).toHaveBeenCalledTimes(1);
expect(mockDeleteProgramEnrollment).toHaveBeenCalledTimes(1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
expect(mockDeleteProgramEnrollment).toHaveBeenCalledTimes(1);
expect(mockDeleteProgramEnrollment).toHaveBeenCalledTimes(1);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Best to call this file programs-actions-menu.test.tsx. The component extension isn't required for tests.

mockUseLayoutType.mockReturnValue('small-desktop'); // or 'large-desktop' or 'tablet'
});

it('renders OverflowMenu with edit and delete actions', async () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it('renders OverflowMenu with edit and delete actions', async () => {
it('renders an overflow menu with edit and delete actions', async () => {

Comment on lines +36 to +37
const overFlowButton = screen.getByRole('button');
await user.click(overFlowButton);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const overFlowButton = screen.getByRole('button');
await user.click(overFlowButton);
const overflowMenuButton = screen.getByRole('button', { name: /options/i });
await user.click(overflowMenuButton);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants