Files
nuzlocke-tracker/.beans/nuzlocke-tracker-ch77--integration-tests-for-games-routes-api.md
Julian Tabel 79eabf4f9f Add integration tests for Games & Routes API
25 tests covering game CRUD (create/list/get/update/delete), slug
uniqueness enforcement, by-region grouping, and route operations
(create/update/delete/reorder). Verifies that list_game_routes
excludes routes with no Pokemon encounters.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 12:51:37 +01:00

31 lines
1.1 KiB
Markdown

---
# nuzlocke-tracker-ch77
title: Integration tests for Games & Routes API
status: completed
type: task
priority: normal
created_at: 2026-02-10T09:33:13Z
updated_at: 2026-02-21T11:48:10Z
parent: nuzlocke-tracker-yzpb
---
Write integration tests for the games and routes API endpoints in backend/src/app/api/games.py.
## Key behaviors to test
- Game CRUD: create (201), list, get with routes, update, delete (204)
- Slug uniqueness enforced at create and update (409)
- 404 for missing games
- 422 for invalid request bodies
- Route operations require version_group_id on the game (need VersionGroup fixture via db_session)
- list_game_routes only returns routes with encounters (or parents of routes with encounters)
- Game detail (GET /{id}) returns all routes regardless
- Route create, update, delete, reorder
## Checklist
- [x] Test CRUD operations for games (create, list, get, update, delete)
- [x] Test route management within a game (create, list, update, delete, reorder)
- [x] Test error cases (404, 409 duplicate slug, 422 validation)
- [x] Test list_game_routes filtering behavior (empty routes excluded)
- [x] Test by-region endpoint structure