You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test: Add unit tests for useClipboardCopy custom hook #236
Add unit test coverage for the useClipboardCopy React hook located in src/hooks/use-clipboard-copy.ts.
Motivation
useClipboardCopy is used across user profiles and comparison views. Having automated tests guarantees that clipboard API timeouts and error fallbacks remain stable.
Tasks
Create src/hooks/tests/use-clipboard-copy.test.ts using Vitest.
Mock navigator.clipboard.writeText.
Test successful text copying and verify copied state becomes true.
Test timeout behavior using vi.useFakeTimers() to ensure copied resets to false after timeoutMs.
Test clipboard rejection/failure to ensure graceful error handling (copied remains false).
Run pnpm test.
Tip
🚀 Want to contribute?
Comment assign me to be automatically assigned to this issue via our GitHub Actions bot. Happy coding! ✨
Add unit test coverage for the
useClipboardCopyReact hook located insrc/hooks/use-clipboard-copy.ts.Motivation
useClipboardCopyis used across user profiles and comparison views. Having automated tests guarantees that clipboard API timeouts and error fallbacks remain stable.Tasks
src/hooks/tests/use-clipboard-copy.test.tsusing Vitest.navigator.clipboard.writeText.copiedstate becomestrue.vi.useFakeTimers()to ensurecopiedresets tofalseaftertimeoutMs.copiedremainsfalse).pnpm test.Tip
🚀 Want to contribute?
Comment
assign meto be automatically assigned to this issue via our GitHub Actions bot. Happy coding! ✨