import "@testing-library/jest-dom/vitest"; import { describe, expect, it } from "vitest"; import { renderWithProviders as render, screen } from "../utils/test-utils"; import WorkshopHero from "../../app/components/sections/WorkshopHero"; import WorkshopOverview from "../../app/components/sections/WorkshopOverview"; import WorkshopSignup from "../../app/components/sections/WorkshopSignup"; import messages from "../../messages/en/index"; describe("Workshops page sections", () => { it("points every talk-to-a-facilitator button at the form", () => { render( <> , ); const links = screen.getAllByRole("link", { name: "Talk to a facilitator" }); expect(links.length).toBeGreaterThanOrEqual(2); for (const link of links) { expect(link).toHaveAttribute("href", "#workshop-signup"); } }); it("shows the full field set, one optional marker, and the settled challenge line", () => { render(); expect(screen.getByText("How many members?")).toBeInTheDocument(); expect(screen.getByText("Members, member-owners or policyholders")).toBeInTheDocument(); expect(screen.getByText("Your role")).toBeInTheDocument(); expect(screen.getByRole("option", { name: "Select role..." })).toBeInTheDocument(); expect( screen.getByText("A big change ahead, like a merger, a bylaw change or a new leader"), ).toBeInTheDocument(); expect(screen.getAllByText("Optional")).toHaveLength(2); expect(screen.queryByText("What you want to take on.")).not.toBeInTheDocument(); expect(screen.getByRole("button", { name: "Send to a facilitator" })).toBeInTheDocument(); }); it("replaces the form with the large-organization confirmation and names no price", () => { render( , ); expect(screen.getAllByText(/two working days/).length).toBeGreaterThan(0); expect(screen.getByRole("link", { name: "Choose a time" })).toHaveAttribute( "href", "https://calendar.example/workshop", ); expect(screen.queryByText(/\$\d/)).not.toBeInTheDocument(); expect(messages.pages.workshops.whoRunsIt.title).not.toMatch(/paid/); }); });