Rebuild the About page from the current marketing frames, and leave the unapproved sentences off the page.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
adilalloandCursor committed 2026-11-03 16:59:36 -07:00
1 parent 3dee3a587b
commit 2101676429
56 files changed
+1515 -238

No files matched your search

+119 -60
View File
@@ -2,88 +2,147 @@ import { afterEach, describe, expect, test } from "vitest";
import { within } from "@testing-library/react";
import {
cleanup,
fireEvent,
renderWithProviders as render,
screen,
} from "../utils/test-utils";
import AboutPage from "../../app/(marketing)/about/page";
import {
ASSETS,
getAssetPath,
governanceBookletPath,
structureBeforeCrisisPath,
} from "../../lib/assetUtils";
import messages from "../../messages/en/index";
import { testRouter } from "../mocks/navigation";
afterEach(() => {
cleanup();
testRouter.push.mockClear();
});
function bookSection(title: string) {
const heading = screen.getByRole("heading", { name: title });
const section = heading.closest("section");
expect(section).not.toBeNull();
return within(section as HTMLElement);
}
describe("AboutPage", () => {
test("pairs each book cover, heading, alt, and download with the same title", () => {
test("opens with the centered header and the new opening statement", () => {
render(<AboutPage />);
const page = messages.pages.about;
const structureBeforeCrisis = bookSection(page.structureBeforeCrisis.title);
expect(
structureBeforeCrisis.getByText(page.structureBeforeCrisis.description),
screen.getByRole("heading", {
level: 1,
name: "Every community has rules written or not",
}),
).toBeInTheDocument();
expect(
structureBeforeCrisis.getByRole("img", {
name: page.structureBeforeCrisis.imageAlt,
screen.getByText(
"From the Media Economies Design Lab at the University of Colorado Boulder",
),
).toBeInTheDocument();
expect(
screen.getByText("Our communities deserve better."),
).toBeInTheDocument();
expect(
screen.queryByRole("heading", {
name: /CommunityRule is a tool that helps groups/i,
}),
).toHaveAttribute(
"src",
getAssetPath(ASSETS.STRUCTURE_BEFORE_CRISIS_COVER),
).not.toBeInTheDocument();
});
test("tells the study story without the old stats, books, or FAQ", () => {
render(<AboutPage />);
expect(
screen.getByRole("heading", {
name: "The idea is old. Our first tries fell short",
}),
).toBeInTheDocument();
expect(screen.getByText("regula").tagName).toBe("EM");
expect(
screen.getByText(/far fewer stayed to write/),
).toBeInTheDocument();
expect(
screen.getByRole("heading", {
name: "We went looking for communities that had figured it out",
}),
).toBeInTheDocument();
const participant = screen
.getByRole("heading", {
name: "We went looking for communities that had figured it out",
})
.closest("section");
expect(participant).not.toBeNull();
expect(
within(participant as HTMLElement).getByText(
"Names appear only for pilot communities",
),
).toBeInTheDocument();
expect(
within(participant as HTMLElement).queryByText(/Colorado/),
).not.toBeInTheDocument();
expect(screen.getByText("How do you talk?")).toBeInTheDocument();
expect(screen.getByText("What happens when you disagree?")).toBeInTheDocument();
expect(screen.getByText("9 in 10")).toBeInTheDocument();
expect(screen.getByText("2 in 3")).toBeInTheDocument();
expect(screen.getByText("1 in 2")).toBeInTheDocument();
expect(
screen.getByText(
"From interviews with members of forty communities from April 2025 to February 2026.",
),
).toBeInTheDocument();
expect(
screen.getByRole("heading", {
name: "We rebuilt the tool around what organizers told us",
}),
).toBeInTheDocument();
expect(screen.queryByText("420M+")).not.toBeInTheDocument();
expect(
screen.queryByRole("heading", { name: "Get Structure Before Crisis" }),
).not.toBeInTheDocument();
expect(
screen.queryByRole("heading", { name: "Get the Community Rules Book" }),
).not.toBeInTheDocument();
expect(
screen.queryByRole("heading", { name: "Get answers to your questions" }),
).not.toBeInTheDocument();
});
test("keeps unapproved narrative sentences off the page and wires the approved actions", () => {
render(<AboutPage />);
expect(
screen.getByRole("heading", { name: "What organizers gave, we give back" }),
).toBeInTheDocument();
expect(screen.getByText(/GNU General Public License version 3/)).toBeInTheDocument();
expect(screen.getByText(/CC BY-SA 4.0/)).toBeInTheDocument();
expect(screen.queryByText(/CC0/)).not.toBeInTheDocument();
expect(screen.queryByText(/public domain/i)).not.toBeInTheDocument();
expect(screen.queryByText(/stays private unless you share/i)).not.toBeInTheDocument();
expect(screen.queryByText(/co-op lawyers/i)).not.toBeInTheDocument();
expect(screen.getByRole("link", { name: "Help build" })).toHaveAttribute(
"href",
"https://git.medlab.host",
);
expect(
structureBeforeCrisis.getByRole("link", {
name: page.structureBeforeCrisis.buttonText,
}),
).toHaveAttribute("href", getAssetPath(structureBeforeCrisisPath()));
screen.getByRole("link", { name: "Talk to a facilitator" }),
).toHaveAttribute("href", "/workshops");
expect(screen.getByRole("link", { name: "Read the FAQ" })).toHaveAttribute(
"href",
"/learn#faq",
);
const communityRules = bookSection(page.communityRules.title);
expect(
communityRules.getByText(page.communityRules.description),
).toBeInTheDocument();
expect(
communityRules.getByRole("img", {
name: page.communityRules.imageAlt,
}),
).toHaveAttribute("src", getAssetPath(ASSETS.COMMUNITY_RULES_COVER));
expect(
communityRules.getByRole("link", {
name: page.communityRules.buttonText,
}),
).toHaveAttribute("href", getAssetPath(governanceBookletPath()));
fireEvent.click(screen.getByRole("button", { name: "Create rule" }));
expect(testRouter.push).toHaveBeenCalledWith("/create/informational");
fireEvent.click(screen.getByRole("button", { name: "Share your experiences" }));
expect(screen.getByRole("dialog", { name: "Ask an organizer" })).toBeInTheDocument();
});
test("shows sourced About statistics with as-of years", () => {
test("names the people who made it", () => {
render(<AboutPage />);
const page = messages.pages.about;
expect(screen.getByText("420M+")).toBeInTheDocument();
expect(screen.getByText("24%")).toBeInTheDocument();
expect(screen.getByText("45%")).toBeInTheDocument();
expect(screen.getByText("800+")).toBeInTheDocument();
expect(screen.queryByText("8000+")).not.toBeInTheDocument();
expect(screen.queryByText("27%")).not.toBeInTheDocument();
for (const item of page.stats.items) {
expect(screen.getByText(item.label)).toBeInTheDocument();
if (item.sourceHref) {
expect(
screen.getAllByRole("link").some(
(link) => link.getAttribute("href") === item.sourceHref,
),
).toBe(true);
}
}
expect(
screen.getByRole("heading", { name: "Who made this" }),
).toBeInTheDocument();
expect(screen.getByText("Nathan Schneider")).toBeInTheDocument();
expect(screen.getByText("Dani Shipley")).toBeInTheDocument();
expect(screen.getByText("Andy DiLallo")).toBeInTheDocument();
expect(
screen.getByText(
"Media Economies Design Lab, University of Colorado Boulder",
),
).toBeInTheDocument();
});
});