-
-
Notifications
You must be signed in to change notification settings - Fork 864
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
Refactored jest to vitest #2825 #2877
Refactored jest to vitest #2825 #2877
Conversation
WalkthroughThis pull request focuses on refactoring the test suite for the Changes
Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
Tip CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command 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.
Actionable comments posted: 1
🧹 Nitpick comments (3)
src/components/UserPasswordUpdate/UserPasswordUpdate.spec.tsx (3)
38-38
: Confirm usage of global.alert.If there's no explicit reason to use a global alert override, consider removing or mocking it only where necessary to prevent potential side effects.
123-151
: Use waitFor instead of custom wait.While the custom
wait()
function works, consider standardizing onwaitFor
from@testing-library/react
for clarity and best practices.- await wait(); + await waitFor(() => { + // Insert any condition checks here if needed + });
153-184
: Test naming suggestion.Rename
'wrong old password'
to a more descriptive phrase, such as'displays an error on invalid old password'
, for clarity and consistency with the rest of the suite.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/components/UserPasswordUpdate/UserPasswordUpdate.spec.tsx
(5 hunks)src/components/UserPasswordUpdate/UserPasswordUpdateMocks.ts
(1 hunks)
🔇 Additional comments (8)
src/components/UserPasswordUpdate/UserPasswordUpdateMocks.ts (2)
3-22
: Good approach to mocking a successful scenario.
Having a dedicated scenario for successful updates ensures proper coverage of the happy path.
23-40
: Comprehensive error case coverage.
The failure scenario for invalid previous password is well-structured and helps confirm application behavior on invalid input.
src/components/UserPasswordUpdate/UserPasswordUpdate.spec.tsx (6)
2-2
: Efficient import of waitFor from @testing-library/react.
This aligns well with recommended asynchronous testing patterns.
10-10
: MOCKS import usage is correct.
Using the new UserPasswordUpdateMocks.ts
greatly simplifies test setup. Keep up this pattern for test clarity.
11-16
: Vitest mock integration looks good.
The transition from Jest to Vitest is properly handled here with vi.mock
.
Line range hint 40-71
: Test structure is clear and maintainable.
This test effectively covers rendering, input handling, and validating error states.
Line range hint 75-88
: Proactive validation of empty password.
This test provides immediate user feedback. Nicely done.
Line range hint 90-120
: Validation of mismatched new and confirm password.
Well-structured test that ensures correct error messaging when fields are mismatched.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop-postgres #2877 +/- ##
=====================================================
+ Coverage 60.19% 87.95% +27.75%
=====================================================
Files 296 314 +18
Lines 7373 8225 +852
Branches 1610 1799 +189
=====================================================
+ Hits 4438 7234 +2796
+ Misses 2690 785 -1905
+ Partials 245 206 -39 ☔ View full report in Codecov by Sentry. |
e217704
into
PalisadoesFoundation:develop-postgres
What kind of change does this PR introduce?
This PR migrates src/components/UserPasswordUpdate/UserPasswordUpdate.test.tsx from jest to vitest #2825
Did you add tests for your changes?
Yes
Snapshots/Videos:
If relevant, did you update the documentation?
N/A
Does this PR introduce a breaking change?
No
Have you read the contributing guide?
Yes
Summary by CodeRabbit
New Features
Bug Fixes
UserPasswordUpdate
component, including scenarios for successful password updates and handling incorrect previous passwords.Tests
jest
tovi
for mocking.waitFor
.