-
-
Notifications
You must be signed in to change notification settings - Fork 637
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
Refactored src/components/AddOn/core/AddOnEntry/AddOnEntry.test.tsx from Jest to Vitest #2501
base: develop-postgres
Are you sure you want to change the base?
Conversation
WalkthroughThe changes in this pull request introduce a new test suite for the Changes
Assessment against linked issues
Possibly related issues
Possibly related PRs
📜 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
🧹 Outside diff range and nitpick comments (3)
src/components/AddOn/core/AddOnEntry/AddOnEntry.spec.tsx (3)
42-42
: Consider using beforeEach for mockID reset.Using a mutable variable across tests can lead to test interdependence. Consider resetting it before each test.
+beforeEach(() => { + mockID = '1'; +});
50-64
: Reduce props duplication using a test factory.The props object is duplicated across multiple test cases. Consider creating a factory function.
const createTestProps = (overrides = {}) => ({ id: '1', title: 'Test Addon', description: 'Test addon description', createdBy: 'Test User', component: 'string', installed: true, configurable: true, modified: true, isInstalled: true, uninstalledOrgs: [], enabled: true, getInstalledPlugins: () => ({ sample: 'sample' }), ...overrides });Also applies to: 107-122, 142-157
141-184
: Split uninstall button test into separate cases.The uninstall button test is testing multiple behaviors in a single test. Consider splitting it for better clarity and maintenance.
describe('Uninstall Button', () => { test('shows "Install" text initially', async () => { // Test initial state }); test('shows success message when uninstalling', async () => { // Test uninstall flow }); test('shows success message when installing', async () => { // Test install flow }); });
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
⛔ Files ignored due to path filters (1)
package-lock.json
is excluded by!**/package-lock.json
📒 Files selected for processing (1)
src/components/AddOn/core/AddOnEntry/AddOnEntry.spec.tsx
(1 hunks)
🔇 Additional comments (3)
src/components/AddOn/core/AddOnEntry/AddOnEntry.spec.tsx (3)
1-26
: LGTM! Comprehensive test setup with appropriate imports.
The imports cover all necessary testing utilities and dependencies for a complete test environment.
186-200
: LGTM! Good navigation test.
The test properly verifies the redirect behavior when orgId is undefined.
1-201
: Successfully migrated from Jest to Vitest.
The test suite has been properly migrated to Vitest while maintaining good test coverage and practices. All Jest-specific APIs have been replaced with their Vitest equivalents, and the file has been correctly renamed to .spec.tsx
.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop-postgres #2501 +/- ##
=====================================================
- Coverage 95.82% 83.78% -12.04%
=====================================================
Files 295 312 +17
Lines 7037 8117 +1080
Branches 1520 1776 +256
=====================================================
+ Hits 6743 6801 +58
- Misses 98 1177 +1079
+ Partials 196 139 -57 ☔ View full report in Codecov by Sentry. |
What kind of change does this PR introduce?
Refactoring
Issue Number:
Fixes #2478
Did you add tests for your changes?
Yes
Snapshots/Videos:
Summary
Migrated test for AddOnEntry.tsx from jest to vitest.
Does this PR introduce a breaking change?
No
Have you read the contributing guide?
Yes.
Summary by CodeRabbit