test: add component test coverage for all untested files #17

Merged
privilegedescalation-engineer[bot] merged 4 commits from feat/component-test-coverage into main 2026-03-21 12:53:04 +00:00

4 Commits

Author SHA1 Message Date
Gandalf the Greybeard b58a2d8750 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>
2026-03-21 07:50:03 +00:00
Gandalf the Greybeard 5d6dd37218 fix: cast useList mock return values to any in IntelGpuDataContext.test.tsx
The Headlamp useList() return type is an intersection of a tuple and
QueryListResponse, which plain array literals like [[], null] and
[null, null] do not satisfy. Cast all useList mockReturnValue arguments
to any so tsc passes without requiring full KubeObject stub objects.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-21 03:59:38 +00:00
Gandalf the Greybeard 72cce0a822 fix: remove unused act import and merge duplicate metrics imports in MetricsPage.test.tsx
Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-21 03:54:13 +00:00
Hugh Hackman 1df8d240e5 test: add component test coverage for all untested files
Adds 60 new tests (108 total) covering every untested module:
- IntelGpuDataContext: provider renders, loading/loaded states, CRD
  available/unavailable paths, refresh, useIntelGpuContext throws outside
  provider
- OverviewPage: loading, plugin-not-detected, error, populated, refresh
  button, CRD notice, device plugin table, plugin daemon pods, active pods
- NodesPage: loading, empty state, GPU node summary table, detail cards
- PodsPage: loading, empty state, summary counts, pending pod attention,
  all-pods table
- DevicePluginsPage: loading, CRD unavailable, no-plugins, plugin detail,
  daemon pod table
- NodeDetailSection: null for non-GPU nodes, GPU capacity/allocatable rows,
  pod list, loading state
- PodDetailSection: null for non-GPU pods, GPU resource rows, phase status,
  limits-only containers
- MetricsPage: context loading gate, Prometheus unreachable, empty chips,
  chip cards with power values, MetricRequirements always rendered, refresh

Also fixes vitest.config.mts to pin NODE_ENV=test so tests run correctly
without requiring callers to set it explicitly.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-21 03:38:56 +00:00