mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 13:01:00 +00:00
Adds 36 unit + contract tests across 7 files: * `import-apple-health-export.test.ts` — end-to-end parse of a tiny hand-authored fixture (spot weight, cumulative steps fold, sleep stage, workout with sport mapping, deferred + unknown identifiers, clinical record skip). Re-import idempotency: a second run reports 0 inserts + N updates. Memory ceiling: synthetic 10 000-record export keeps heap delta under 100 MB. * `hk-workout-activity-type-map.test.ts` — every value referenced in the map exists in the canonical `workoutSportTypeEnum` union; the iOS 18 canonical roster is covered; unknown identifiers fall through to `"other"` with a falsy `known` flag. * `unzip-export-xml.test.ts` — central-directory walker round-trips a hand-built single-entry deflate ZIP; extractor throws on a missing `export.xml` member. * `stream-to-disk.test.ts` — boundary parser; named-field capture + SHA-256 + text-field collection; size-cap enforcement; boundary- missing error path. * Route tests — auth gate (401), 403 on non-admin to the admin variant, 413 on content-length cap, 429 on rate-limit; status endpoint admits owner + triggering admin and 404s otherwise.