-
-
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/screens/OrganizationFunds from Jest to Vitest #2684
Refactor: src/screens/OrganizationFunds from Jest to Vitest #2684
Conversation
WalkthroughThis pull request involves updating the Changes
Assessment against linked issues
Possibly related issues
Possibly related PRs
Suggested labels
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
|
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
🔭 Outside diff range comments (1)
package.json (1)
Version incompatibility detected between dependencies
- The project uses React 18.3.1, but @types/react is pinned to 17.0.2, which may cause type mismatches
- GraphQL 16.9.0 is used, but @apollo/client 3.4.0-beta.19 requires GraphQL ^14.0.0 || ^15.0.0
- Required peer dependency 'subscriptions-transport-ws' is missing
🔗 Analysis chain
Line range hint
164-167
: Verify dependency resolution compatibilityThe resolutions for @apollo/client and React types are pinned to specific versions. While this helps avoid conflicts, we should verify these versions are compatible with the rest of the ecosystem.
Consider documenting the reason for these specific version pins in the package.json comments or README to help future maintenance.
Let me gather more information about the graphql version being used and other related dependencies.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check for potential compatibility issues with specified versions npm info @apollo/[email protected] peerDependencies npm info @types/[email protected] peerDependenciesLength of output: 213
Script:
#!/bin/bash # Check the actual graphql version and other related dependencies cat package.json | jq '.dependencies.graphql, .dependencies["@apollo/client"], .dependencies.react, .dependencies["react-dom"]' # Check if subscriptions-transport-ws is present cat package.json | jq '.dependencies["subscriptions-transport-ws"], .devDependencies["subscriptions-transport-ws"]'Length of output: 297
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.json
is excluded by!**/package-lock.json
📒 Files selected for processing (3)
package.json
(1 hunks)src/screens/OrganizationFunds/FundModal.spec.tsx
(4 hunks)src/screens/OrganizationFunds/OrganizationFunds.spec.tsx
(9 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
src/screens/OrganizationFunds/OrganizationFunds.spec.tsx
[error] 84-86: Disallow duplicate setup and teardown hooks.
Disallow afterEach duplicacy inside the describe function.
(lint/suspicious/noDuplicateTestHooks)
🔇 Additional comments (3)
package.json (1)
159-159
: LGTM: Vitest version update
The update to Vitest v2.1.8 aligns with the migration objective.
src/screens/OrganizationFunds/OrganizationFunds.spec.tsx (1)
71-77
: LGTM: Proper async mock implementation
The async mock implementation for react-router-dom correctly preserves the actual module's functionality while mocking useParams.
src/screens/OrganizationFunds/FundModal.spec.tsx (1)
26-31
: LGTM: Consistent mock migration
The migration from Jest to Vitest mocks is implemented correctly and consistently throughout the file, including:
- Mock implementation for react-toastify
- Mock functions for hide and refetchFunds in fundProps
Also applies to: 42-42, 58-58, 64-64, 80-80
vi.clearAllMocks(); | ||
}); | ||
|
||
afterEach(() => { | ||
cleanup(); | ||
}); |
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.
🛠️ Refactor suggestion
Merge duplicate afterEach blocks
There are two consecutive afterEach blocks that should be combined for better maintainability.
afterEach(() => {
vi.clearAllMocks();
- });
-
- afterEach(() => {
cleanup();
});
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
vi.clearAllMocks(); | |
}); | |
afterEach(() => { | |
cleanup(); | |
}); | |
afterEach(() => { | |
vi.clearAllMocks(); | |
cleanup(); | |
}); |
🧰 Tools
🪛 Biome (1.9.4)
[error] 84-86: Disallow duplicate setup and teardown hooks.
Disallow afterEach duplicacy inside the describe function.
(lint/suspicious/noDuplicateTestHooks)
I am encountering this check ( PR Workflow / Runs Introspection on the GitHub talawa-api repo on the schema.graphql file) unsuccessful too in one of my pull request, how are you planning to fix it? Also the file for which this check fails is in Graphql, which I havent changed in my issue. How does it then link to my file checks? |
@palisadoes https://github.com/PalisadoesFoundation/talawa-admin/actions/runs/12409861519/job/34644307629?pr=2684 Prettier not found error in the workflow. Have any recent changes done to this workflow? |
I have made changes to the file so that it passes the formating check now . I will make a new PR . |
We have a policy of unassigning contributors who close PRs without getting validation from our reviewer team. This is because:
Please be considerate of our volunteers' limited time and our desire to improve our code base. This policy is stated as a pinned post in all our Talawa repositories. Our YouTube videos explain why this practice is not acceptable to our Community. In most cases you don’t have to close the PR to trigger the GitHub workflow to run again. Making a new commit and pushing it to your GitHub account will normally be sufficient. Unfortunately, if this continues we will have to close the offending PR and unassign you from the issue. |
What kind of change does this PR introduce?
refactoring
Issue Number:
Fixes #2561
Did you add tests for your changes?
no
Snapshots/Videos:
Summary
refactored two files from jest to vitest framework
1.OrganizationFunds
2.FundModal
Does this PR introduce a breaking change?
NO
Have you read the contributing guide?
YES
Summary by CodeRabbit
New Features
FundModal
andOrganizationFunds
components, ensuring accurate functionality and user interactions.Bug Fixes
OrganizationFunds
component.Tests