import React from "react"; import { render, screen } from "@testing-library/react"; import { describe, it, expect, vi } from "vitest"; import RelatedArticles from "../../app/components/sections/RelatedArticles"; import type { BlogPost } from "../../lib/content"; vi.mock("next/link", () => ({ default: ({ children, href, ...props }: { children?: React.ReactNode; href?: string; [key: string]: unknown; }) => ( {children} ), })); vi.mock("../../app/components/content/ContentThumbnailTemplate", () => ({ default: ({ post }: { post: BlogPost }) => (
), })); vi.mock("../../app/hooks", () => ({ useIsMobile: () => false, })); const mockPosts: BlogPost[] = [ { slug: "article-1", frontmatter: { title: "Article 1", description: "Description 1", author: "Author", date: "2025-04-10", }, }, { slug: "article-2", frontmatter: { title: "Article 2", description: "Description 2", author: "Author", date: "2025-04-11", }, }, ]; describe("RelatedArticles", () => { it("renders without crashing", () => { render(