test: Phase 2 — full hook coverage + pre-push test gate#142
Merged
drbarzaga merged 29 commits intoMay 16, 2026
Conversation
|
@Dayron-Glez is attempting to deploy a commit to the drbarzaga's projects Team on Vercel. A member of the Team first needs to authorize it. |
… loading state assertions
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
drbarzaga
approved these changes
May 16, 2026
Owner
drbarzaga
left a comment
There was a problem hiding this comment.
LGTM! Thanks so much @Dayron-Glez for this contribution 🤝
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #141
This PR completes Phase 2 of the testing strategy by adding
.fn.ts+ test coverage for all remaining 15 custom hooks, and introduces a pre-push hook so tests run automatically before any push to the remote.What changed
🧪 Test coverage — 15 hooks added
Each hook follows the same
.fn.tspattern established in Phase 1 (#138):use-<name>.fn.ts— the real, callable function (imported by tests only, never by the app)__tests__/use-<name>.test.ts(x)— Vitest test file importing from.fn.tsuseLocalStorage,useDebounce,useIntervalvi.useFakeTimers(),localStorageuseClipboard,useOnlineStatus,useMediaQuerynavigatormocks,windoweventsuseClickOutside,useHover,useEventListener,useKeyPress,useLongPressuserEvent, fake timersuseWindowSize,useScrollPositionvi.stubGlobal, resize/scroll eventsuseIntersectionObserverIntersectionObserverclass mockuseFetchfetchmock,waitForTotal: 94 tests across 18 test files — all passing.
🔒 Pre-push hook
Added
.husky/pre-pushto run the full test suite before every push:# .husky/pre-push bun run test:runWhy pre-push and not pre-commit?
lint-staged(ESLint + Prettier) — fast, doesn't block atomic commitsSkipping when needed:
Use this when you need to push a WIP branch or a series of commits that aren't all green yet.
Some
.fn.tsfiles include targetedeslint-disable-next-linecomments for patterns that are intentional but flagged by the project's ESLint rules:use-media-query.fn.tsreact-hooks/set-state-in-effectuse-fetch.fn.tsreact-hooks/set-state-in-effectuse-long-press.fn.tsreact-hooks/refs(×3)These are the same well-known patterns used in the original hook implementations — the disable comments make the intent explicit.
Test plan