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

+83
View File
@@ -0,0 +1,83 @@
import { describe, it, expect } from "vitest";
import { isFinalReviewContinueBlocked } from "../../app/(app)/create/utils/createFlowFooterLabels";
import { communityInitialsFromTitle } from "../../lib/create/communityInitials";
import { finalReviewChipHasWarning } from "../../lib/create/finalReviewChipWarnings";
import type { CreateFlowState } from "../../app/(app)/create/types";
const completeCards: CreateFlowState = {
title: "Oak Park Commons",
selectedCommunicationMethodIds: ["signal"],
selectedMembershipMethodIds: ["open-admission"],
selectedDecisionApproachIds: ["lazy-consensus"],
selectedConflictManagementIds: ["conflict-ladder"],
};
describe("isFinalReviewContinueBlocked", () => {
it("blocks when the community name is empty", () => {
expect(
isFinalReviewContinueBlocked({
...completeCards,
title: " ",
}),
).toBe(true);
});
it("blocks when any of the four questions has no card", () => {
expect(
isFinalReviewContinueBlocked({
...completeCards,
selectedMembershipMethodIds: [],
}),
).toBe(true);
});
it("does not block when values are empty and the four questions have cards", () => {
expect(isFinalReviewContinueBlocked(completeCards)).toBe(false);
});
});
describe("finalReviewChipHasWarning", () => {
it("warns when a value is missing meaning or signals", () => {
expect(
finalReviewChipHasWarning(
{
coreValueDetailsByChipId: {
"1": { meaning: "Care", signals: "" },
},
},
"coreValues",
"1",
),
).toBe(true);
});
it("warns when a method card has no saved words", () => {
expect(
finalReviewChipHasWarning({}, "communication", "signal"),
).toBe(true);
});
it("does not warn when meaning and signals are both filled", () => {
expect(
finalReviewChipHasWarning(
{
coreValueDetailsByChipId: {
"1": { meaning: "Care", signals: "We talk over people." },
},
},
"coreValues",
"1",
),
).toBe(false);
});
});
describe("communityInitialsFromTitle", () => {
it("uses the first letters of the first two words", () => {
expect(communityInitialsFromTitle("Oak Park Commons")).toBe("OP");
});
it("uses two letters from a single word", () => {
expect(communityInitialsFromTitle("Neighbors")).toBe("NE");
});
});