Give /kit its own page so the printed facilitator-guide link still works after cutover.
This commit is contained in:
1 parent
711ef736df
commit
8f92848e2b
11 files changed
+177
-7
No files matched your search
@@ -0,0 +1,82 @@
|
||||
import { describe, expect, test, vi } from "vitest";
|
||||
import { screen } from "@testing-library/react";
|
||||
import { renderWithProviders as render } from "../utils/test-utils";
|
||||
import LegalDocumentPage from "../../app/(marketing)/_components/LegalDocumentPage";
|
||||
import { legalPathForSlug } from "../../lib/legalSyntheticPost";
|
||||
import messages from "../../messages/en/index";
|
||||
|
||||
vi.mock("../../lib/requestSiteOrigin", () => ({
|
||||
getRequestSiteOrigin: async () => "https://communityrule.info",
|
||||
}));
|
||||
|
||||
vi.mock("../../app/components/sections/ContentBanner", () => ({
|
||||
default: ({ post, variant, updatedLabel }) => (
|
||||
<section data-testid="content-banner" data-variant={variant}>
|
||||
<h1>{post.frontmatter.title}</h1>
|
||||
<p>{post.frontmatter.description}</p>
|
||||
{updatedLabel ? (
|
||||
<div>
|
||||
<span>{post.frontmatter.author}</span>
|
||||
<span>{updatedLabel}</span>
|
||||
</div>
|
||||
) : null}
|
||||
</section>
|
||||
),
|
||||
}));
|
||||
|
||||
async function renderKitPage() {
|
||||
const page = messages.pages.kit;
|
||||
const ui = await LegalDocumentPage({
|
||||
slug: "kit",
|
||||
path: legalPathForSlug("kit"),
|
||||
page,
|
||||
});
|
||||
return render(ui);
|
||||
}
|
||||
|
||||
describe("kit page", () => {
|
||||
test("covers the five meetings, the facilitator guide, and office hours", async () => {
|
||||
await renderKitPage();
|
||||
const page = messages.pages.kit;
|
||||
|
||||
expect(screen.getByTestId("content-banner")).toHaveAttribute(
|
||||
"data-variant",
|
||||
"guide",
|
||||
);
|
||||
expect(
|
||||
screen.getByRole("heading", { level: 1, name: page.banner.title }),
|
||||
).toBeInTheDocument();
|
||||
expect(screen.getByText(page.banner.description)).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByRole("heading", { level: 2, name: "What is in it" }),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByRole("heading", { level: 2, name: "How the five meetings run" }),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByRole("heading", { level: 2, name: "Office hours" }),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByRole("link", { name: "Download the facilitator guide" }),
|
||||
).toHaveAttribute(
|
||||
"href",
|
||||
"https://colorado-mutual-aid.notion.site/Workshop-facilitator-guide-40fb9b9e2d3b81b683c0ca15de007f2a",
|
||||
);
|
||||
expect(screen.getByRole("link", { name: "Open the board" })).toHaveAttribute(
|
||||
"href",
|
||||
"https://www.figma.com/board/gnQ55HnX7EtOV9nwlZcW1V?node-id=32-80",
|
||||
);
|
||||
expect(screen.getByRole("link", { name: "Create rule" })).toHaveAttribute(
|
||||
"href",
|
||||
"/create/informational",
|
||||
);
|
||||
expect(screen.getByRole("link", { name: "Ask an organizer" })).toHaveAttribute(
|
||||
"href",
|
||||
"/#ask-organizer",
|
||||
);
|
||||
expect(
|
||||
screen.getByRole("link", { name: "Talk to a facilitator" }),
|
||||
).toHaveAttribute("href", "/workshops#workshop-signup");
|
||||
expect(screen.getByText(/22 February 2027/)).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -9,6 +9,7 @@ describe("legalSyntheticPost", () => {
|
||||
expect(legalPathForSlug("privacy")).toBe("/privacy");
|
||||
expect(legalPathForSlug("terms")).toBe("/terms");
|
||||
expect(legalPathForSlug("cookies")).toBe("/cookies");
|
||||
expect(legalPathForSlug("kit")).toBe("/kit");
|
||||
});
|
||||
|
||||
it("builds a guide-shaped post from page messages", () => {
|
||||
|
||||
@@ -16,6 +16,7 @@ describe("buildPublicSitemap", () => {
|
||||
expect(urls).toContain(sitemapUrl("/blog"));
|
||||
expect(urls).not.toContain(sitemapUrl("/use-cases"));
|
||||
expect(urls).toContain(sitemapUrl("/how-it-works"));
|
||||
expect(urls).toContain(sitemapUrl("/kit"));
|
||||
expect(urls).toContain(sitemapUrl("/privacy"));
|
||||
expect(urls).toContain(sitemapUrl("/terms"));
|
||||
expect(urls).toContain(sitemapUrl("/cookies"));
|
||||
@@ -36,7 +37,6 @@ describe("buildPublicSitemap", () => {
|
||||
expect(urls.some((url) => url.includes("/create"))).toBe(false);
|
||||
expect(urls.some((url) => url.includes("/monitor"))).toBe(false);
|
||||
expect(urls.some((url) => url.includes("/rule-counts"))).toBe(false);
|
||||
expect(urls.some((url) => url.includes("/kit"))).toBe(false);
|
||||
expect(urls.some((url) => url.includes("/api/"))).toBe(false);
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user