Keep every picked card on the finished Rule, and wait for its words before Continue.

This commit is contained in:
adilallo committed 2026-11-22 17:56:38 -07:00
1 parent a846169960
commit a2815ae05f
16 files changed
+417 -114

No files matched your search

+10 -18
View File
@@ -4,7 +4,6 @@ import {
parseDocumentSectionsForDisplay,
parseSectionsFromCreateFlowState,
} from "../../lib/create/buildPublishPayload";
import { mergeCoreValueDetailWithPresets } from "../../lib/create/finalReviewChipPresets";
import type { CreateFlowState } from "../../app/(app)/create/types";
describe("buildPublishPayload", () => {
@@ -144,15 +143,9 @@ describe("buildPublishPayload", () => {
});
expect(r.ok).toBe(true);
if (!r.ok) return;
const preset2 = mergeCoreValueDetailWithPresets("2", "Beta", undefined);
expect(r.document.coreValues).toEqual([
{ chipId: "1", label: "Alpha", meaning: "m1", signals: "s1" },
{
chipId: "2",
label: "Beta",
meaning: preset2.meaning,
signals: preset2.signals,
},
{ chipId: "2", label: "Beta", meaning: "", signals: "" },
]);
});
});
@@ -188,11 +181,12 @@ describe("buildPublishPayload — methodSelections", () => {
expect(ms?.communication?.length).toBe(1);
expect(ms?.communication?.[0]?.id).toBe("slack");
const first = ms?.communication?.[0];
expect(first?.sections.corePrinciple.length).toBeGreaterThan(10);
expect(first?.sections.corePrinciple).toBe("");
const entries =
(r.document.sections as Array<{ entries: Array<{ blocks?: unknown[] }> }>)[0]
?.entries;
expect(entries?.[0]?.blocks?.length).toBeGreaterThanOrEqual(1);
(r.document.sections as Array<{
entries: Array<{ title: string; body: string; blocks?: unknown[] }>;
}>)[0]?.entries;
expect(entries?.[0]).toEqual({ title: "Slack", body: "" });
});
it("uses customMethodCardMetaById label when preset id is unknown", () => {
@@ -251,7 +245,7 @@ describe("buildPublishPayload — methodSelections", () => {
]);
});
it("emits preset-only sections when a method is selected without an override", () => {
it("keeps blank card parts blank when a method is selected without an override", () => {
const r = buildPublishPayload({
title: "T",
selectedCommunicationMethodIds: ["signal"],
@@ -270,9 +264,7 @@ describe("buildPublishPayload — methodSelections", () => {
};
expect(entry.id).toBe("signal");
expect(entry.label).toBe("Signal");
// Preset corePrinciple is non-empty for `signal` in the shipped messages
// file — proves we read presets when no override is present.
expect(entry.sections.corePrinciple.length).toBeGreaterThan(0);
expect(entry.sections.corePrinciple).toBe("");
});
it("does not seed 75% consensus on a custom decision-making card", () => {
@@ -311,7 +303,7 @@ describe("buildPublishPayload — methodSelections", () => {
expect(ms.decisionApproaches?.[0]?.sections.consensusLevel).toBeUndefined();
});
it("keeps catalog decision consensus in methodSelections", () => {
it("does not fill catalog decision consensus when the card has no words", () => {
const r = buildPublishPayload({
title: "T",
selectedDecisionApproachIds: ["lazy-consensus"],
@@ -321,7 +313,7 @@ describe("buildPublishPayload — methodSelections", () => {
const ms = r.document.methodSelections as {
decisionApproaches?: Array<{ sections: { consensusLevel?: number } }>;
};
expect(ms.decisionApproaches?.[0]?.sections.consensusLevel).toBe(100);
expect(ms.decisionApproaches?.[0]?.sections.consensusLevel).toBeUndefined();
});
it("merges override on top of preset for the selected method", () => {