Skip to content

Commit 0d6d562

Browse files
clubandersongithub-actions[bot]Copilot
authored
[scanner] 🐛 fix: update StorageOverview tests for useModalState migration (#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>
1 parent 697cf5e commit 0d6d562

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

web/src/components/cards/__tests__/StorageOverview.test.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import React from 'react'
12
import { beforeEach, describe, expect, it, vi } from 'vitest'
23
import { render, screen } from '@testing-library/react'
34
import { StorageOverview } from '../StorageOverview'
@@ -45,9 +46,16 @@ vi.mock('../../../lib/cards/cardHooks', () => ({
4546
}))
4647

4748
vi.mock('../../../lib/cards/CardComponents', () => ({
48-
CardClusterFilter: ({ availableClusters }: { availableClusters: Array<{ name: string }> }) => (
49-
<div data-testid="cluster-filter" data-count={availableClusters.length} />
49+
CardHeaderRow: ({ children }: { children: React.ReactNode }) => <>{children}</>,
50+
CardControlsRow: ({ clusterFilter }: {
51+
clusterFilter?: { availableClusters: Array<{ name: string }> }
52+
}) => (
53+
<div data-testid="controls-row">
54+
{clusterFilter && <div data-testid="cluster-filter" data-count={clusterFilter.availableClusters.length} />}
55+
</div>
5056
),
57+
CardStatGrid: ({ children }: { children: React.ReactNode }) => <>{children}</>,
58+
CardStatHeader: ({ children }: { children: React.ReactNode }) => <>{children}</>,
5159
}))
5260

5361
vi.mock('../../../lib/formatStats', () => ({

0 commit comments

Comments
 (0)