style: run Prettier formatting and ESLint lint:fix on test files
Addresses CI format:check failures and import-sort warning in MetricsPage.test.tsx flagged by QA on PR #17. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -124,9 +124,7 @@ describe('DevicePluginsPage', () => {
|
||||
);
|
||||
render(<DevicePluginsPage />);
|
||||
expect(screen.getByText('CRD Not Available')).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByText(/GpuDevicePlugin CRD.*is not installed/)
|
||||
).toBeInTheDocument();
|
||||
expect(screen.getByText(/GpuDevicePlugin CRD.*is not installed/)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('shows "No Device Plugins" section when crdAvailable=true but devicePlugins empty', () => {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { fireEvent, render, screen, waitFor } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import { IntelGpuContextValue, useIntelGpuContext } from '../api/IntelGpuDataContext';
|
||||
import { GpuChipMetrics, GpuMetrics, fetchGpuMetrics } from '../api/metrics';
|
||||
import { fetchGpuMetrics, GpuChipMetrics, GpuMetrics } from '../api/metrics';
|
||||
import MetricsPage from './MetricsPage';
|
||||
|
||||
vi.mock('@kinvolk/headlamp-plugin/lib/CommonComponents', () => ({
|
||||
|
||||
@@ -89,9 +89,7 @@ describe('NodeDetailSection', () => {
|
||||
|
||||
it('renders nothing for a non-GPU node passed via jsonData wrapper', () => {
|
||||
vi.mocked(useIntelGpuContext).mockReturnValue(makeContext());
|
||||
const { container } = render(
|
||||
<NodeDetailSection resource={{ jsonData: nonGpuNodeRaw }} />
|
||||
);
|
||||
const { container } = render(<NodeDetailSection resource={{ jsonData: nonGpuNodeRaw }} />);
|
||||
expect(container).toBeEmptyDOMElement();
|
||||
});
|
||||
|
||||
@@ -132,9 +130,7 @@ describe('NodeDetailSection', () => {
|
||||
metadata: { name: 'my-gpu-pod', namespace: 'default', uid: 'uid-pod-1' },
|
||||
spec: {
|
||||
nodeName: 'gpu-node-1',
|
||||
containers: [
|
||||
{ name: 'main', resources: { requests: { 'gpu.intel.com/i915': '1' } } },
|
||||
],
|
||||
containers: [{ name: 'main', resources: { requests: { 'gpu.intel.com/i915': '1' } } }],
|
||||
},
|
||||
status: { phase: 'Running' },
|
||||
};
|
||||
|
||||
@@ -109,7 +109,10 @@ describe('OverviewPage', () => {
|
||||
name: 'gpu-node-1',
|
||||
labels: { 'intel.feature.node.kubernetes.io/gpu': 'true' },
|
||||
},
|
||||
status: { capacity: { 'gpu.intel.com/i915': '1' }, allocatable: { 'gpu.intel.com/i915': '1' } },
|
||||
status: {
|
||||
capacity: { 'gpu.intel.com/i915': '1' },
|
||||
allocatable: { 'gpu.intel.com/i915': '1' },
|
||||
},
|
||||
};
|
||||
vi.mocked(useIntelGpuContext).mockReturnValue(
|
||||
makeContext({ loading: false, pluginInstalled: true, gpuNodes: [node] })
|
||||
|
||||
@@ -36,9 +36,7 @@ const nonGpuPodRaw = {
|
||||
kind: 'Pod',
|
||||
metadata: { name: 'plain-pod', namespace: 'default' },
|
||||
spec: {
|
||||
containers: [
|
||||
{ name: 'main', resources: { requests: { cpu: '100m', memory: '128Mi' } } },
|
||||
],
|
||||
containers: [{ name: 'main', resources: { requests: { cpu: '100m', memory: '128Mi' } } }],
|
||||
},
|
||||
status: { phase: 'Running' },
|
||||
};
|
||||
@@ -86,9 +84,7 @@ describe('PodDetailSection', () => {
|
||||
});
|
||||
|
||||
it('renders nothing for a non-GPU pod passed via jsonData', () => {
|
||||
const { container } = render(
|
||||
<PodDetailSection resource={{ jsonData: nonGpuPodRaw }} />
|
||||
);
|
||||
const { container } = render(<PodDetailSection resource={{ jsonData: nonGpuPodRaw }} />);
|
||||
expect(container).toBeEmptyDOMElement();
|
||||
});
|
||||
|
||||
|
||||
@@ -135,9 +135,7 @@ describe('PodsPage', () => {
|
||||
|
||||
it('shows summary section with total count when pods present', () => {
|
||||
const pods = [makeRunningPod('pod-1'), makeRunningPod('pod-2')];
|
||||
vi.mocked(useIntelGpuContext).mockReturnValue(
|
||||
makeContext({ loading: false, gpuPods: pods })
|
||||
);
|
||||
vi.mocked(useIntelGpuContext).mockReturnValue(makeContext({ loading: false, gpuPods: pods }));
|
||||
render(<PodsPage />);
|
||||
expect(screen.getByText('Summary')).toBeInTheDocument();
|
||||
// 'Total GPU Pods' label is present; '2' appears in multiple places (row value + status label)
|
||||
@@ -147,9 +145,7 @@ describe('PodsPage', () => {
|
||||
|
||||
it('shows "Attention: Pending GPU Pods" section when pending pods exist', () => {
|
||||
const pods = [makePendingPod('pending-pod-1')];
|
||||
vi.mocked(useIntelGpuContext).mockReturnValue(
|
||||
makeContext({ loading: false, gpuPods: pods })
|
||||
);
|
||||
vi.mocked(useIntelGpuContext).mockReturnValue(makeContext({ loading: false, gpuPods: pods }));
|
||||
render(<PodsPage />);
|
||||
expect(screen.getByText('Attention: Pending GPU Pods')).toBeInTheDocument();
|
||||
// Pod name appears in both the main "All GPU Pods" table and the pending attention table
|
||||
@@ -166,9 +162,7 @@ describe('PodsPage', () => {
|
||||
|
||||
it('shows "All GPU Pods" table with pod name when pods present', () => {
|
||||
const pods = [makeRunningPod('my-workload')];
|
||||
vi.mocked(useIntelGpuContext).mockReturnValue(
|
||||
makeContext({ loading: false, gpuPods: pods })
|
||||
);
|
||||
vi.mocked(useIntelGpuContext).mockReturnValue(makeContext({ loading: false, gpuPods: pods }));
|
||||
render(<PodsPage />);
|
||||
expect(screen.getByText('All GPU Pods')).toBeInTheDocument();
|
||||
expect(screen.getByText('my-workload')).toBeInTheDocument();
|
||||
|
||||
Reference in New Issue
Block a user