Hold the press kit at /press in its embargoed form until the February launch.
This commit is contained in:
1 parent
8f92848e2b
commit
ead6c8f716
11 files changed
+182
-2
No files matched your search
@@ -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();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user