Skip to content

test(web): src/hooks/ is outside the coverage gate — two hooks (useServerJsonImport, useImportClientConfig) have no tests #1787

Description

@cliffhall

Summary

clients/web/src/hooks/ is not listed in the v8 coverage include in clients/web/vite.config.ts, so its four modules (917 lines) fall outside the per-file ≥90 gate — silently. Two of them have no test file at all. This is the live instance of the whitelist caveat documented by #1776 (PR #1784): a module outside components/lib/utils/server is ungated with no warning.

Surfaced during the #1776 review (PR #1784, round 7).

Current state

src/hooks/usePaginatedList.ts      + usePaginatedList.test.tsx     ✓ tested (but ungated)
src/hooks/useScrollMemory.ts       + useScrollMemory.test.tsx      ✓ tested (but ungated)
src/hooks/useServerJsonImport.ts   (308 lines)  — NO test, ungated
src/hooks/useImportClientConfig.ts              — NO test, ungated

useServerJsonImport / useImportClientConfig are real logic (config/JSON import parsing + wiring), consumed by ServerImportJsonModal / ServerImportConfigModal. Some lines execute during those components' tests, but because include never names src/hooks/**, nothing is measured or enforced.

Proposed change

Either:

  • (a) Add 'src/hooks/**/*.{ts,tsx}' to the coverage include in clients/web/vite.config.ts, and bring useServerJsonImport.ts and useImportClientConfig.ts to ≥90 on all four dimensions (lines/statements/functions/branches) with dedicated tests; or
  • (b) If hooks/ is deliberately excluded, document why in AGENTS.md.

(a) is preferred — these are exactly the kind of stateful wiring the gate exists for.

Note

Kept out of PR #1784 (same out-of-scope reasoning applied to customHeaders / navigation.ts there). While in vite.config.ts, consider also normalizing the include bases (it mixes src/**, clients/web/server/**, and path.join(repoRoot, 'core/**') — all resolve, just untidy).

Acceptance

  • src/hooks/** gated (or a documented exclusion).
  • useServerJsonImport.ts and useImportClientConfig.ts at ≥90 on all four dimensions.
  • npm run ci green.

Metadata

Metadata

Assignees

Labels

v2Issues and PRs for v2

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions