Fix save progress bug

This commit is contained in:
adilallo
2026-05-20 19:58:32 -06:00
parent 2f2b5d0dc2
commit 7ee6282c1a
14 changed files with 193 additions and 88 deletions
+11 -2
View File
@@ -104,7 +104,11 @@ describe("LoginForm", () => {
screen.getByRole("button", { name: /send me a magic link/i }),
);
await waitFor(() => {
expect(requestMagicLink).toHaveBeenCalledWith("pat@example.com", "/");
expect(requestMagicLink).toHaveBeenCalledWith(
"pat@example.com",
"/",
undefined,
);
});
expect(
await screen.findByRole("heading", { name: /check your email/i }),
@@ -134,6 +138,7 @@ describe("LoginForm", () => {
expect(requestMagicLink).toHaveBeenCalledWith(
"save@example.com",
"/create/community-structure?syncDraft=1",
undefined,
);
});
expect(setTransferPendingFlag).toHaveBeenCalled();
@@ -152,7 +157,11 @@ describe("LoginForm", () => {
screen.getByRole("button", { name: /send me a magic link/i }),
);
await waitFor(() => {
expect(requestMagicLink).toHaveBeenCalledWith("a@b.co", "/learn");
expect(requestMagicLink).toHaveBeenCalledWith(
"a@b.co",
"/learn",
undefined,
);
});
});
@@ -0,0 +1,22 @@
import { describe, expect, it } from "vitest";
import { buildCreateFlowDraftPayload } from "../../lib/create/buildCreateFlowDraftPayload";
describe("buildCreateFlowDraftPayload", () => {
it("merges state with currentStep when provided", () => {
expect(
buildCreateFlowDraftPayload(
{ title: "Oak Street Collective" },
"community-save",
),
).toEqual({
title: "Oak Street Collective",
currentStep: "community-save",
});
});
it("returns state unchanged when currentStep is omitted", () => {
expect(
buildCreateFlowDraftPayload({ title: "Oak Street Collective" }),
).toEqual({ title: "Oak Street Collective" });
});
});