-
-
Notifications
You must be signed in to change notification settings - Fork 840
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/EventStats/* from Jest to Vitest #2997
Migrated src/components/EventStats/* from Jest to Vitest #2997
Conversation
WalkthroughThis pull request focuses on migrating test files within the Changes
Assessment against linked issues
Possibly related issues
Possibly related PRs
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/components/EventStats/EventStatsWrapper.spec.tsx (1)
9-14
: Fix typo in comment while implementation LGTMThe mock implementation correctly uses Vitest's
vi.mock
with async import. However, there's a typo in the comment: "trasformer" should be "transformer".-// Mock the modules for PieChart rendering as they require a trasformer being used (which is not done by Vitest) +// Mock the modules for PieChart rendering as they require a transformer being used (which is not done by Vitest)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
src/components/EventStats/EventStats.spec.tsx
(2 hunks)src/components/EventStats/EventStatsWrapper.spec.tsx
(2 hunks)src/components/EventStats/Statistics/AverageRating.spec.tsx
(2 hunks)src/components/EventStats/Statistics/Feedback.spec.tsx
(3 hunks)src/components/EventStats/Statistics/Review.spec.tsx
(3 hunks)
🧰 Additional context used
📓 Learnings (3)
📓 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.
src/components/EventStats/EventStats.spec.tsx (1)
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.
src/components/EventStats/Statistics/Feedback.spec.tsx (1)
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.
🔇 Additional comments (15)
src/components/EventStats/Statistics/AverageRating.spec.tsx (2)
10-10
: Migration to Vitest imports looks good.
These new imports from "vitest" are correctly replacing the Jest analogs.
39-39
: Use of 'it' instead of 'test' is appropriate.
This aligns with Vitest's recommended style.
src/components/EventStats/EventStats.spec.tsx (4)
7-7
: Switch to Vitest imports is valid.
Good job updating the import to ensure Vitest test functions are used.
9-15
: Mocking with 'vi.mock' is correct.
These changes accurately replace Jest mocking with Vitest’s approach.
48-48
: Replacing 'jest.fn()' with 'vi.fn()' is consistent.
All references to Jest mocks are successfully swapped to Vitest.
51-51
: Use of 'it' in place of 'test'.
This completes the framework migration for this file.
src/components/EventStats/Statistics/Review.spec.tsx (3)
10-10
: Vitest imports are correct.
Imports from "vitest" conform to the new testing framework.
55-55
: Refactor from 'test' to 'it'.
This usage aligns with Vitest conventions.
76-76
: Another instance of 'test' → 'it'.
Consistent with the Vitest migration.
src/components/EventStats/Statistics/Feedback.spec.tsx (4)
10-10
: Adding 'vi', 'describe', 'expect', and 'it' from Vitest is appropriate.
Smooth transition to Vitest's suite of test functions.
12-17
: Replacing 'jest.mock()' with 'vi.mock()'.
This mocking approach correctly aligns with Vitest.
57-57
: Use of 'it' for the test block.
The function name now meets Vitest best practices.
84-84
: Another 'it' test block conversion.
All test blocks here are now properly migrated to Vitest spells.
src/components/EventStats/EventStatsWrapper.spec.tsx (2)
7-7
: LGTM: Correct Vitest imports
The import statement correctly includes the necessary Vitest testing utilities.
57-57
: LGTM: Correct migration to Vitest's it
The test case has been correctly migrated from Jest's test
to Vitest's it
while maintaining the original test logic.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop-postgres #2997 +/- ##
=====================================================
+ Coverage 33.14% 88.91% +55.77%
=====================================================
Files 299 320 +21
Lines 7429 8290 +861
Branches 1624 1869 +245
=====================================================
+ Hits 2462 7371 +4909
+ Misses 4762 696 -4066
- Partials 205 223 +18 ☔ View full report in Codecov by Sentry. |
c310730
into
PalisadoesFoundation:develop-postgres
What kind of change does this PR introduce?
This PR will migrate src/components/EventStats/* from Jest to Vitest
Issue Number:
Fixes #2794
Did you add tests for your changes?
Yes
Snapshots/Videos:
If relevant, did you update the documentation?
No
Summary
Does this PR introduce a breaking change?
No
Other information
N/A
Have you read the contributing guide?
Yes
Summary by CodeRabbit
test
functions withit
for more descriptive test case naming.