-
-
Notifications
You must be signed in to change notification settings - Fork 867
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: jest to vitest of itemViewModal : fixes #2557 #2716
refactor: jest to vitest of itemViewModal : fixes #2557 #2716
Conversation
WalkthroughThis pull request focuses on refactoring the Changes
Assessment against linked issues
Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
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
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop-postgres #2716 +/- ##
====================================================
+ Coverage 86.10% 86.29% +0.19%
====================================================
Files 295 312 +17
Lines 7259 8134 +875
Branches 1591 1841 +250
====================================================
+ Hits 6250 7019 +769
- Misses 781 943 +162
+ Partials 228 172 -56 ☔ 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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/screens/OrganizationActionItems/ItemViewModal.spec.tsx (2)
21-27
: Consider enhancing the toast mock implementation.While the migration to Vitest mocking is correct, consider expanding the toast mock to include other commonly used methods like
warning
andinfo
for completeness.vi.mock('react-toastify', () => ({ toast: { success: vi.fn(), error: vi.fn(), + warning: vi.fn(), + info: vi.fn(), }, }));
90-90
: Refactor repeated hide function declarations.Consider extracting the repeated
hide: vi.fn()
declarations into a shared constant to improve maintainability and reduce duplication.+const hideModal = vi.fn(); + const itemProps: InterfaceViewModalProps[] = [ { isOpen: true, - hide: vi.fn(), + hide: hideModal, item: { // ... item properties }, }, // Apply similar changes to other items ];This change would:
- Reduce code duplication
- Make it easier to modify or assert the mock behavior
- Improve test maintainability
Also applies to: 112-112, 134-134, 156-156, 178-178
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/screens/OrganizationActionItems/ItemViewModal.spec.tsx
(6 hunks)
🧰 Additional context used
📓 Learnings (1)
src/screens/OrganizationActionItems/ItemViewModal.spec.tsx (1)
Learnt from: Chaitanya1672
PR: PalisadoesFoundation/talawa-admin#2049
File: src/screens/OrganizationActionItems/ActionItemUpdateModal.tsx:112-138
Timestamp: 2024-11-12T10:40:58.654Z
Learning: The `istanbul ignore next` comments in the `ActionItemUpdateModal.tsx` file were added as part of a commit that introduced tests for the `ActionItemUpdateModal` component. Removing these comments and writing tests to cover the previously ignored lines is recommended to ensure code integrity and improve test coverage.
🔇 Additional comments (1)
src/screens/OrganizationActionItems/ItemViewModal.spec.tsx (1)
Line range hint 217-285
: Test coverage looks comprehensive!
The test suite effectively covers:
- Different assignee types (User, EventVolunteer, EventVolunteerGroup)
- Various UI states (with/without images)
- Different completion states
- Input field validations
e2a86ae
into
PalisadoesFoundation:develop-postgres
What kind of change does this PR introduce?
Refactoring
Issue Number:
There are multiple test files in this directory. So it needs multiple PRs to close the issue. This PR fixes one such file inside that directory
itemViewModal.spec.tsx
Fixes #2557
Snapshots/Videos:
Summary
Refactored the
itemViewModal.tsx
tests from jest to vitest initemViewModal.spec.tsx
Have you read the contributing guide?
Yes
Summary by CodeRabbit
ItemViewModal
component tests.react-toastify
to align with the new framework.