mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 13:01:00 +00:00
test: observe the reminder dedup anchor where it is written
The cross-midnight test read `push_attempts` for a synthetic `DEDUP` channel. Separating the scheduler's bookkeeping from delivery diagnostics moved the anchor to `notification_events`, and nothing has written that channel since. The query matched no rows, `findMany` answered the empty list, and the assertion compared an empty set it had no reason to expect — a check that could not fail whatever the tick did. It now reads `notification_events` by record and event type, and asserts the single row's `dedupKey`. Removing the claim from the tick fails the dispatch-count leg above it; narrowing the key so it no longer names the slot fails this leg on the key's own content, which is what makes it a check rather than a comment.
This commit is contained in:
1 parent
b2e225470b
commit
93a588cf6f
1 file changed
+11
-5
@@ -120,17 +120,23 @@ describe("medication reminder cross-midnight persistence", () => {
|
||||
}),
|
||||
);
|
||||
|
||||
const anchors = await prisma.pushAttempt.findMany({
|
||||
// The anchor is a record-scoped scheduler event, not a delivery attempt.
|
||||
// It used to be a `push_attempts` row on a synthetic `DEDUP` channel; the
|
||||
// separation moved it to `notification_events` and nothing writes that
|
||||
// channel any more, so a query for it matched no rows and passed on an
|
||||
// empty set whatever the tick did. Read the ledger the claim actually
|
||||
// appends to, and pin the count, so a second dispatch shows up as a
|
||||
// second row rather than as silence.
|
||||
const anchors = await prisma.notificationEvent.findMany({
|
||||
where: {
|
||||
userId: USER_ID,
|
||||
channel: "DEDUP",
|
||||
recordUserId: USER_ID,
|
||||
eventType: "MEDICATION_REMINDER",
|
||||
},
|
||||
select: { reason: true },
|
||||
select: { dedupKey: true },
|
||||
});
|
||||
expect(anchors).toEqual([
|
||||
{
|
||||
reason: expect.stringContaining("23:45:YELLOW:2026-07-28"),
|
||||
dedupKey: expect.stringContaining("23:45:YELLOW:2026-07-28"),
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user