π§© Background
loadFromStorage in hooks/useRecentSearches.ts guards with typeof window === 'undefined'. This path has no test since jsdom always provides window.
π― Objective
Add a test that temporarily removes window to verify the SSR guard.
π Files to touch
hooks/useRecentSearches.test.ts
π οΈ Implementation steps
- Before rendering the hook, temporarily delete
global.window.
- Assert the hook initializes with an empty
searches array.
- Restore
global.window after the test.
β
Definition of done
π§© Background
loadFromStorageinhooks/useRecentSearches.tsguards withtypeof window === 'undefined'. This path has no test since jsdom always provideswindow.π― Objective
Add a test that temporarily removes
windowto verify the SSR guard.π Files to touch
hooks/useRecentSearches.test.tsπ οΈ Implementation steps
global.window.searchesarray.global.windowafter the test.β Definition of done