Hold the press kit at /press in its embargoed form until the February launch.

This commit is contained in:
adilallo committed 2026-11-20 13:21:44 -07:00
1 parent 8f92848e2b
commit ead6c8f716
11 files changed
+182 -2

No files matched your search

+70
View File
@@ -0,0 +1,70 @@
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 renderPressPage() {
const page = messages.pages.press;
const ui = await LegalDocumentPage({
slug: "press",
path: legalPathForSlug("press"),
page,
});
return render(ui);
}
describe("press page", () => {
test("holds embargoed press materials, a contact, and the story", async () => {
await renderPressPage();
const page = messages.pages.press;
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.getByText(/when the embargo lifts/),
).toBeInTheDocument();
expect(
screen.getByRole("heading", { level: 2, name: "Contact" }),
).toBeInTheDocument();
expect(
screen.getByRole("heading", { level: 2, name: "The story" }),
).toBeInTheDocument();
expect(
screen.getByRole("heading", { level: 2, name: "Does CommunityRule use AI?" }),
).toBeInTheDocument();
expect(
screen.getAllByRole("link", { name: "medlab@colorado.edu" })[0],
).toHaveAttribute("href", "mailto:medlab@colorado.edu");
expect(
screen.getByRole("link", { name: "Email the press contact" }),
).toHaveAttribute("href", "mailto:medlab@colorado.edu");
expect(screen.getByText(/CC BY-SA 4.0/)).toBeInTheDocument();
});
});
+1
View File
@@ -10,6 +10,7 @@ describe("legalSyntheticPost", () => {
expect(legalPathForSlug("terms")).toBe("/terms");
expect(legalPathForSlug("cookies")).toBe("/cookies");
expect(legalPathForSlug("kit")).toBe("/kit");
expect(legalPathForSlug("press")).toBe("/press");
});
it("builds a guide-shaped post from page messages", () => {
+1
View File
@@ -17,6 +17,7 @@ describe("buildPublicSitemap", () => {
expect(urls).not.toContain(sitemapUrl("/use-cases"));
expect(urls).toContain(sitemapUrl("/how-it-works"));
expect(urls).toContain(sitemapUrl("/kit"));
expect(urls).toContain(sitemapUrl("/press"));
expect(urls).toContain(sitemapUrl("/privacy"));
expect(urls).toContain(sitemapUrl("/terms"));
expect(urls).toContain(sitemapUrl("/cookies"));