--- # nuzlocke-tracker-ee9s title: Unit tests for frontend utilities and hooks status: completed type: task priority: normal created_at: 2026-02-10T09:33:38Z updated_at: 2026-02-21T12:47:19Z parent: nuzlocke-tracker-yzpb --- Write unit tests for the frontend utility functions and custom React hooks. All API modules are mocked with `vi.mock`. Hooks are tested with `renderHook` from @testing-library/react, wrapped in `QueryClientProvider`. Mutation tests spy on `queryClient.invalidateQueries` to verify cache invalidation. ## Checklist - [x] Test `utils/formatEvolution.ts` — done in smoke test - [x] Test `utils/download.ts` — blob URL creation, filename, cleanup - [x] Test `hooks/useGames.ts` — query hooks and disabled state - [x] Test `hooks/useRuns.ts` — query hooks + mutations with cache invalidation - [x] Test `hooks/useEncounters.ts` — mutations and conditional queries - [x] Test `hooks/usePokemon.ts` — conditional queries - [x] Test `hooks/useGenlockes.ts` — queries and mutations - [x] Test `hooks/useBosses.ts` — queries and mutations - [x] Test `hooks/useStats.ts` — single query hook - [x] Test `hooks/useAdmin.ts` — representative subset (usePokemonList, useCreateGame, useDeleteGame)