-
-
Notifications
You must be signed in to change notification settings - Fork 701
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
Refactor: src/screens/UserPortal/Volunteer/Groups from Jest to Vitest #2584 #2638
base: develop
Are you sure you want to change the base?
Conversation
…om jest to vitest
WalkthroughThe changes in this pull request involve migrating the testing framework for the Changes
Possibly related issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Congratulations on making your first PR! 🎊 If you haven't already, check out our Contributing Guidelines and PR Reporting Guidelines to ensure that you are following our guidelines for contributing and creating PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (1)
src/screens/UserPortal/Volunteer/Groups/Groups.spec.tsx (1)
Line range hint
86-214
: Consider modernizing test implementationWhile the tests are functional, consider these improvements for better maintainability:
- Consistently use
userEvent
instead of mixingfireEvent
anduserEvent
- Consider using
test.each
for similar test cases (e.g., sorting tests)- Group related tests using
describe
blocks for better organizationExample of using test.each for sorting tests:
interface SortTest { sortType: string; expectedFirstGroup: string; } const sortTests: SortTest[] = [ { sortType: 'volunteers_DESC', expectedFirstGroup: 'Group 1' }, { sortType: 'volunteers_ASC', expectedFirstGroup: 'Group 2' } ]; test.each(sortTests)('sorts by $sortType', async ({ sortType, expectedFirstGroup }) => { renderGroups(link1); const sortBtn = await screen.findByTestId('sort'); await userEvent.click(sortBtn); const sortOption = await screen.findByTestId(sortType); await userEvent.click(sortOption); const groupName = await screen.findAllByTestId('groupName'); expect(groupName[0]).toHaveTextContent(expectedFirstGroup); });
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
src/screens/UserPortal/Volunteer/Groups/Groups.spec.tsx
(2 hunks)
🔇 Additional comments (2)
src/screens/UserPortal/Volunteer/Groups/Groups.spec.tsx (2)
18-19
: LGTM: Correct imports for Vitest migration
The necessary imports for Vitest have been correctly added, including the test runner and DOM testing utilities.
82-82
: LGTM: Correct cleanup implementation
The mock cleanup has been properly migrated from Jest to Vitest.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
|
Refactored src/screens/UserPortal/Volunteer/Groups.test.tsx to src/screens/UserPortal/Volunteer/Groups.spec.tsx
Issue: #2584 : #2584
Changes Implemented:
- Renamed the test file:
- Ran all tests successfully under the Vitest environment.
Refactor:
src/screens/UserPortal/Volunteer/Groups
from Jest to Vitest #2584Other information
I have read the previous refactor PR and tried to keep things as uniform as possible.
Please suggest any other changes if required.
Summary by CodeRabbit