Full cleanup pass
This commit is contained in:
@@ -26,7 +26,9 @@ vi.mock("../../lib/assetUtils", async (importOriginal) => {
|
||||
(await importOriginal()) as typeof import("../../lib/assetUtils");
|
||||
return {
|
||||
...actual,
|
||||
getAssetPath: vi.fn((asset: string) => `/assets/${asset}`),
|
||||
getAssetPath: vi.fn((asset: string) =>
|
||||
asset.startsWith("/") ? asset : `/${asset}`,
|
||||
),
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React from "react";
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import { screen } from "@testing-library/react";
|
||||
import { renderWithProviders as render } from "../utils/test-utils";
|
||||
import "@testing-library/jest-dom/vitest";
|
||||
import CreateFlowFooter from "../../app/components/navigation/CreateFlowFooter";
|
||||
import Button from "../../app/components/buttons/Button";
|
||||
@@ -35,7 +36,6 @@ const config: ComponentTestSuiteConfig<CreateFlowFooterProps> = {
|
||||
|
||||
componentTestSuite<CreateFlowFooterProps>(config);
|
||||
|
||||
// Pure presentational; no provider context needed (no useMessages/useAuthModal/useCreateFlow consumers).
|
||||
describe("CreateFlowFooter (behavioral tests)", () => {
|
||||
it("renders Back button", () => {
|
||||
render(<CreateFlowFooter />);
|
||||
|
||||
@@ -57,10 +57,10 @@ describe("HeroBanner (behavioral tests)", () => {
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("renders CTA button when provided", () => {
|
||||
it("renders CTA link when provided", () => {
|
||||
render(<HeroBanner title="Test" ctaText="Get Started" ctaHref="/start" />);
|
||||
expect(
|
||||
screen.getAllByRole("button", { name: "Get Started" }).length,
|
||||
screen.getAllByRole("link", { name: "Get Started" }).length,
|
||||
).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import React from "react";
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import { screen } from "@testing-library/react";
|
||||
import { renderWithProviders as render } from "../utils/test-utils";
|
||||
import { describe, it, expect } from "vitest";
|
||||
import Logo from "../../app/components/asset/Logo";
|
||||
import {
|
||||
@@ -27,7 +28,6 @@ const config: ComponentTestSuiteConfig<LogoProps> = {
|
||||
|
||||
componentTestSuite<LogoProps>(config);
|
||||
|
||||
// Pure presentational; no provider context needed.
|
||||
describe("Logo (behavioral tests)", () => {
|
||||
it("renders as a link to home", () => {
|
||||
render(<Logo />);
|
||||
@@ -38,7 +38,7 @@ describe("Logo (behavioral tests)", () => {
|
||||
|
||||
it("renders logo icon", () => {
|
||||
render(<Logo />);
|
||||
expect(screen.getByAltText("CommunityRule Logo Icon")).toBeInTheDocument();
|
||||
expect(screen.getByAltText("CommunityRule Logo")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("renders text by default", () => {
|
||||
@@ -50,7 +50,7 @@ describe("Logo (behavioral tests)", () => {
|
||||
const { container } = render(<Logo wordmark={false} />);
|
||||
const textElement = container.querySelector(".hidden");
|
||||
expect(textElement).toBeInTheDocument();
|
||||
expect(screen.getByAltText("CommunityRule Logo Icon")).toBeInTheDocument();
|
||||
expect(screen.getByAltText("CommunityRule Logo")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("applies inverse palette styling when palette is inverse", () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from "react";
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { render } from "@testing-library/react";
|
||||
import { renderWithProviders as render } from "../utils/test-utils";
|
||||
import "@testing-library/jest-dom/vitest";
|
||||
import TextInput from "../../app/components/controls/TextInput";
|
||||
import { componentTestSuite } from "../utils/componentTestSuite";
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React from "react";
|
||||
import { describe, it, expect, vi } from "vitest";
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import { screen } from "@testing-library/react";
|
||||
import { renderWithProviders as render } from "../utils/test-utils";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import "@testing-library/jest-dom/vitest";
|
||||
import Upload from "../../app/components/controls/Upload";
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import "@testing-library/jest-dom/vitest";
|
||||
import { describe, it, expect } from "vitest";
|
||||
import Mini from "../../../app/components/cards/Mini";
|
||||
import { getAssetPath, featurePanelPath } from "../../../lib/assetUtils";
|
||||
import { renderWithProviders, screen } from "../../utils/test-utils";
|
||||
|
||||
describe("Mini", () => {
|
||||
it("renders label lines", () => {
|
||||
renderWithProviders(
|
||||
<Mini
|
||||
labelLine1="Decision-making"
|
||||
labelLine2="support"
|
||||
panelContent={getAssetPath(featurePanelPath("support"))}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(screen.getByText("Decision-making")).toBeInTheDocument();
|
||||
expect(screen.getByText("support")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,14 @@
|
||||
import "@testing-library/jest-dom/vitest";
|
||||
import { describe, it, expect } from "vitest";
|
||||
import SelectOption from "../../../app/components/controls/SelectOption";
|
||||
import { renderWithProviders, screen } from "../../utils/test-utils";
|
||||
|
||||
describe("SelectOption", () => {
|
||||
it("renders option label", () => {
|
||||
renderWithProviders(
|
||||
<SelectOption selected={false}>Option one</SelectOption>,
|
||||
);
|
||||
|
||||
expect(screen.getByRole("option", { name: "Option one" })).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,27 @@
|
||||
import "@testing-library/jest-dom/vitest";
|
||||
import { describe, it, expect } from "vitest";
|
||||
import ContentLockup from "../../../app/components/type/ContentLockup";
|
||||
import { renderWithProviders, screen } from "../../utils/test-utils";
|
||||
|
||||
describe("ContentLockup", () => {
|
||||
it("renders hero title and description", () => {
|
||||
renderWithProviders(
|
||||
<ContentLockup
|
||||
variant="hero"
|
||||
title="Collaborate"
|
||||
subtitle="with clarity"
|
||||
description="Help your community make important decisions."
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(
|
||||
screen.getByRole("heading", { name: "Collaborate" }),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByRole("heading", { name: "with clarity" }),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByText("Help your community make important decisions."),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user