test: compare the target cards without the route's direction verdict, and stop pinning the full feature set

This commit is contained in:
Marc-André Bombeck committed 2026-10-16 01:26:15 +02:00
1 parent 3aa2a6fd26
commit 0ba2e36b79
2 files changed
+21 -4

No files matched your search

+16 -3
View File
@@ -242,7 +242,14 @@ describe("targets fold equals the raw-reading fold", () => {
);
expect(glucose.length).toBe(expectedGlucose.length);
for (let i = 0; i < glucose.length; i++) {
const { average30, ...rest } = glucose[i];
// The direction verdict is resolved by the route on top of the card
// (v1.43); the fold under comparison does not produce it.
const {
average30,
direction: _direction,
trendSentiment: _trendSentiment,
...rest
} = glucose[i];
const { average30: expAvg, ...expRest } = expectedGlucose[i];
expect(rest).toEqual(expRest);
if (expAvg === null) expect(average30).toBeNull();
@@ -275,8 +282,14 @@ describe("targets fold equals the raw-reading fold", () => {
now,
weightTargetOverride: null,
}).targets.find((t) => t.type === "PULSE");
const pulse = res.targets.find((t) => t.type === "PULSE");
expect(pulse?.current).not.toBeNull();
const pulseTarget = res.targets.find((t) => t.type === "PULSE");
expect(pulseTarget?.current).not.toBeNull();
expect(pulseTarget?.direction).toBeDefined();
const {
direction: _direction,
trendSentiment: _trendSentiment,
...pulse
} = pulseTarget!;
expect(pulse).toEqual(expectedPulse);
});
}
+5 -1
View File
@@ -213,7 +213,11 @@ describe("per-user timezone — Pacific/Auckland end-to-end", () => {
data: { glucoseUnit: string | null; features: Record<string, unknown> };
};
expect(body.data.glucoseUnit).toBe("mmol/L");
expect(body.data.features).toEqual({ trackIntake: true });
// The flag set grows with each release; every flag is a plain boolean.
expect(body.data.features).toMatchObject({ trackIntake: true });
expect(
Object.values(body.data.features).every((v) => typeof v === "boolean"),
).toBe(true);
await prisma.user.update({
where: { id: user.id },