[scanner] 🐛 fix: update StorageOverview and MiniDashboard tests for useModalState migration#19310
Conversation
…seModalState migration Signed-off-by: Andy Anderson <andy@clubanderson.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
✅ Deploy Preview for kubestellarconsole ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
🐝 Hi @clubanderson! I'm Trusted users — org members and contributors with write access — can mention Automation may take a moment to start, and follow-up happens through workflow activity rather than chat replies. |
|
👋 Hey @clubanderson — thanks for opening this PR!
This is an automated message. |
✅ Test Coverage CheckAll new source files in this PR have corresponding test files. Checked |
There was a problem hiding this comment.
Pull request overview
This PR updates frontend unit tests that started failing after the useModalState migration (PR #19295), aligning assertions and mocks with the updated component behavior for StorageOverview and MiniDashboard. CI will validate web build/lint on the PR.
Changes:
- Update
MiniDashboardtest expectations to assert health/status color-coding based on offline nodes and pod issues. - Refactor
StorageOverviewtests with centralized mock setup and updated i18n/formatting expectations to match current rendering.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| web/src/components/widget/MiniDashboard.test.tsx | Updates mocks and assertions to validate status indicators and CSS class-based health coloring. |
| web/src/components/cards/tests/StorageOverview.test.tsx | Refactors mocks/setup and updates assertions for skeleton/empty states, stats, cluster filter, and footer text. |
| vi.mock('../../../lib/cards/CardComponents', () => ({ | ||
| CardClusterFilter: () => <div data-testid="cluster-filter" />, | ||
| CardClusterFilter: ({ availableClusters }: { availableClusters: Array<{ name: string }> }) => ( | ||
| <div data-testid="cluster-filter" data-count={availableClusters.length} /> | ||
| ), | ||
| })) |
|
Thank you for your contribution! Your PR has been merged. Check out what's new:
Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey |
|
Post-merge build verification passed ✅ Both Go and frontend builds compiled successfully against merge commit |
✅ Post-Merge Verification: passedCommit: |
…tion (#19312) The CardComponents mock only exported CardClusterFilter, but after PR #19310 the StorageOverview component uses CardControlsRow, CardHeaderRow, CardStatGrid, and CardStatHeader from that module. These were undefined in the mock, causing all 7 tests to fail when the component tried to render them. - Add React import for ReactNode type usage in mocks - Add CardHeaderRow mock (renders children as fragment) - Replace CardClusterFilter mock with CardControlsRow mock that renders the cluster-filter testid when clusterFilter prop is provided - Add CardStatGrid mock (renders children as fragment) - Add CardStatHeader mock (renders children as fragment) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fixes #19309
Updates test expectations to match the component API changes from PR #19295 (useModalState hook migration).