James
|
155d24ec2e
|
Add comprehensive test suite: labs, entries, dossiers, readings
Test coverage:
- lib/lib_test.go (36 test functions):
- Crypto: Pack/Unpack, CryptoEncrypt/Decrypt, deterministic encryption
- Tokens: Create, Parse, expiration handling, invalid token handling
- Lab references: LabScale conversions, MakeRefID, LabRefLookup with sex/age matching
- Categories: FromString, CategoryName, CategoryKey, Categories() list
- IDs: NewID uniqueness, FormatID/ParseID roundtrip
- Entry CRUD: Write, Read, Delete, filter by type, filter by date range
- Trackers: Add, Query, Respond, Dismiss
- RBAC: CheckAccess for own dossier, system user, granted access, no access
- Dossier helpers: DossierFromEntry, SexKey
- Normalize: normalizeKey test name cleaning
- JSON marshaling: Tracker data, DossierPreferences
- api/api_test.go (23 test functions):
- Helper functions: intPtr, getString, seriesPriority
- v2 helpers: deterministicID, metricLabel
- Version endpoint
- Error/JSON responses
- Request/Response JSON marshaling: Entry, Dossier, Tracker, Parse, Readings
- Method handling: token endpoint
- Categories endpoint
- isLocalhost detection
- Schedule calculation
All tests use in-memory SQLite for isolation.
No external dependencies required.
|
2026-02-28 07:20:44 -05:00 |