Add RTL unit tests for 9 critical Helm plugin components - #16909
Add RTL unit tests for 9 critical Helm plugin components#16909sowmya-sl wants to merge 1 commit into
Conversation
Adds React Testing Library tests covering user-facing behavior for HelmInstallUpgradeForm, HelmReleaseList, HelmReleaseRollbackForm, HelmTabbedPage, HelmURLChartForm, CreateHelmChartRepositoryForm, HelmChartVersionDropdown, HelmReleaseHistory, and RepositoriesList (79 new tests total) as part of the Helm testing SDLC Goal 3. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sowmya-sl The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
WalkthroughAdded comprehensive unit test coverage for Helm plugin list pages, release history, repository creation, installation and upgrade, rollback, and URL-based chart forms. Tests mock component dependencies and verify rendering, loading, errors, state, navigation, and form behavior. ChangesHelm plugin component tests
Estimated code review effort: 4 (Complex) | ~45 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 11❌ Failed checks (1 warning, 10 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
frontend/packages/helm-plugin/src/components/forms/rollback/__tests__/HelmReleaseRollbackForm.spec.tsx (1)
29-39: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExercise the Cancel action.
This test only verifies that the mock renders a Cancel button. It does not verify cancellation behavior. Connect the Cancel button in the
FormFootermock to its cancellation callback, click it, and assert the expected reset or navigation action.Also applies to: 216-220
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@frontend/packages/helm-plugin/src/components/forms/rollback/__tests__/HelmReleaseRollbackForm.spec.tsx` around lines 29 - 39, Update the FormFooter mock and rollback form test to expose and invoke the cancellation callback from the Cancel button, then click that button and assert the expected reset or navigation action. Preserve the existing submit and error-message assertions while covering the cancellation behavior through the relevant rollback form handler.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@frontend/packages/helm-plugin/src/components/forms/url-chart/__tests__/HelmURLChartForm.spec.tsx`:
- Line 140: Update the component text and related assertions to capitalize
“Chart” whenever it immediately follows “Helm”: change the expected URL-chart
heading in
frontend/packages/helm-plugin/src/components/forms/url-chart/__tests__/HelmURLChartForm.spec.tsx
at lines 140-140 to “Install Helm Chart from URL”, and update the repository
description assertion in
frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/__tests__/CreateHelmChartRepositoryForm.spec.tsx
at lines 202-202 to use “Helm Chart”.
---
Nitpick comments:
In
`@frontend/packages/helm-plugin/src/components/forms/rollback/__tests__/HelmReleaseRollbackForm.spec.tsx`:
- Around line 29-39: Update the FormFooter mock and rollback form test to expose
and invoke the cancellation callback from the Cancel button, then click that
button and assert the expected reset or navigation action. Preserve the existing
submit and error-message assertions while covering the cancellation behavior
through the relevant rollback form handler.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 62fb0269-2e36-48d3-a245-34059f92f027
📒 Files selected for processing (9)
frontend/packages/helm-plugin/src/components/details-page/history/__tests__/HelmReleaseHistory.spec.tsxfrontend/packages/helm-plugin/src/components/forms/HelmChartRepository/__tests__/CreateHelmChartRepositoryForm.spec.tsxfrontend/packages/helm-plugin/src/components/forms/install-upgrade/__tests__/HelmChartVersionDropdown.spec.tsxfrontend/packages/helm-plugin/src/components/forms/install-upgrade/__tests__/HelmInstallUpgradeForm.spec.tsxfrontend/packages/helm-plugin/src/components/forms/rollback/__tests__/HelmReleaseRollbackForm.spec.tsxfrontend/packages/helm-plugin/src/components/forms/url-chart/__tests__/HelmURLChartForm.spec.tsxfrontend/packages/helm-plugin/src/components/list-page/__tests__/HelmReleaseList.spec.tsxfrontend/packages/helm-plugin/src/components/list-page/__tests__/HelmTabbedPage.spec.tsxfrontend/packages/helm-plugin/src/components/list-page/__tests__/RepositoriesList.spec.tsx
| it('should render the form title and description', () => { | ||
| renderWithProviders(<HelmURLChartForm {...defaultProps} />); | ||
|
|
||
| expect(screen.getByText('Install Helm chart from URL')).toBeVisible(); |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Use Helm Chart in both expected UI strings.
Update the component text and these assertions together.
frontend/packages/helm-plugin/src/components/forms/url-chart/__tests__/HelmURLChartForm.spec.tsx#L140-L140: expectInstall Helm Chart from URL.frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/__tests__/CreateHelmChartRepositoryForm.spec.tsx#L202-L202: useHelm Chartin the repository description.
Based on learnings, capitalize “Chart” when it immediately follows “Helm”.
📍 Affects 2 files
frontend/packages/helm-plugin/src/components/forms/url-chart/__tests__/HelmURLChartForm.spec.tsx#L140-L140(this comment)frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/__tests__/CreateHelmChartRepositoryForm.spec.tsx#L202-L202
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@frontend/packages/helm-plugin/src/components/forms/url-chart/__tests__/HelmURLChartForm.spec.tsx`
at line 140, Update the component text and related assertions to capitalize
“Chart” whenever it immediately follows “Helm”: change the expected URL-chart
heading in
frontend/packages/helm-plugin/src/components/forms/url-chart/__tests__/HelmURLChartForm.spec.tsx
at lines 140-140 to “Install Helm Chart from URL”, and update the repository
description assertion in
frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/__tests__/CreateHelmChartRepositoryForm.spec.tsx
at lines 202-202 to use “Helm Chart”.
Source: Learnings
Adds React Testing Library tests covering user-facing behavior for HelmInstallUpgradeForm, HelmReleaseList, HelmReleaseRollbackForm, HelmTabbedPage, HelmURLChartForm, CreateHelmChartRepositoryForm, HelmChartVersionDropdown, HelmReleaseHistory, and RepositoriesList (79 new tests total) as part of the Helm testing SDLC Goal 3.
Analysis / Root cause:
Solution description:
Screenshots / screen recording:
Test setup:
Test cases:
Browser conformance:
Additional info:
Reviewers and assignees:
Summary by CodeRabbit