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.
90 lines
3.2 KiB
TypeScript
90 lines
3.2 KiB
TypeScript
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,
|
|
);
|
|
});
|
|
});
|