Commit a3dcc4d
authored
test(useRecentSearches): verify clearSearches removes the localStorage key (JhaSourav07#802)
## Description
Fixes JhaSourav07#717
This PR improves test coverage for the useRecentSearches hook by
verifying that clearSearches correctly removes the persisted
localStorage entry.
● Changes Made
Added a spy for localStorage.removeItem
Verified clearSearches() calls:
removeItem('recentSearches')
Preserved all existing hook test behavior
## Pillar
Testing / Quality Assurance
## Visual Preview
<img width="1920" height="1080" alt="Screenshot 2026-05-28 004327"
src="https://github.com/user-attachments/assets/3018699d-abb8-4466-aefa-041ce22fe584"
/>
<img width="1920" height="1080" alt="Screenshot 2026-05-28 004343"
src="https://github.com/user-attachments/assets/cf412082-6cd3-45c0-8b29-d3daf4d18844"
/>
<img width="1920" height="1080" alt="Screenshot 2026-05-28 004419"
src="https://github.com/user-attachments/assets/c465f5db-5fab-4c93-a144-f0af325c0893"
/>
● Why This Matters
This ensures:
localStorage cleanup works correctly
stale recent search data is removed properly
future regressions in persistence behavior are caught automatically
## Checklist before requesting a review:
- I have read the `CONTRIBUTING.md` file.
- I have tested these changes locally
(`localhost:3000/api/streak?user=YOUR_USERNAME`).
- I have run `npm run format` and `npm run lint` locally and resolved
all errors (CI will fail otherwise).
- My commits follow the Conventional Commits format (e.g.,
`feat(themes): ...`, `fix(calculate): ...`).
- I have updated `README.md` if I added a new theme or URL parameter.
- I have started the repo.
- I have made sure that i have only one commit to merge in this PR.
- The SVG output matches the CommitPulse "premium quality" aesthetic
standard (no raw elements, smooth animations, correct fonts).
- I joined the CommitPulse Discord community for contributor
discussions, mentorship, and faster PR support.1 parent d881686 commit a3dcc4d
3 files changed
Lines changed: 15 additions & 5 deletions
File tree
- app/(root)/dashboard/[username]
- hooks
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
| 132 | + | |
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
66 | 68 | | |
| 69 | + | |
67 | 70 | | |
68 | 71 | | |
69 | 72 | | |
| 73 | + | |
70 | 74 | | |
71 | 75 | | |
72 | 76 | | |
| 77 | + | |
73 | 78 | | |
| 79 | + | |
74 | 80 | | |
75 | 81 | | |
76 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
78 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
79 | 83 | | |
80 | 84 | | |
81 | 85 | | |
| |||
0 commit comments