Keep the template picker in the create flow, make catalog cards real links, and stop showing a fake community when review has no draft.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
adilallo
2026-09-10 15:22:46 -06:00
co-authored by Cursor
parent 3f9a8395be
commit 90db213413
31 changed files with 412 additions and 126 deletions
@@ -1,10 +1,13 @@
import { describe, vi } from "vitest";
import { describe, expect, it } from "vitest";
import { screen } from "@testing-library/react";
import {
componentTestSuite,
type ComponentTestSuiteConfig,
} from "../utils/componentTestSuite";
import { renderWithProviders as render } from "../utils/test-utils";
import { GovernanceTemplateGrid } from "../../app/components/sections/GovernanceTemplateGrid";
import { GOVERNANCE_TEMPLATE_CATALOG } from "../../lib/templates/governanceTemplateCatalog";
import "@testing-library/jest-dom/vitest";
type Props = React.ComponentProps<typeof GovernanceTemplateGrid>;
@@ -13,10 +16,10 @@ const config: ComponentTestSuiteConfig<Props> = {
name: "GovernanceTemplateGrid",
props: {
entries: GOVERNANCE_TEMPLATE_CATALOG.slice(0, 2),
onTemplateClick: vi.fn(),
hrefForTemplate: (slug: string) => `/create/review-template/${slug}`,
} as Props,
requiredProps: ["entries", "onTemplateClick"],
primaryRole: "button",
requiredProps: ["entries", "hrefForTemplate"],
primaryRole: "link",
testCases: {
renders: true,
accessibility: true,
@@ -25,4 +28,21 @@ const config: ComponentTestSuiteConfig<Props> = {
describe("GovernanceTemplateGrid", () => {
componentTestSuite<Props>(config);
it("renders each catalog card as a link to template review", () => {
const entries = GOVERNANCE_TEMPLATE_CATALOG.slice(0, 2);
render(
<GovernanceTemplateGrid
entries={entries}
hrefForTemplate={(slug) => `/create/review-template/${slug}`}
/>,
);
for (const entry of entries) {
expect(
screen.getByRole("link", { name: new RegExp(entry.title, "i") }),
).toHaveAttribute("href", `/create/review-template/${entry.slug}`);
}
expect(screen.queryByRole("button")).not.toBeInTheDocument();
});
});