mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 23:52:24 +00:00
Merge branch 'release/v1.47.3' into release/v1.47.4
# Conflicts: # src/__tests__/baselines/source-file-lines.json # src/__tests__/baselines/source-function-lines.json # src/__tests__/baselines/test-as-never.json # src/__tests__/baselines/version-stamp-comments.json
This commit is contained in:
commit
031379d966
384 files changed
+7908
-5710
No files matched your search
@@ -314,7 +314,7 @@ describe("doctor-report — per-section toggles", () => {
|
||||
expect(data.labResults).toBeNull();
|
||||
expect(data.allergies).toBeNull();
|
||||
expect(data.familyHistory).toBeNull();
|
||||
expect(data.patient.username).toBeNull();
|
||||
expect(data.patient.name).toBeNull();
|
||||
expect(data.patient.insurerName).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -131,3 +131,49 @@ describe("event defaults: the matrix shows what delivery does", () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("events nothing sends", () => {
|
||||
it("are listed for nobody, and their stored rows are not served", async () => {
|
||||
const userId = await seedAccount(false);
|
||||
const prisma = getPrismaClient();
|
||||
const channel = await prisma.notificationChannel.findFirstOrThrow({
|
||||
where: { userId },
|
||||
});
|
||||
// Rows written while the four switches were still offered.
|
||||
await prisma.notificationPreference.createMany({
|
||||
data: [
|
||||
{ channelId: channel.id, eventType: "PERSONAL_RECORD", enabled: true },
|
||||
{
|
||||
channelId: channel.id,
|
||||
eventType: "MEASUREMENT_ANOMALY",
|
||||
enabled: false,
|
||||
},
|
||||
{
|
||||
channelId: channel.id,
|
||||
eventType: "MEDICATION_REMINDER",
|
||||
enabled: false,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
const { GET } = await import("@/app/api/notifications/preferences/route");
|
||||
const res = await GET();
|
||||
expect(res.status).toBe(200);
|
||||
const body = (await res.json()) as {
|
||||
data: {
|
||||
eventTypes: string[];
|
||||
preferences: { eventType: string; enabled: boolean }[];
|
||||
};
|
||||
};
|
||||
const { UNSENT_EVENT_TYPES } = await import("@/lib/notifications/types");
|
||||
for (const unsent of UNSENT_EVENT_TYPES) {
|
||||
expect(body.data.eventTypes).not.toContain(unsent);
|
||||
}
|
||||
expect(body.data.preferences).toEqual([
|
||||
expect.objectContaining({
|
||||
eventType: "MEDICATION_REMINDER",
|
||||
enabled: false,
|
||||
}),
|
||||
]);
|
||||
});
|
||||
});
|
||||
-1
@@ -14,7 +14,6 @@
|
||||
"action": null,
|
||||
"meta": null,
|
||||
"warnings": [
|
||||
"ai: a stored provider key could not be opened",
|
||||
"ai: a stored provider key could not be opened"
|
||||
],
|
||||
"error": null
|
||||
|
||||
@@ -18,6 +18,8 @@ process.env.ENCRYPTION_KEY ??=
|
||||
"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef";
|
||||
|
||||
import { POST as createVaccination } from "@/app/api/vaccinations/route";
|
||||
import { dateOnlyKey } from "@/lib/tz/date-only";
|
||||
import { startOfLocalDayKey } from "@/lib/tz/local-day";
|
||||
import { POST as mintBooster } from "@/app/api/vaccinations/[id]/booster/route";
|
||||
import { GET as listReminders } from "@/app/api/measurement-reminders/route";
|
||||
|
||||
@@ -221,7 +223,10 @@ describe("the whole activity-aware loop, through real routes", () => {
|
||||
const after = await prisma.measurementReminder.findUniqueOrThrow({
|
||||
where: { id: reminderId },
|
||||
});
|
||||
expect(after.lastSatisfiedAt?.toISOString()).toBe(occurredAt.toISOString());
|
||||
// The start of the dose's calendar day in the person's zone.
|
||||
expect(after.lastSatisfiedAt).toEqual(
|
||||
startOfLocalDayKey(dateOnlyKey(occurredAt), "Europe/Berlin"),
|
||||
);
|
||||
expect(after.nextDueAt!.getTime()).toBeGreaterThan(
|
||||
before.nextDueAt!.getTime(),
|
||||
);
|
||||
|
||||
@@ -24,6 +24,8 @@ process.env.ENCRYPTION_KEY ??=
|
||||
"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef";
|
||||
|
||||
import { POST as createVaccination } from "@/app/api/vaccinations/route";
|
||||
import { dateOnlyKey } from "@/lib/tz/date-only";
|
||||
import { startOfLocalDayKey } from "@/lib/tz/local-day";
|
||||
|
||||
import { cookieJar, headerJar } from "./mock-next-headers";
|
||||
import { getPrismaClient, truncateAllTables } from "./setup";
|
||||
@@ -132,7 +134,10 @@ describe("a dose satisfies the boosters it answers", () => {
|
||||
expect(res.status, JSON.stringify(await res.clone().json())).toBe(201);
|
||||
|
||||
const after = await reminderById(reminder.id);
|
||||
expect(after.lastSatisfiedAt?.toISOString()).toBe(occurredAt.toISOString());
|
||||
// The start of the dose's calendar day in the person's zone.
|
||||
expect(after.lastSatisfiedAt).toEqual(
|
||||
startOfLocalDayKey(dateOnlyKey(occurredAt), "Europe/Berlin"),
|
||||
);
|
||||
// Re-anchored from the satisfy instant, so the next one lands roughly ten
|
||||
// years out rather than staying on the date it was already overdue on.
|
||||
expect(after.nextDueAt).not.toBeNull();
|
||||
|
||||
Reference in new issue
Block a user