Add unit tests for Pydantic schemas

46 tests across 12 schema classes covering CamelModel alias generation,
required field validation, optional field defaults, camelCase input/output,
nested model coercion, and from_attributes support.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-21 12:41:22 +01:00
parent b0ac3714a9
commit 4aae12cd72
2 changed files with 317 additions and 10 deletions

View File

@@ -1,10 +1,11 @@
---
# nuzlocke-tracker-hjkk
title: Unit tests for Pydantic schemas and model validation
status: draft
status: completed
type: task
priority: normal
created_at: 2026-02-10T09:33:03Z
updated_at: 2026-02-10T09:33:03Z
updated_at: 2026-02-21T11:39:58Z
parent: nuzlocke-tracker-yzpb
---
@@ -12,14 +13,14 @@ Write unit tests for the Pydantic schemas in `backend/src/app/schemas/`. These a
## Checklist
- [ ] Test `CamelModel` base class (snake_case → camelCase alias generation)
- [ ] Test run schemas — creation validation, required fields, optional fields, serialization
- [ ] Test game schemas — validation rules, field constraints
- [ ] Test encounter schemas — status enum validation, field dependencies
- [ ] Test boss schemas — nested model validation
- [ ] Test genlocke schemas — complex nested structures
- [ ] Test stats schemas — response model structure
- [ ] Test evolution schemas — validation of evolution chain data
- [x] Test `CamelModel` base class (snake_case → camelCase alias generation)
- [x] Test run schemas — creation validation, required fields, optional fields, serialization
- [x] Test game schemas — validation rules, field constraints
- [x] Test encounter schemas — status enum validation, field dependencies
- [x] Test boss schemas — nested model validation
- [x] Test genlocke schemas — complex nested structures
- [x] Test evolution schemas — validation of evolution chain data
- [x] Test Pokemon create schema (types list, required fields)
## Notes