From f5df6111a17ec3e1615c5317ed7ae6ca946612da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Thu, 10 Sep 2026 12:20:50 +0200 Subject: [PATCH] test(onboarding): put the setup flow's cases through the finished questionnaire Two cases in the integration file answered one or two questions and posted the confirm, which the gate now refuses; they answer or pass all six. The audit assertion reads the details column as the JSON string it is. --- tests/integration/onboarding-needs.test.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/integration/onboarding-needs.test.ts b/tests/integration/onboarding-needs.test.ts index 35c6f37e9..68b1b1280 100644 --- a/tests/integration/onboarding-needs.test.ts +++ b/tests/integration/onboarding-needs.test.ts @@ -333,9 +333,12 @@ describe("POST /api/onboarding/complete", () => { where: { userId: user.id, action: "user.modules.update" }, }); expect(audit).toHaveLength(1); - expect( - (audit[0].details as { changed?: string[] } | null)?.changed, - ).toContain("medications"); + const details = JSON.parse(audit[0].details ?? "{}") as { + changed?: string[]; + source?: string; + }; + expect(details.changed).toContain("medications"); + expect(details.source).toBe("onboarding"); // Somebody changes their mind in Settings, then the confirm screen is // replayed. The second call must leave that decision alone: the latch is @@ -410,6 +413,10 @@ describe("POST /api/onboarding/complete", () => { await signIn(user.id); await patchAnswer({ step: "who", recordTarget: "me" }); await patchAnswer({ step: "areas", areas: ["cycle"] }); + await patchAnswer({ step: "medication", status: "skipped" }); + await patchAnswer({ step: "sources", status: "skipped" }); + await patchAnswer({ step: "visit", status: "skipped" }); + await patchAnswer({ step: "units", status: "skipped" }); await postComplete(); const profile = await getPrismaClient().cycleProfile.findUniqueOrThrow({