Show the whole Rule on one review card, with quiet flags for missing cards and Continue once each question has one.

This commit is contained in:
adilallo committed 2026-11-06 08:36:34 -07:00
1 parent cc878e3c19
commit 6e2e1915ae
30 files changed
+571 -218

No files matched your search

+19 -22
View File
@@ -16,9 +16,9 @@ import {
} from "../../app/(app)/create/utils/flowSteps";
describe("flowSteps", () => {
it("places confirm-stakeholders immediately before final-review", () => {
const i = FLOW_STEP_ORDER.indexOf("confirm-stakeholders");
const j = FLOW_STEP_ORDER.indexOf("final-review");
it("places final-review immediately before confirm-stakeholders", () => {
const i = FLOW_STEP_ORDER.indexOf("final-review");
const j = FLOW_STEP_ORDER.indexOf("confirm-stakeholders");
expect(i).toBeGreaterThanOrEqual(0);
expect(j).toBe(i + 1);
});
@@ -27,8 +27,8 @@ describe("flowSteps", () => {
expect(getNextStep("communication-methods")).toBe("membership-methods");
expect(getNextStep("membership-methods")).toBe("decision-approaches");
expect(getNextStep("decision-approaches")).toBe("conflict-management");
expect(getNextStep("conflict-management")).toBe("confirm-stakeholders");
expect(getNextStep("confirm-stakeholders")).toBe("final-review");
expect(getNextStep("conflict-management")).toBe("final-review");
expect(getNextStep("final-review")).toBe("confirm-stakeholders");
});
it("getNextStep returns null for last step or invalid", () => {
@@ -39,7 +39,8 @@ describe("flowSteps", () => {
});
it("getPreviousStep returns prior step or null", () => {
expect(getPreviousStep("final-review")).toBe("confirm-stakeholders");
expect(getPreviousStep("final-review")).toBe("conflict-management");
expect(getPreviousStep("confirm-stakeholders")).toBe("final-review");
expect(getPreviousStep("informational")).toBeNull();
expect(getPreviousStep(null)).toBeNull();
});
@@ -91,19 +92,17 @@ describe("flowSteps", () => {
expect(getPreviousStep("communication-methods", opts)).toBe("core-values");
});
it("useWithoutChangesIdentityOnly walks name → description → photo → stakeholders", () => {
it("useWithoutChangesIdentityOnly walks name → description → photo → final-review", () => {
const opts = { useWithoutChangesIdentityOnly: true } as const;
expect(getNextStep("community-name", opts)).toBe("community-context");
expect(getNextStep("community-context", opts)).toBe("community-upload");
expect(getNextStep("community-size", opts)).toBe("community-upload");
expect(getNextStep("setup-questions", opts)).toBe("community-upload");
expect(getNextStep("community-upload", opts)).toBe("confirm-stakeholders");
expect(getNextStep("confirm-stakeholders", opts)).toBe("final-review");
expect(getNextStep("community-upload", opts)).toBe("final-review");
expect(getNextStep("final-review", opts)).toBe("confirm-stakeholders");
expect(getPreviousStep("community-context", opts)).toBe("community-name");
expect(getPreviousStep("community-upload", opts)).toBe("community-context");
expect(getPreviousStep("confirm-stakeholders", opts)).toBe(
"community-upload",
);
expect(getPreviousStep("final-review", opts)).toBe("community-upload");
expect(getPreviousStep("community-name", opts)).toBeNull();
});
@@ -112,16 +111,14 @@ describe("flowSteps", () => {
skipCommunitySave: true,
useWithoutChangesIdentityOnly: true,
} as const;
expect(getNextStep("community-upload", opts)).toBe("confirm-stakeholders");
expect(getPreviousStep("confirm-stakeholders", opts)).toBe(
"community-upload",
);
expect(getNextStep("community-upload", opts)).toBe("final-review");
expect(getPreviousStep("final-review", opts)).toBe("community-upload");
});
it("resolveCreateFlowBackTarget returns template review when use-without slug is set on confirm-stakeholders", () => {
it("resolveCreateFlowBackTarget returns template review when use-without slug is set on final-review", () => {
expect(
resolveCreateFlowBackTarget(
"confirm-stakeholders",
"final-review",
undefined,
"mutual-aid-mondays",
),
@@ -138,10 +135,10 @@ describe("flowSteps", () => {
).toEqual({ kind: "templateReview", slug: "mutual-aid-mondays" });
});
it("resolveCreateFlowBackTarget uses photo step behind stakeholders on the identity-only path", () => {
it("resolveCreateFlowBackTarget uses photo step behind final-review on the identity-only path", () => {
expect(
resolveCreateFlowBackTarget(
"confirm-stakeholders",
"final-review",
{ useWithoutChangesIdentityOnly: true },
"mutual-aid-mondays",
),
@@ -151,13 +148,13 @@ describe("flowSteps", () => {
it("resolveCreateFlowBackTarget falls back to linear previous when slug is absent", () => {
expect(
resolveCreateFlowBackTarget("confirm-stakeholders", undefined, undefined),
).toEqual({ kind: "step", step: "conflict-management" });
).toEqual({ kind: "step", step: "final-review" });
});
it("resolveCreateFlowBackTarget ignores whitespace-only slug", () => {
expect(
resolveCreateFlowBackTarget("confirm-stakeholders", undefined, " "),
).toEqual({ kind: "step", step: "conflict-management" });
).toEqual({ kind: "step", step: "final-review" });
});
it("buildTemplateReviewHref encodes slug and optional fromFlow query", () => {