test(medications): pin skipDuplicates flag on intake-route backfill

The W-SERVER-FIX-2 race-guard work added `skipDuplicates: true` to the
intake route's projection-backfill createMany alongside the schema
@@unique([userId, medicationId, scheduledFor, source]) constraint. The
existing unit test asserted the row shape but not the flag, so a
regression that drops `skipDuplicates: true` while keeping the unique
constraint would surface as a 5xx in prod (constraint violation
bubbles through) without breaking the suite.

Adds the flag to the `toMatchObject` assertion so the defense-in-depth
contract stays pinned next to the row shape it pairs with. Matches the
equivalent assertion the dashboard summary test already carries.
This commit is contained in:
Marc-André Bombeck committed 2026-05-21 11:23:17 +02:00
1 parent 3d08a0abef
commit db2c70a78d
1 file changed
+9
@@ -201,6 +201,15 @@ describe("GET /api/medications/intake", () => {
source: "REMINDER",
},
],
// v1.4.39 W-SERVER-FIX-2 — the createMany must ship
// `skipDuplicates: true` so a concurrent dashboard-summary hit
// can't race a duplicate `(userId, medicationId, scheduledFor,
// REMINDER)` row in between this route's existence probe and
// insert. The schema-level @@unique([userId, medicationId,
// scheduledFor, source]) is the structural backstop; this flag
// is the defense-in-depth that keeps the route returning 2xx
// when the constraint rejects the second mint.
skipDuplicates: true,
});
});