[scanner] 🐛 fix: update StorageOverview tests for useModalState migration#19312
Conversation
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) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: github-actions[bot] <github-actions[bot]@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 |
|
👋 Hey @clubanderson — thanks for opening this PR!
This is an automated message. |
|
🐝 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. |
✅ 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 the StorageOverview unit test mocks to match the post-useModalState migration CardComponents usage, fixing render-time failures caused by missing mocked exports.
Changes:
- Add
Reactimport to supportReact.ReactNodetyping in mock component props. - Update
CardComponentsmock to provideCardControlsRow(including acluster-filtertest hook) and pass-through layout helpers (CardHeaderRow,CardStatGrid,CardStatHeader).
|
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 Verification: passedCommit: |
|
Post-merge build verification passed ✅ Both Go and frontend builds compiled successfully against merge commit |
Fixes #19311
Updates StorageOverview tests to work with the useModalState migration from PR #19310.
The
CardComponentsmock in__tests__/StorageOverview.test.tsxonly exportedCardClusterFilter, but after PR #19310 theStorageOverviewcomponent rendersCardControlsRow,CardHeaderRow,CardStatGrid, andCardStatHeaderfrom that module. These wereundefinedin the mock, causing all 7 tests to fail at render time.Changes:
import React from 'react'forReact.ReactNodetype usage in mocksCardClusterFiltermock withCardControlsRowmock that rendersdata-testid="cluster-filter"when theclusterFilterprop is provided (preserving the cluster filter test intent)CardHeaderRowmock that passes through childrenCardStatGridmock that passes through childrenCardStatHeadermock that passes through children