Fix TypeScript matcher typing issue
CI Pipeline / test (pull_request) Successful in 7m5s
CI Pipeline / lint (pull_request) Has been cancelled
CI Pipeline / build (pull_request) Has been cancelled
CI Pipeline / e2e (webkit) (pull_request) Has been cancelled
CI Pipeline / e2e (chromium) (pull_request) Successful in 54m11s
CI Pipeline / e2e (firefox) (pull_request) Failing after 22m9s
CI Pipeline / visual-regression (pull_request) Successful in 11m50s
CI Pipeline / performance (pull_request) Successful in 13m59s

This commit is contained in:
adilallo
2026-01-28 15:57:47 -07:00
parent 2652015e80
commit 9cb89162ab
28 changed files with 69 additions and 90 deletions
+3 -1
View File
@@ -47,7 +47,9 @@ describe("AskOrganizer (behavioral tests)", () => {
it("renders subtitle when provided", () => {
render(<AskOrganizer title="Test" subtitle="Subtitle" />);
expect(screen.getByRole("heading", { name: "Subtitle" })).toBeInTheDocument();
expect(
screen.getByRole("heading", { name: "Subtitle" }),
).toBeInTheDocument();
});
it("renders button with default text", () => {
-1
View File
@@ -63,4 +63,3 @@ describe("Button (behavioral tests)", () => {
expect(link).toHaveAttribute("href", "/learn");
});
});
-1
View File
@@ -26,4 +26,3 @@ componentTestSuite<CheckboxProps>({
disabledProps: { disabled: true },
},
});
+2 -1
View File
@@ -13,7 +13,8 @@ vi.mock("next/link", () => ({
}));
vi.mock("../../lib/assetUtils", async (importOriginal) => {
const actual = (await importOriginal()) as typeof import("../../lib/assetUtils");
const actual =
(await importOriginal()) as typeof import("../../lib/assetUtils");
return {
...actual,
getAssetPath: vi.fn((asset: string) => `/assets/${asset}`),
+1 -6
View File
@@ -9,11 +9,7 @@ componentTestSuite<ContextMenuProps>({
component: ContextMenu,
name: "ContextMenu",
props: {
children: (
<ContextMenuItem>
Item
</ContextMenuItem>
),
children: <ContextMenuItem>Item</ContextMenuItem>,
} as ContextMenuProps,
requiredProps: [],
primaryRole: "menu",
@@ -25,4 +21,3 @@ componentTestSuite<ContextMenuProps>({
errorState: false,
},
});
@@ -23,4 +23,3 @@ componentTestSuite<ContextMenuItemProps>({
disabledProps: { disabled: true },
},
});
+15 -5
View File
@@ -60,14 +60,24 @@ describe("Footer (behavioral tests)", () => {
it("renders navigation links", () => {
render(<Footer />);
expect(screen.getAllByRole("link", { name: "Use cases" }).length).toBeGreaterThan(0);
expect(screen.getAllByRole("link", { name: "Learn" }).length).toBeGreaterThan(0);
expect(screen.getAllByRole("link", { name: "About" }).length).toBeGreaterThan(0);
expect(
screen.getAllByRole("link", { name: "Use cases" }).length,
).toBeGreaterThan(0);
expect(
screen.getAllByRole("link", { name: "Learn" }).length,
).toBeGreaterThan(0);
expect(
screen.getAllByRole("link", { name: "About" }).length,
).toBeGreaterThan(0);
});
it("renders legal links", () => {
render(<Footer />);
expect(screen.getAllByRole("link", { name: "Privacy Policy" }).length).toBeGreaterThan(0);
expect(screen.getAllByRole("link", { name: "Terms of Service" }).length).toBeGreaterThan(0);
expect(
screen.getAllByRole("link", { name: "Privacy Policy" }).length,
).toBeGreaterThan(0);
expect(
screen.getAllByRole("link", { name: "Terms of Service" }).length,
).toBeGreaterThan(0);
});
});
-1
View File
@@ -19,4 +19,3 @@ componentTestSuite<HeaderProps>({
errorState: false,
},
});
+4 -4
View File
@@ -45,7 +45,9 @@ describe("HeroBanner (behavioral tests)", () => {
it("renders subtitle when provided", () => {
render(<HeroBanner title="Test" subtitle="Subtitle" />);
expect(screen.getByRole("heading", { name: "Subtitle" })).toBeInTheDocument();
expect(
screen.getByRole("heading", { name: "Subtitle" }),
).toBeInTheDocument();
});
it("renders hero image", () => {
@@ -56,9 +58,7 @@ describe("HeroBanner (behavioral tests)", () => {
});
it("renders CTA button when provided", () => {
render(
<HeroBanner title="Test" ctaText="Get Started" ctaHref="/start" />,
);
render(<HeroBanner title="Test" ctaText="Get Started" ctaHref="/start" />);
expect(
screen.getAllByRole("button", { name: "Get Started" }).length,
).toBeGreaterThan(0);
-1
View File
@@ -27,4 +27,3 @@ componentTestSuite<InputProps>({
errorProps: { error: true },
},
});
+2 -6
View File
@@ -37,9 +37,7 @@ describe("Logo (behavioral tests)", () => {
it("renders logo icon", () => {
render(<Logo />);
expect(
screen.getByAltText("CommunityRule Logo Icon"),
).toBeInTheDocument();
expect(screen.getByAltText("CommunityRule Logo Icon")).toBeInTheDocument();
});
it("renders text by default", () => {
@@ -50,9 +48,7 @@ describe("Logo (behavioral tests)", () => {
it("hides text when showText is false", () => {
render(<Logo showText={false} />);
expect(screen.queryByText("CommunityRule")).not.toBeInTheDocument();
expect(
screen.getByAltText("CommunityRule Logo Icon"),
).toBeInTheDocument();
expect(screen.getByAltText("CommunityRule Logo Icon")).toBeInTheDocument();
});
it("renders with different size variants", () => {
-1
View File
@@ -27,4 +27,3 @@ componentTestSuite<RadioButtonProps>({
disabledProps: { disabled: true },
},
});
-1
View File
@@ -25,4 +25,3 @@ componentTestSuite<RadioGroupProps>({
errorState: false,
},
});
+3 -12
View File
@@ -50,19 +50,13 @@ const mockPosts: BlogPost[] = [
describe("RelatedArticles", () => {
it("renders without crashing", () => {
render(
<RelatedArticles
relatedPosts={mockPosts}
currentPostSlug="current"
/>,
<RelatedArticles relatedPosts={mockPosts} currentPostSlug="current" />,
);
});
it("renders related articles", () => {
render(
<RelatedArticles
relatedPosts={mockPosts}
currentPostSlug="current"
/>,
<RelatedArticles relatedPosts={mockPosts} currentPostSlug="current" />,
);
expect(screen.getByTestId("thumbnail-article-1")).toBeInTheDocument();
expect(screen.getByTestId("thumbnail-article-2")).toBeInTheDocument();
@@ -70,10 +64,7 @@ describe("RelatedArticles", () => {
it("filters out current post", () => {
render(
<RelatedArticles
relatedPosts={mockPosts}
currentPostSlug="article-1"
/>,
<RelatedArticles relatedPosts={mockPosts} currentPostSlug="article-1" />,
);
expect(screen.queryByTestId("thumbnail-article-1")).not.toBeInTheDocument();
expect(screen.getByTestId("thumbnail-article-2")).toBeInTheDocument();
-1
View File
@@ -21,4 +21,3 @@ componentTestSuite<SectionHeaderProps>({
errorState: false,
},
});
-1
View File
@@ -32,4 +32,3 @@ componentTestSuite<SelectProps>({
errorProps: { error: true },
},
});
-1
View File
@@ -26,4 +26,3 @@ componentTestSuite<SwitchProps>({
disabledProps: { disabled: true },
},
});
-1
View File
@@ -28,4 +28,3 @@ componentTestSuite<TextAreaProps>({
errorProps: { error: true },
},
});
-1
View File
@@ -24,4 +24,3 @@ componentTestSuite<ToggleProps>({
disabledProps: { disabled: true },
},
});
-1
View File
@@ -20,4 +20,3 @@ componentTestSuite<ToggleGroupProps>({
errorState: false,
},
});