test(nutrients): pin that the batch still refuses the supplement-only codes

This commit is contained in:
Marc-André Bombeck committed 2026-10-15 23:52:50 +02:00
1 parent a2db048a4d
commit fe687b0870
1 file changed
+12
@@ -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);
});
});