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();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user