mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 15:42:24 +00:00
chore: reconcile the catalogue and metric-unit guards
The widget catalogue grew to 42 ids, so the snapshot round-trip count follows. The mood card's unit key carries "/5" rather than an empty string — the locale-integrity guard forbids empty values, and the scale is the honest thing to print next to a 1-to-5 score. It joins the identical-across-locales allowlist alongside the other unit notations.
This commit is contained in:
1 parent
4c3cc84daf
commit
30954901ac
9 files changed
+10
-11
No files matched your search
+1
-1
@@ -440,7 +440,7 @@
|
|||||||
"totalBodyWater": "kg",
|
"totalBodyWater": "kg",
|
||||||
"boneMass": "kg",
|
"boneMass": "kg",
|
||||||
"oxygenSaturation": "%",
|
"oxygenSaturation": "%",
|
||||||
"mood": "",
|
"mood": "/5",
|
||||||
"bmi": "kg/m²"
|
"bmi": "kg/m²"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -440,7 +440,7 @@
|
|||||||
"totalBodyWater": "kg",
|
"totalBodyWater": "kg",
|
||||||
"boneMass": "kg",
|
"boneMass": "kg",
|
||||||
"oxygenSaturation": "%",
|
"oxygenSaturation": "%",
|
||||||
"mood": "",
|
"mood": "/5",
|
||||||
"bmi": "kg/m²"
|
"bmi": "kg/m²"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -440,7 +440,7 @@
|
|||||||
"totalBodyWater": "kg",
|
"totalBodyWater": "kg",
|
||||||
"boneMass": "kg",
|
"boneMass": "kg",
|
||||||
"oxygenSaturation": "%",
|
"oxygenSaturation": "%",
|
||||||
"mood": "",
|
"mood": "/5",
|
||||||
"bmi": "kg/m²"
|
"bmi": "kg/m²"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -440,7 +440,7 @@
|
|||||||
"totalBodyWater": "kg",
|
"totalBodyWater": "kg",
|
||||||
"boneMass": "kg",
|
"boneMass": "kg",
|
||||||
"oxygenSaturation": "%",
|
"oxygenSaturation": "%",
|
||||||
"mood": "",
|
"mood": "/5",
|
||||||
"bmi": "kg/m²"
|
"bmi": "kg/m²"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -440,7 +440,7 @@
|
|||||||
"totalBodyWater": "kg",
|
"totalBodyWater": "kg",
|
||||||
"boneMass": "kg",
|
"boneMass": "kg",
|
||||||
"oxygenSaturation": "%",
|
"oxygenSaturation": "%",
|
||||||
"mood": "",
|
"mood": "/5",
|
||||||
"bmi": "kg/m²"
|
"bmi": "kg/m²"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -440,7 +440,7 @@
|
|||||||
"totalBodyWater": "kg",
|
"totalBodyWater": "kg",
|
||||||
"boneMass": "kg",
|
"boneMass": "kg",
|
||||||
"oxygenSaturation": "%",
|
"oxygenSaturation": "%",
|
||||||
"mood": "",
|
"mood": "/5",
|
||||||
"bmi": "kg/m²"
|
"bmi": "kg/m²"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ const LEGIT_IDENTICAL = new Set<string>([
|
|||||||
"charts.vo2Max",
|
"charts.vo2Max",
|
||||||
"cycle.insights.crosstab.unitGlucose",
|
"cycle.insights.crosstab.unitGlucose",
|
||||||
"dashboard.metric.unit.bmi",
|
"dashboard.metric.unit.bmi",
|
||||||
|
"dashboard.metric.unit.mood",
|
||||||
"dashboard.metric.unit.glucose",
|
"dashboard.metric.unit.glucose",
|
||||||
"dashboard.vo2Max",
|
"dashboard.vo2Max",
|
||||||
"dashboard.vo2MaxShort",
|
"dashboard.vo2MaxShort",
|
||||||
|
|||||||
@@ -605,8 +605,6 @@ export const LAYOUT_FIELD_MERGE_DISPOSITION = {
|
|||||||
heroRingOrder: "preserve",
|
heroRingOrder: "preserve",
|
||||||
} as const satisfies Record<keyof DashboardLayout, "replace" | "preserve">;
|
} as const satisfies Record<keyof DashboardLayout, "replace" | "preserve">;
|
||||||
|
|
||||||
export type LayoutFieldMergeDisposition = typeof LAYOUT_FIELD_MERGE_DISPOSITION;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The top-level layout fields the widgets PUT carries forward from the stored
|
* The top-level layout fields the widgets PUT carries forward from the stored
|
||||||
* layout when the request omits them. Derived from
|
* layout when the request omits them. Derived from
|
||||||
|
|||||||
@@ -752,11 +752,11 @@ describe("buildDashboardSnapshot — layoutCatalogue (35-id round-trip)", () =>
|
|||||||
isFullyCovered.mockReturnValue(false);
|
isFullyCovered.mockReturnValue(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("emits all 38 catalogue ids with visibility + order", async () => {
|
it("emits all 42 catalogue ids with visibility + order", async () => {
|
||||||
const snap = await buildDashboardSnapshot(fakePrisma, baseUser());
|
const snap = await buildDashboardSnapshot(fakePrisma, baseUser());
|
||||||
expect(snap.layoutCatalogue).toHaveLength(38);
|
expect(snap.layoutCatalogue).toHaveLength(42);
|
||||||
const ids = new Set(snap.layoutCatalogue.map((w) => w.id));
|
const ids = new Set(snap.layoutCatalogue.map((w) => w.id));
|
||||||
expect(ids.size).toBe(38);
|
expect(ids.size).toBe(42);
|
||||||
// iOS-only ids appended default-invisible.
|
// iOS-only ids appended default-invisible.
|
||||||
const walkingSpeed = snap.layoutCatalogue.find(
|
const walkingSpeed = snap.layoutCatalogue.find(
|
||||||
(w) => w.id === "walkingSpeed",
|
(w) => w.id === "walkingSpeed",
|
||||||
|
|||||||
Reference in new issue
Block a user