From fe687b08709d9ccf63e8fbd202b49e84b2f02625 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Thu, 15 Oct 2026 23:52:50 +0200 Subject: [PATCH] test(nutrients): pin that the batch still refuses the supplement-only codes --- src/lib/nutrients/__tests__/catalog.test.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lib/nutrients/__tests__/catalog.test.ts b/src/lib/nutrients/__tests__/catalog.test.ts index 28b6d9bc4..37ba92b62 100644 --- a/src/lib/nutrients/__tests__/catalog.test.ts +++ b/src/lib/nutrients/__tests__/catalog.test.ts @@ -300,3 +300,15 @@ describe("upper intake levels (v1.43)", () => { ).toBeNull(); }); }); + +describe("the batch contract stays the syncable codes (v1.43)", () => { + it("refuses dha and epa in the HealthKit batch and accepts a syncable code", async () => { + const { nutrientBatchSchema } = await import("@/lib/validations/nutrients"); + const entry = (nutrient: string) => ({ + entries: [{ day: "2026-07-10", nutrient, unit: "mg", amount: 100 }], + }); + expect(nutrientBatchSchema.safeParse(entry("dha")).success).toBe(false); + expect(nutrientBatchSchema.safeParse(entry("epa")).success).toBe(false); + expect(nutrientBatchSchema.safeParse(entry("magnesium")).success).toBe(true); + }); +});