Set up backend test infrastructure

Add pytest fixtures (engine, db_session, client) with session-scoped
event loop to avoid asyncpg loop mismatch errors. Smoke tests verify
all three main API endpoints return empty results on a clean DB.
Test DB provided by docker-compose.test.yml on port 5433.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-21 12:35:22 +01:00
parent 16f9e68821
commit b0ac3714a9
6 changed files with 782 additions and 19 deletions

View File

@@ -1,11 +1,11 @@
---
# nuzlocke-tracker-yzpb
title: Implement Unit & Integration Tests
status: draft
status: todo
type: epic
priority: high
created_at: 2026-02-10T09:32:47Z
updated_at: 2026-02-10T12:05:43Z
updated_at: 2026-02-21T11:29:02Z
---
Add comprehensive unit and integration test coverage to both the backend (FastAPI/Python) and frontend (React/TypeScript). The project currently has zero tests — pytest is configured in pyproject.toml with pytest-asyncio and httpx, but no actual test files exist. The frontend has no test tooling at all.
@@ -20,7 +20,7 @@ Add comprehensive unit and integration test coverage to both the backend (FastAP
## Success Criteria
- [ ] Backend test infrastructure is set up (conftest, fixtures, test DB)
- [x] Backend test infrastructure is set up (conftest, fixtures, test DB)
- [ ] Backend schemas and services have unit test coverage
- [ ] Backend API endpoints have integration test coverage
- [ ] Frontend test infrastructure is set up (Vitest, RTL)