import { render, screen, within } from "@testing-library/react"; import { describe, expect, it } from "vitest"; import FilePreview from "./FilePreview"; describe("FilePreview", () => { it("shows YAML frontmatter as metadata while preserving the body", () => { render( , ); const frontmatter = within(screen.getByLabelText("Front matter")); expect(frontmatter.getByText("description")).toBeInTheDocument(); expect( frontmatter.getByText("Memory Search query guidance"), ).toBeInTheDocument(); expect(frontmatter.getByText("name")).toBeInTheDocument(); expect( frontmatter.getByText("memory-search-query-best-practices"), ).toBeInTheDocument(); expect( screen.getByRole("heading", { level: 2, name: "When to Use" }), ).toBeInTheDocument(); expect( screen.getByText("Use this when searching memory."), ).toBeInTheDocument(); }); });