test(COMPT-33): consolidate all hook tests into src/hooks/__tests__/#10
Conversation
- Move useDebounce, useLocalStorage, useSessionStorage, useMediaQuery, useWindowSize, useClickOutside, useIntersectionObserver tests to __tests__/ - Update relative imports from ./ to ../ - All 12 hooks covered: fake timers for debounce/interval/timeout/windowSize, mock matchMedia, mock IntersectionObserver, storage parse-error guards - 55 tests passing, 97.44% line coverage (>= 85% AC)
|
There was a problem hiding this comment.
Pull request overview
This PR consolidates hook test files under src/hooks/__tests__/ and updates test imports accordingly, while documenting the new test layout and adding a changeset entry for COMPT-33.
Changes:
- Update hook test imports to reference hook modules via
../after moving tests intosrc/hooks/__tests__/. - Update repo instructions to document the consolidated hook test location and COMPT-33 status.
- Add a Changesets entry describing the consolidated test suite and coverage expectations.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/hooks/tests/useWindowSize.test.ts | Updates import path for useWindowSize/getWindowSize after test relocation. |
| src/hooks/tests/useSessionStorage.test.ts | Updates import paths for useSessionStorage and storage helper. |
| src/hooks/tests/useMediaQuery.test.ts | Updates import path for useMediaQuery after test relocation. |
| src/hooks/tests/useLocalStorage.test.ts | Updates import paths for useLocalStorage and storage helper. |
| src/hooks/tests/useIntersectionObserver.test.ts | Updates import path for useIntersectionObserver after test relocation. |
| src/hooks/tests/useDebounce.test.ts | Updates import path for useDebounce after test relocation. |
| src/hooks/tests/useClickOutside.test.ts | Updates import path for useClickOutside after test relocation. |
| .github/instructions/copilot-instructions.md | Documents COMPT-33 test consolidation and updates module structure listing. |
| .changeset/COMPT-33-test-suite.md | Adds release note for COMPT-33 test suite consolidation and coverage goals. |
| - **State & Storage** (COMPT-30 ✅) — `useDebounce`, `useLocalStorage`, `useSessionStorage` | ||
| - **DOM & Events** (COMPT-31 ✅) — `useMediaQuery`, `useWindowSize`, `useClickOutside`, `useIntersectionObserver` | ||
| <<<<<<< HEAD | ||
| - **Async & Lifecycle** (COMPT-32 ✅) — `usePrevious`, `useToggle`, `useInterval`, `useTimeout`, `useIsFirstRender` | ||
| - **Test Suite** (COMPT-33 ✅) — Full coverage for all 12 hooks, all tests in `src/hooks/__tests__/` | ||
|
|
There was a problem hiding this comment.
The docs state the package provides/tests “all 12 hooks”, but the public exports include an additional hook (useNoop) via src/hooks/index.ts (and re-exported from src/index.ts). Either update the docs/count to include useNoop (and its test location), or stop exporting it if it’s not meant to be part of the public hook surface.
| - Consolidate all hook tests under src/hooks/__tests__/ | ||
| - Cover all 12 hooks: useDebounce, useLocalStorage, useSessionStorage, | ||
| useMediaQuery, useWindowSize, useClickOutside, useIntersectionObserver, | ||
| usePrevious, useToggle, useInterval, useTimeout, useIsFirstRender | ||
| - Use vitest fake timers for useDebounce, useInterval, useTimeout, useWindowSize |
There was a problem hiding this comment.
This release note says the test suite covers “all 12 hooks”, but the package currently exports another hook (useNoop) publicly. Please either include useNoop in this list/coverage statement, or adjust exports so the “12 hooks” claim is accurate.



Summary
Why
Checklist
npm run lintpassesnpm run typecheckpassesnpm testpassesnpm run buildpassesnpx changeset) if this affects consumersNotes