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:
1 parent
cc878e3c19
commit
6e2e1915ae
30 files changed
+571
-218
No files matched your search
@@ -10,9 +10,21 @@ const NAMES = {
|
||||
conflict: "Conflict management",
|
||||
};
|
||||
|
||||
function rowsWith(
|
||||
chipsByName: Partial<Record<string, string[]>>,
|
||||
): { name: string; chips: string[] }[] {
|
||||
return [
|
||||
"Values",
|
||||
"Communication",
|
||||
"Membership",
|
||||
"Decision-making",
|
||||
"Conflict management",
|
||||
].map((name) => ({ name, chips: chipsByName[name] ?? [] }));
|
||||
}
|
||||
|
||||
describe("buildFinalReviewCategoriesFromState", () => {
|
||||
it("returns [] when state has no selections and no sections", () => {
|
||||
expect(buildFinalReviewCategoriesFromState({}, NAMES)).toEqual([]);
|
||||
it("returns five empty rows when state has no selections and no sections", () => {
|
||||
expect(buildFinalReviewCategoriesFromState({}, NAMES)).toEqual(rowsWith({}));
|
||||
});
|
||||
|
||||
it("resolves method ids to labels from message presets", () => {
|
||||
@@ -33,7 +45,7 @@ describe("buildFinalReviewCategoriesFromState", () => {
|
||||
expect(byName.get("Membership")).toEqual(["Open admission"]);
|
||||
expect(byName.get("Decision-making")).toEqual(["Lazy consensus"]);
|
||||
expect(byName.get("Conflict management")).toEqual(["Conflict ladder"]);
|
||||
expect(byName.has("Values")).toBe(false);
|
||||
expect(byName.get("Values")).toEqual([]);
|
||||
});
|
||||
|
||||
it("derives core values via buildCoreValuesForDocument (snapshot + selected ids)", () => {
|
||||
@@ -46,9 +58,9 @@ describe("buildFinalReviewCategoriesFromState", () => {
|
||||
],
|
||||
};
|
||||
const rows = buildFinalReviewCategoriesFromState(state, NAMES);
|
||||
expect(rows).toEqual([
|
||||
{ name: "Values", chips: ["Accessibility", "Resilience"] },
|
||||
]);
|
||||
expect(rows).toEqual(
|
||||
rowsWith({ Values: ["Accessibility", "Resilience"] }),
|
||||
);
|
||||
});
|
||||
|
||||
it("drops unknown ids silently instead of inserting empty labels", () => {
|
||||
@@ -56,7 +68,7 @@ describe("buildFinalReviewCategoriesFromState", () => {
|
||||
selectedCommunicationMethodIds: ["signal", "bogus-id"],
|
||||
};
|
||||
const rows = buildFinalReviewCategoriesFromState(state, NAMES);
|
||||
expect(rows).toEqual([{ name: "Communication", chips: ["Signal"] }]);
|
||||
expect(rows).toEqual(rowsWith({ Communication: ["Signal"] }));
|
||||
});
|
||||
|
||||
it("resolves user-authored method ids from customMethodCardMetaById", () => {
|
||||
@@ -77,7 +89,7 @@ describe("buildFinalReviewCategoriesFromState", () => {
|
||||
selectedCommunicationMethodIds: ["signal", "signal"],
|
||||
};
|
||||
const rows = buildFinalReviewCategoriesFromState(state, NAMES);
|
||||
expect(rows).toEqual([{ name: "Communication", chips: ["Signal"] }]);
|
||||
expect(rows).toEqual(rowsWith({ Communication: ["Signal"] }));
|
||||
});
|
||||
|
||||
it("uses section titles for method facets when selections were cleared (use-without-changes)", () => {
|
||||
@@ -98,10 +110,12 @@ describe("buildFinalReviewCategoriesFromState", () => {
|
||||
selectedCommunicationMethodIds: [],
|
||||
};
|
||||
const rows = buildFinalReviewCategoriesFromState(state, NAMES);
|
||||
expect(rows).toEqual([
|
||||
{ name: "Values", chips: ["Consciousness", "Ecology"] },
|
||||
{ name: "Communication", chips: ["Signal"] },
|
||||
]);
|
||||
expect(rows).toEqual(
|
||||
rowsWith({
|
||||
Values: ["Consciousness", "Ecology"],
|
||||
Communication: ["Signal"],
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("when sections exist but facet selections are set, matches publish pickMethodIds (state wins)", () => {
|
||||
@@ -115,9 +129,9 @@ describe("buildFinalReviewCategoriesFromState", () => {
|
||||
selectedCommunicationMethodIds: ["in-person-meetings"],
|
||||
};
|
||||
const rows = buildFinalReviewCategoriesFromState(state, NAMES);
|
||||
expect(rows).toEqual([
|
||||
{ name: "Communication", chips: ["In-person meetings"] },
|
||||
]);
|
||||
expect(rows).toEqual(
|
||||
rowsWith({ Communication: ["In-person meetings"] }),
|
||||
);
|
||||
});
|
||||
|
||||
it("shows custom communication chips when sections exist and selections include a UUID", () => {
|
||||
@@ -153,10 +167,12 @@ describe("buildFinalReviewCategoriesFromState", () => {
|
||||
],
|
||||
};
|
||||
const rows = buildFinalReviewCategoriesFromState(state, NAMES);
|
||||
expect(rows).toEqual([
|
||||
{ name: "Values", chips: ["Accessibility"] },
|
||||
{ name: "Communication", chips: ["Signal"] },
|
||||
]);
|
||||
expect(rows).toEqual(
|
||||
rowsWith({
|
||||
Values: ["Accessibility"],
|
||||
Communication: ["Signal"],
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("prefers the chip snapshot over a duplicated Values section in sections", () => {
|
||||
@@ -177,8 +193,6 @@ describe("buildFinalReviewCategoriesFromState", () => {
|
||||
],
|
||||
};
|
||||
const rows = buildFinalReviewCategoriesFromState(state, NAMES);
|
||||
expect(rows).toEqual([
|
||||
{ name: "Values", chips: ["Accessibility"] },
|
||||
]);
|
||||
expect(rows).toEqual(rowsWith({ Values: ["Accessibility"] }));
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user