Files
nuzlocke-tracker/.beans/nuzlocke-tracker-ee9s--unit-tests-for-frontend-utilities-and-hooks.md
Julian Tabel 0d2f419c6a Add unit tests for frontend utilities and hooks
82 tests covering download.ts and all React Query hooks. API modules are
mocked with vi.mock; mutation tests spy on queryClient.invalidateQueries
to verify cache invalidation. Conditional queries (null id) are verified
to stay idle.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 13:47:55 +01:00

1.2 KiB

title, status, type, priority, created_at, updated_at, parent
title status type priority created_at updated_at parent
Unit tests for frontend utilities and hooks completed task normal 2026-02-10T09:33:38Z 2026-02-21T12:47:19Z 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

  • Test utils/formatEvolution.ts — done in smoke test
  • Test utils/download.ts — blob URL creation, filename, cleanup
  • Test hooks/useGames.ts — query hooks and disabled state
  • Test hooks/useRuns.ts — query hooks + mutations with cache invalidation
  • Test hooks/useEncounters.ts — mutations and conditional queries
  • Test hooks/usePokemon.ts — conditional queries
  • Test hooks/useGenlockes.ts — queries and mutations
  • Test hooks/useBosses.ts — queries and mutations
  • Test hooks/useStats.ts — single query hook
  • Test hooks/useAdmin.ts — representative subset (usePokemonList, useCreateGame, useDeleteGame)