test: add useMemoryMatch hook coverage - #1726
Open
SujalMahapatra wants to merge 1 commit into
Open
Conversation
📝 WalkthroughWalkthroughAdded a dedicated Vitest suite for ChangesMemory Match hook coverage
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@frontend/src/hooks/useMemoryMatch.test.js`:
- Around line 1-8: Remove act from the React import and retain the act import
from `@testing-library/react`, leaving the existing renderHook import unchanged.
- Around line 126-134: Update the card-count assertion in the useMemoryMatch
test to compare Object.values(counts) exactly with Array(8).fill(2), replacing
the permissive expect.arrayContaining matcher while retaining the eight-key
assertion.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 8b02b67f-72ce-4c3e-9f4d-f81e2e070073
⛔ Files ignored due to path filters (1)
frontend/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (2)
frontend/package.jsonfrontend/src/hooks/useMemoryMatch.test.js
Contributor
Author
|
Hi @KaranUnique , |
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.
📝 Pull Request Description
Related Issue
Closes #1721
Summary
Provide a short, reviewer-friendly summary of what changed and why.
Added comprehensive Vitest coverage for the
useMemoryMatchReact hook.The test suite covers the hook's core game lifecycle, including initialization, persisted high scores, difficulty configuration, game startup, card generation, timers, pause/resume behavior, quitting, accuracy calculation, and difficulty changes.
Also added the required React Testing Library dependency to properly test the hook with
renderHookandact.Type of Change
How Has This Been Tested?
Describe the testing steps performed.
useMemoryMatch.test.jswith 10 automated tests.Screenshots (if applicable)
Add screenshots or videos to demonstrate the changes.
Checklist
Adds comprehensive Vitest coverage for
useMemoryMatch.@testing-library/reactforrenderHookandact.