2026-02-10 10:34:45 +01:00
|
|
|
---
|
|
|
|
|
# nuzlocke-tracker-0arz
|
|
|
|
|
title: Integration tests for Runs & Encounters API
|
2026-02-21 12:58:28 +01:00
|
|
|
status: completed
|
2026-02-10 10:34:45 +01:00
|
|
|
type: task
|
2026-02-21 12:58:28 +01:00
|
|
|
priority: normal
|
2026-02-10 10:34:45 +01:00
|
|
|
created_at: 2026-02-10T09:33:21Z
|
2026-02-21 12:58:28 +01:00
|
|
|
updated_at: 2026-02-21T11:54:42Z
|
2026-02-10 10:34:45 +01:00
|
|
|
parent: nuzlocke-tracker-yzpb
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
Write integration tests for the core run tracking and encounter API endpoints. This is the heart of the application.
|
|
|
|
|
|
|
|
|
|
## Checklist
|
|
|
|
|
|
2026-02-21 12:58:28 +01:00
|
|
|
- [x] Test run CRUD operations (create, list, get, update, delete)
|
|
|
|
|
- [x] Test run creation with rules configuration (JSONB field)
|
|
|
|
|
- [x] Test encounter logging on a run (create encounter on a route)
|
|
|
|
|
- [x] Test encounter status changes (alive → dead, faintLevel, deathCause)
|
|
|
|
|
- [x] Test route-lock enforcement (duplicate sibling encounter → 409)
|
|
|
|
|
- [x] Test shiny encounter handling (shinyClause bypasses route-lock)
|
|
|
|
|
- [x] Test gift clause bypass (giftClause=true, origin=gift bypasses route-lock)
|
|
|
|
|
- [x] Test ending a run (completion/failure, completed_at set, 400 on double-end)
|
|
|
|
|
- [x] Test error cases (404 for invalid run/route/pokemon, 400 for parent route, 422 for missing fields)
|
2026-02-10 10:34:45 +01:00
|
|
|
|
|
|
|
|
## Notes
|
|
|
|
|
|
|
|
|
|
- Run endpoints: `backend/src/app/api/runs.py`
|
|
|
|
|
- Encounter endpoints: `backend/src/app/api/encounters.py`
|
|
|
|
|
- This is the most critical area — Nuzlocke rules enforcement should be thoroughly tested
|
|
|
|
|
- Tests need game + pokemon + route fixtures as prerequisites
|