Replace the old team draft Rule with the adopted CommunityRule Creative Team Rule.

Staging still listed the September draft under the old project name. Seed now
upserts the adopted title, summary, and remade-deck cards, and a data migration
renames the existing row so the public catalog picks it up on deploy.
This commit is contained in:
adilallo committed 2026-11-12 15:40:40 -07:00
1 parent 6b4dda0e19
commit 29a8d2b32b
6 files changed
+397

No files matched your search

+89
View File
@@ -0,0 +1,89 @@
import { describe, expect, it } from "vitest";
import { parsePublishedDocumentForCommunityRuleDisplay } from "../../lib/create/publishedDocumentToDisplaySections";
import {
TEAM_RULE_DRAFT_TITLE,
TEAM_RULE_TITLE,
buildAdoptedTeamRule,
} from "../../lib/create/teamRule";
import heroBanner from "../../messages/en/components/heroBanner.json";
function chipTitles(categoryName: string): string[] {
const rule = buildAdoptedTeamRule();
const sections = parsePublishedDocumentForCommunityRuleDisplay(rule.document);
const section = sections.find((row) => row.categoryName === categoryName);
return (section?.entries ?? []).map((entry) => entry.title);
}
describe("adopted team Rule", () => {
it("uses the adopted title and Home hero summary", () => {
const rule = buildAdoptedTeamRule();
expect(rule.title).toBe(TEAM_RULE_TITLE);
expect(rule.title).toBe(heroBanner.ruleCard.title);
expect(rule.summary).toBe(heroBanner.ruleCard.description);
});
it("contains none of the old draft's title or summary", () => {
const serialized = JSON.stringify(buildAdoptedTeamRule());
expect(serialized).not.toContain(TEAM_RULE_DRAFT_TITLE);
expect(serialized).not.toContain(
"a free toolkit for writing down how communities make decisions",
);
expect(serialized).not.toContain("Skill-Based Contribution");
expect(serialized).not.toContain("Conflict Resolution Council");
});
it("publishes the remade-deck cards the Home hero shows", () => {
const rule = buildAdoptedTeamRule();
const values = rule.document.coreValues as Array<{ chipId: string }>;
expect(values.map((row) => row.chipId)).toEqual([
"transparency",
"forkability",
"documentation",
"maintenance",
"voluntarism",
]);
const methods = rule.document.methodSelections as {
communication: Array<{ id: string }>;
membership: Array<{ id: string }>;
decisionApproaches: Array<{ id: string }>;
conflictManagement: Array<{ id: string }>;
};
expect(methods.communication.map((row) => row.id)).toEqual([
"github-gitlab",
"matrix-element",
"email-distribution-list",
"how-we-run-meetings",
]);
expect(methods.membership.map((row) => row.id)).toEqual([
"join-by-contributing",
"companions",
]);
expect(methods.decisionApproaches.map((row) => row.id)).toEqual([
"consensus-decision-making",
"lazy-consensus",
"do-ocracy",
"changing-this-rule",
]);
expect(methods.conflictManagement.map((row) => row.id)).toEqual([
"conflict-ladder",
"hearing-panel",
"restorative-practices",
]);
});
it("displays the Home hero chip labels, using the deck name for Consensus", () => {
const groups = heroBanner.ruleCard.categories;
expect(chipTitles("Values")).toEqual(groups.values.chips);
expect(chipTitles("Communication")).toEqual(groups.communication.chips);
expect(chipTitles("Membership")).toEqual(groups.membership.chips);
expect(chipTitles("Decision-making")).toEqual(
groups.decisionMaking.chips.map((label) =>
label === "Consensus" ? "Consensus decision-making" : label,
),
);
expect(chipTitles("Conflict management")).toEqual(
groups.conflictManagement.chips,
);
});
});