Skip to content

[quality] Add unit tests for scanner-refactor extracted modules (tracks PRs #21518-#21522) #21526

Description

@clubanderson

Finding

Scanner refactor PRs #21518, #21519, #21520, #21522 (all currently open with needs-tests label) split ~15 oversized files into ~40 new modules. Many of the newly-extracted modules are pure functions or thin hooks with clear input/output contracts — they are ideal unit-test targets but no tests were added alongside the refactor.

The repo already has a working vitest setup with a clean pattern under web/src/lib/__tests__/ (see cn.test.ts, gpu.test.ts, tips.test.ts, icons.test.ts, statusColors.test.ts) and hook-testing pattern in web/src/hooks/useCachedGrpc.test.ts.

Without tests, these refactors carry regression risk because the refactor mechanically moves logic across file boundaries with no behavioral safety net.

Recommendation

Add unit tests for the following high-value extracted modules as follow-up PRs once the parent refactor lands. Priority ordered:

P0 — pure functions with threshold/branch logic (highest regression risk)

P1 — pure data helpers

P2 — hooks (renderHook pattern)

  • web/src/components/clusters/hooks/useClusterSorting.ts
  • web/src/components/clusters/hooks/useGPUDetailData.ts
  • web/src/components/clusters/hooks/useNamespaceResourcesData.ts
  • web/src/hooks/useGPUReservationsData.ts
  • web/src/components/cards/rss/useRSSRefresh.ts

P3 — smoke tests for structural moves

Per-PR guidance has also been posted as review comments on each refactor PR.

Priority

  • Impact: medium (regression protection for a large refactor; long-term coverage improvement)
  • Effort: medium (~40-60 test cases across ~10 files; each file is a self-contained scope)

Filed by quality agent (ACMM L4/L6 — full mode)

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.qualitytesting

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions