Derive score-version fixtures from the SCORE_VERSION constant

Eight test and fixture files hardcoded scoreVersion: 2, a value the
constant has not held since v1.35.0. Now they import SCORE_VERSION and
use it, so a future bump cannot leave a fixture pinned to a stale
number.

The one genuinely historical case (record.test.ts, proving the input
fingerprint moves when the algorithm version moves) now derives both
its "previous" and "current" markers from SCORE_VERSION instead of two
unrelated literals, so the pair keeps its meaning after the next bump.
This commit is contained in:
Marc-André Bombeck committed 2026-08-02 00:15:29 +02:00
1 parent 7df25a6d92
commit af35346687
8 files changed
+35 -19

No files matched your search

@@ -6,6 +6,7 @@ import { I18nProvider } from "@/lib/i18n/context";
import { TodayHero } from "../today-hero";
import type { DailyDigest } from "@/lib/daily/digest";
import type { PriorityItem } from "@/lib/daily/priority-item";
import { SCORE_VERSION } from "@/lib/analytics/score/types";
// The hero now wires the coach check-in card's keep / let-go taps through
// `useCoachCheckinAction`, so it needs a QueryClient in the tree.
@@ -57,7 +58,7 @@ function digest(over: Partial<DailyDigest> = {}): DailyDigest {
band: "green",
delta: 3,
deltaReason: null,
scoreVersion: 2,
scoreVersion: SCORE_VERSION,
composition: ["BLOOD_PRESSURE", "ACTIVITY", "SLEEP"],
},
topSignal: {
@@ -114,7 +115,7 @@ describe("<TodayHero>", () => {
band: "green",
delta: 20,
deltaReason: "algorithm_changed",
scoreVersion: 2,
scoreVersion: SCORE_VERSION,
composition: ["BLOOD_PRESSURE", "ACTIVITY", "SLEEP"],
},
})}