Pin selected after edit

This commit is contained in:
adilallo
2026-04-29 19:39:08 -06:00
parent a4f0c4bf27
commit 7fde82a94c
6 changed files with 147 additions and 65 deletions
@@ -0,0 +1,32 @@
import { describe, expect, it } from "vitest";
import { stripCustomRuleSelectionFields } from "../../lib/create/stripCustomRuleSelectionFields";
import type { CreateFlowState } from "../../app/(app)/create/types";
describe("stripCustomRuleSelectionFields", () => {
it("removes custom-rule selection facets and preserves community + template sections", () => {
const prev: CreateFlowState = {
title: "Garden",
communityContext: "...",
selectedCoreValueIds: ["1"],
coreValuesChipsSnapshot: [{ id: "1", label: "X", state: "selected" }],
selectedCommunicationMethodIds: ["signal"],
selectedMembershipMethodIds: ["x"],
selectedDecisionApproachIds: ["y"],
selectedConflictManagementIds: ["z"],
methodSectionsPinCommitted: { communication: true },
coreValueDetailsByChipId: { "1": { meaning: "", signals: "" } },
sections: [{ categoryName: "Communication", entries: [] }],
};
const out = stripCustomRuleSelectionFields(prev);
expect(out.title).toBe("Garden");
expect(out.sections).toEqual(prev.sections);
expect(out.selectedCoreValueIds).toBeUndefined();
expect(out.coreValuesChipsSnapshot).toBeUndefined();
expect(out.selectedCommunicationMethodIds).toBeUndefined();
expect(out.selectedMembershipMethodIds).toBeUndefined();
expect(out.selectedDecisionApproachIds).toBeUndefined();
expect(out.selectedConflictManagementIds).toBeUndefined();
expect(out.methodSectionsPinCommitted).toBeUndefined();
expect(out.coreValueDetailsByChipId).toBeUndefined();
});
});