Stub the history chart in the guest physical disk test

The expanded disk detail now shows its history charts in view, so this
test mounted HistoryChart, which measures itself with ResizeObserver.
jsdom has none, and the unhandled error failed the frontend job even
though every test passed. Chart rendering stays covered by the
HistoryChart and DiskDetail suites.
This commit is contained in:
rcourtman
2026-10-14 00:13:30 +01:00
parent f0108e4930
commit cca21dcc2c
@@ -1,5 +1,5 @@
import { cleanup, fireEvent, render, screen, waitFor, within } from '@solidjs/testing-library';
import { createSignal } from 'solid-js';
import { createSignal, type JSX } from 'solid-js';
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';
import { AlertsAPI } from '@/api/alerts';
import { useAlertsActivation } from '@/stores/alertsActivation';
@@ -17,6 +17,14 @@ const queryState = vi.hoisted(() => ({
enabled: false,
}));
// The expanded disk detail now shows its history charts in view; the chart
// measures itself with ResizeObserver, which jsdom lacks. Its rendering is
// covered by the HistoryChart and DiskDetail suites.
vi.mock('@/components/shared/HistoryChart', () => ({
HistoryChartHoverGroup: (props: { children: JSX.Element }) => <div>{props.children}</div>,
HistoryChart: (props: { label: string }) => <div data-testid="history-chart">{props.label}</div>,
}));
vi.mock('@/hooks/useUnifiedResources', () => ({
useUnifiedResources: (options: { query: string; enabled: () => boolean }) => {
queryState.query = options.query;