-
-
Notifications
You must be signed in to change notification settings - Fork 811
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/components/AgendaItems/AgendaItemsCreateModal from Jest to Vitest #2489 #2727
Refactor : src/components/AgendaItems/AgendaItemsCreateModal from Jest to Vitest #2489 #2727
Conversation
WalkthroughThis pull request focuses on migrating the test file Changes
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
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/components/AgendaItems/AgendaItemsCreateModal.spec.tsx
(3 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.
🪛 GitHub Check: Performs linting, formatting, type-checking, checking for different source and target branch
src/components/AgendaItems/AgendaItemsCreateModal.spec.tsx
[failure] 77-77:
Cannot find namespace 'vi'.
🔇 Additional comments (3)
src/components/AgendaItems/AgendaItemsCreateModal.spec.tsx (3)
23-24
: LGTM: Correct test framework imports
The imports for jest-dom and Vitest functions are properly configured for the migration.
34-36
: LGTM: Proper migration of mock functions
Mock functions have been correctly migrated from jest.fn()
to vi.fn()
.
70-75
: LGTM: Proper migration of react-toastify mock
The mock for react-toastify has been correctly migrated to use Vitest's mocking functionality.
@Ramneet04 Please fix the first comment so that each issue listed automatically closes. The PR_GUIDELINES.md file has details. Please address the coderabbit comments and fix the failed tests. |
Please fix the failing test and ensure that CodeRabbit.ai approves your 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
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/components/AgendaItems/AgendaItemsCreateModal.spec.tsx
(3 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.
🪛 eslint
src/components/AgendaItems/AgendaItemsCreateModal.spec.tsx
[error] 78-78: import()
type annotations are forbidden.
(@typescript-eslint/consistent-type-imports)
🪛 GitHub Check: Performs linting, formatting, type-checking, checking for different source and target branch
src/components/AgendaItems/AgendaItemsCreateModal.spec.tsx
[failure] 78-78:
import()
type annotations are forbidden
🔇 Additional comments (5)
src/components/AgendaItems/AgendaItemsCreateModal.spec.tsx (5)
23-23
: Recommended usage note regarding jest-dom library.
Although the package is named "@testing-library/jest-dom," it is compatible with Vitest. This is fine and fully supported. Just be aware that this nomenclature can sometimes confuse contributors; consider clarifying or documenting that it works seamlessly with Vitest if needed.
24-24
: Correct usage of vitest imports.
Good job replacing Jest's APIs with the corresponding Vitest functions.
34-36
: Proper mocking with vi.fn().
These mock functions correctly replace jest.fn() calls. Everything looks consistent and aligned with Vitest’s mocking approach.
70-73
: Vitest-based mocking of react-toastify.
The mock implementation and usage of vi.fn() with react-toastify appear correct and should work as expected.
76-76
: Mocking external modules with vi.mock.
The call to vi.mock('utils/convertToBase64'); is correctly placed and consistent with Vitest's mocking approach.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop-postgres #2727 +/- ##
=====================================================
+ Coverage 75.56% 87.08% +11.52%
=====================================================
Files 295 312 +17
Lines 7289 8148 +859
Branches 1593 1840 +247
=====================================================
+ Hits 5508 7096 +1588
+ Misses 1518 875 -643
+ Partials 263 177 -86 ☔ View full report in Codecov by Sentry. |
hey @palisadoes could you please assist me like why this one failed, I have correct the technical error but don't know this one. |
Please ensure that coderabbit.ai approves your changes. The error may be corrected after that. |
Finally!! Is there anything or is it resolved?? |
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.
See comment
df2dd67
into
PalisadoesFoundation:develop-postgres
Refactored src/components/AgendaItems/AgendaItemsCreateModal.test.tsx to src/components/AgendaItems/AgendaItemsCreateModal.spec.tsx
Issue: #2489 : #2489
Changes Implemented:
Refactored the testing framework from Jest to Vitest in AgendaItemsCreateModal.test.tsx.
Updated import statements, mocking methods, and assertions to align with Vitest conventions.
Verified compatibility with the existing codebase using Vitest.
From AgendaItemsCreateModal.test.tsx → AgendaItemsCreateModal.spec.tsx to follow the naming convention for Vitest.
Refactor :
src/components/AgendaItems/AgendaItemsCreateModal.test.tsx
from Jest to Vitest #2489Other 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
AgendaItemsCreateModal
component.