-
-
Notifications
You must be signed in to change notification settings - Fork 810
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
Feat : Write Unittests for src/components/UserPortal/OrganizationCard/OrganizationCard.tsx
#2393
Feat : Write Unittests for src/components/UserPortal/OrganizationCard/OrganizationCard.tsx
#2393
Conversation
WalkthroughThe pull request modifies the test suite for the Changes
Assessment against linked issues
Possibly related PRs
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 ProcessWe have these basic policies to make the approval process smoother for our volunteer team. Testing Your CodePlease make sure your code passes all tests. Our test code coverage system will fail if these conditions occur:
The process helps maintain the overall reliability of the code base and is a prerequisite for getting your PR approved. Assigned reviewers regularly review the PR queue and tend to focus on PRs that are passing. 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 #2393 +/- ##
===========================================
+ Coverage 98.04% 98.08% +0.04%
===========================================
Files 249 249
Lines 7194 7194
Branches 2067 2055 -12
===========================================
+ Hits 7053 7056 +3
+ Misses 131 128 -3
Partials 10 10 ☔ View full report in Codecov by Sentry. |
@palisadoes looks clean to me, PTAL. For now, there are no suggestions from coderabbit. |
@AnshulKahar2729, please fix the description |
Done, sorry I didn't notice. |
@coderabbitai full review |
✅ Actions performedFull review triggered. |
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
🧹 Outside diff range and nitpick comments (1)
src/components/UserPortal/OrganizationCard/OrganizationCard.test.tsx (1)
229-259
: Good test coverage for navigation, consider adding error cases.The test effectively verifies the basic navigation flow. However, consider these improvements:
- Mock the navigation instead of relying on window.location:
// Mock useNavigate const mockNavigate = jest.fn(); jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), useNavigate: () => mockNavigate, })); // Then assert expect(mockNavigate).toHaveBeenCalledWith(`/user/organization/3`);
- Add test cases for:
- Error states (e.g., navigation failure)
- Edge cases (e.g., invalid organization ID)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
src/components/UserPortal/OrganizationCard/OrganizationCard.test.tsx
(2 hunks)
🔇 Additional comments (2)
src/components/UserPortal/OrganizationCard/OrganizationCard.test.tsx (2)
1-2
: LGTM! Good practice to import act
from testing-library.
The change to import act
from '@testing-library/react' instead of 'react' follows React Testing Library's best practices for testing React components.
Line range hint 1-260
: Verify test coverage meets requirements.
The test suite provides good coverage of main functionality, but to ensure 100% coverage as required by issue #2370, consider adding tests for:
-
Error handling:
- Network errors in GraphQL mutations
- Invalid server responses
- Toast error notifications
-
Edge cases:
- Empty/null organization data
- Missing required props
- Invalid address formats
-
Component state updates:
- Loading states during API calls
- UI updates after successful/failed operations
…d/OrganizationCard.tsx` (PalisadoesFoundation#2393) * improve testcase for org card * act function warning
…ationCard/OrganizationCard.tsx` (PalisadoesFoundation#2393)" This reverts commit becd2d1.
…le. (#2386) * leftDrawerOrg:Fixed the org not found error on viewing admin profile. * created getIdfromPath utitily function * corrected test code * removed unwanted newId variable * added a comment for isProfilePage * removed unwanted check in getIdFromPath func * Revert "removed unwanted check in getIdFromPath func" This reverts commit e1e86e3. * Feat : Write Unittests for `src/components/UserPortal/OrganizationCard/OrganizationCard.tsx` (#2393) * improve testcase for org card * act function warning * Added no pathname condition on getIdFromPath * added useMemo hook * Revert "Feat : Write Unittests for `src/components/UserPortal/OrganizationCard/OrganizationCard.tsx` (#2393)" This reverts commit becd2d1. * Updated comment to accurately reflect array indexing. --------- Co-authored-by: Peter Harrison <[email protected]> Co-authored-by: Anshul Kahar <[email protected]> Co-authored-by: Pranshu Gupta <[email protected]> Co-authored-by: Vamshi Maskuri <[email protected]>
What kind of change does this PR introduce?
feature
Issue Number:
Fixes #2370
Did you add tests for your changes?
Yes
Have you read the contributing guide?
Yes
Summary by CodeRabbit
New Features
Bug Fixes
act
to enhance test reliability.Tests