mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-15 03:41:10 +02:00
11 vitest cases covering the load-bearing parts of bodyStore that
would otherwise rot silently because they only fire on edge paths
(re-tap, phase switch, double-start). Same harness as
nutriphi/mutations.test.ts: fake-indexeddb + a MemoryKeyProvider
seeded with a fresh master key, plus mocks for the browser-only
globals the Dexie hooks reach for (funnel-tracking, triggers,
inline-suggest).
Coverage:
Encryption (registry round-trip)
- Exercise: name + notes wrapped, muscleGroup + equipment +
isPreset stay plaintext for the index/picker layer
- Set: weight + reps wrapped (numeric values get JSON-stringified
before encryption), workoutId + exerciseId + order + isWarmup
stay plaintext
upsertCheck idempotency
- Re-tapping the same date updates the existing row instead of
creating a second one (the bug this guards against would have
filled bodyChecks with one row per dot-tap on a slow day)
- Partial updates preserve prior fields when callers pass
undefined for the others
- Different dates get different rows
startPhase auto-close
- Opening a second phase closes the previous one's endDate
(so the "active phase" view always sees ≤ 1 open row)
- endPhase stamps endDate without soft-deleting the row
startWorkout single-active guard
- Returns the existing open workout instead of starting a
second one (would have silently double-tracked sets)
- After finishWorkout, a fresh start works again
logSet ordering
- Assigns sequential order indices within a workout
deleteWorkout cascade
- Soft-deletes the workout AND all its sets in one go
All 11 pass against the v2 schema (bodyExercises / bodyWorkouts /
bodySets / bodyChecks / bodyPhases) plus the registry encryption
allowlist landed in the previous body commits.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| api | ||
| calc/packages/shared | ||
| calendar | ||
| cards | ||
| chat | ||
| citycorners | ||
| contacts | ||
| context | ||
| docs | ||
| guides | ||
| inventory | ||
| mana | ||
| manavoxel | ||
| memoro | ||
| moodlit | ||
| mukke | ||
| news | ||
| nutriphi | ||
| photos | ||
| picture | ||
| planta | ||
| presi | ||
| questions | ||
| skilltree | ||
| storage | ||
| times | ||
| todo | ||
| traces | ||
| uload | ||
| zitare/packages/content | ||