-
-
Notifications
You must be signed in to change notification settings - Fork 756
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
Migrated src/components/AgendaItems/* from Jest to Vitest #2850
Migrated src/components/AgendaItems/* from Jest to Vitest #2850
Conversation
WalkthroughThis pull request focuses on refactoring test files in the Changes
Assessment against linked issues
Possibly related issues
Possibly related PRs
Suggested labels
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 (1)
src/components/AgendaItems/AgendaItemsContainer.spec.tsx (1)
38-38
: Spying on console withvi.spyOn
This approach maintains the existing behavior but within the Vitest ecosystem. Make sure this spy is restored or cleaned up if necessary.- vi.spyOn(console, 'error').mockImplementation((message) => { + const consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation((message) => { if (message.includes('Support for defaultProps will be removed')) { return; } console.error(message); });
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/components/AgendaItems/AgendaItemsContainer.spec.tsx
(1 hunks)src/components/AgendaItems/AgendaItemsContainerProps.ts
(3 hunks)src/components/AgendaItems/AgendaItemsPreviewModal.spec.tsx
(2 hunks)
🔇 Additional comments (9)
src/components/AgendaItems/AgendaItemsContainerProps.ts (2)
2-2
: Vitest import statement aligns with the PR objective.
Good job replacing the Jest import with Vitest. This approach cleanly removes the old dependency.
100-100
: Consistent mocking across all props
This update maintains consistency with the rest of the code that now uses Vitest’s vi.fn()
. Looks good.
src/components/AgendaItems/AgendaItemsPreviewModal.spec.tsx (4)
14-14
: Correct switch to Vitest imports
Importing vi
from Vitest ensures your test suite is aligned with the new framework.
48-48
: Mock function replaced with vi.fn()
Well done migrating from Jest’s mock function to Vitest’s counterpart for hidePreviewModal
.
50-50
: Maintain consistency in the test suite
Swapping to vi.fn()
for showUpdateModal
aligns with the rest of your Vitest mocks.
51-51
: Use vi.fn()
for all mocks
This consistent usage ensures smooth integration with Vitest’s mocking APIs.
src/components/AgendaItems/AgendaItemsContainer.spec.tsx (3)
25-25
: Replacing Jest with Vitest import
Excellent job transitioning to Vitest’s describe
, test
, and expect
.
29-29
: Update mock calls to Vitest
Using vi.mock
for react-toastify
ensures the new framework’s patches apply consistently.
31-32
: Use Vitest’s vi.fn()
for toast mocking
These changes keep everything in sync with Vitest’s mocking methods.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop-postgres #2850 +/- ##
=====================================================
+ Coverage 68.61% 87.80% +19.18%
=====================================================
Files 296 313 +17
Lines 7358 8222 +864
Branches 1606 1854 +248
=====================================================
+ Hits 5049 7219 +2170
+ Misses 2068 804 -1264
+ Partials 241 199 -42 ☔ View full report in Codecov by Sentry. |
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.
Please convert src/components/AgendaItems/AgendaItemsPreviewModal.test.tsx
@palisadoes |
My mistake. This file is missing from the PR
|
@palisadoes there is a separate issue for that (#2491) which is assigned to me only I have created a separate pr for that |
f8da9d5
into
PalisadoesFoundation:develop-postgres
Thanks |
What kind of change does this PR introduce?
This PR will migrate the src/components/AgendaItems/* from Jest to Vitest.
Issue Number:
Fixes #2792
Did you add tests for your changes?
Yes
Snapshots/Videos:
If relevant, did you update the documentation?
No
Does this PR introduce a breaking change?
No
Have you read the contributing guide?
Yes
Summary by CodeRabbit