-
-
Notifications
You must be signed in to change notification settings - Fork 813
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/Posts from Jest to Vitest #2578 #3190
Refactor: src/screens/UserPortal/Posts from Jest to Vitest #2578 #3190
Conversation
WalkthroughThe pull request focuses on refactoring the Changes
Assessment against linked issues
Possibly related issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Finishing Touches
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
|
Please fix the failing test |
@khushipatil1523 Please fix the failing tests. |
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: 0
🧹 Nitpick comments (1)
src/screens/UserPortal/Posts/Posts.spec.tsx (1)
277-285
: Consider removing deprecated matchMedia methodsThe matchMedia mock implementation is correct, but includes deprecated methods (
addListener
/removeListener
).Consider this cleaner implementation:
value: vi.fn().mockImplementation((query) => ({ matches: false, media: query, onchange: null, - addListener: vi.fn(), // Deprecated - removeListener: vi.fn(), // Deprecated addEventListener: vi.fn(), removeEventListener: vi.fn(), dispatchEvent: vi.fn(), })),
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/screens/UserPortal/Posts/Posts.spec.tsx
(6 hunks)
🧰 Additional context used
📓 Learnings (1)
📓 Common learnings
Learnt from: bitbard3
PR: PalisadoesFoundation/talawa-admin#2588
File: src/components/ChangeLanguageDropdown/ChangeLanguageDropdown.spec.tsx:145-155
Timestamp: 2024-12-02T04:20:11.745Z
Learning: In PRs focused solely on refactoring test cases from Jest to Vitest, avoid suggesting optimizations or changes outside the migration scope.
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Test Application
- GitHub Check: Analyse Code With CodeQL (javascript)
🔇 Additional comments (6)
src/screens/UserPortal/Posts/Posts.spec.tsx (6)
19-19
: LGTM: Vitest imports and mocks are correctly implementedThe migration from Jest to Vitest for the imports and mocks follows the correct patterns. The mock implementations for
react-toastify
andreact-router-dom
are properly structured.Also applies to: 23-40
290-294
: LGTM: Test suite setup properly migratedGood practices observed:
- Using
beforeEach
ensures clean mock state for each test- Correctly migrated to
vi.clearAllMocks()
297-304
: LGTM: Test case properly maintained during migrationThe test logic remains intact while successfully transitioning to the Vitest context.
Line range hint
305-351
: LGTM: Modal interaction tests successfully migratedThe modal interaction test cases maintain their original behavior while working correctly in the Vitest environment.
Line range hint
352-377
: LGTM: Post functionality tests properly migratedThe post rendering and deletion tests maintain their original behavior while working correctly in the Vitest environment.
Line range hint
381-408
: LGTM: Invalid orgId test suite well implementedGood practices observed:
- Proper test isolation with beforeEach/afterEach hooks
- Correct mock cleanup with vi.clearAllMocks()
- Good coverage of edge case with undefined orgId
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop-postgres #3190 +/- ##
=====================================================
+ Coverage 19.77% 90.05% +70.28%
=====================================================
Files 306 329 +23
Lines 7763 8526 +763
Branches 1690 1854 +164
=====================================================
+ Hits 1535 7678 +6143
+ Misses 6132 613 -5519
- Partials 96 235 +139 ☔ View full report in Codecov by Sentry. |
6ef6c6f
into
PalisadoesFoundation:develop-postgres
Refactor : src/screens/UserPortal/Posts from Jest to Vitest
#2578
What kind of change does this PR introduce?
Refactor
Issue Number: #2578
Fixes #2578
Did you add tests for your changes?
Yes
Snapshots/Videos:
Summary
Migrated test from jest to vitest.
Does this PR introduce a breaking change?
No
Have you read the contributing guide?
Yes
Summary by CodeRabbit
react-toastify
andreact-router-dom
window.matchMedia