Spaces:
Paused
Paused
Download console/src/pages/Coding/FilePreview.test.tsx from mysticaldragon/HF: direct link, hf CLI and curl.
- Browser
- Download file 1.26 kB
-
https://huggingface.co/spaces/mysticaldragon/HF/resolve/main/console/src/pages/Coding/FilePreview.test.tsx
- Command line
-
hf download hf://spaces/mysticaldragon/HF/console/src/pages/Coding/FilePreview.test.tsx
-
curl -L -o FilePreview.test.tsx https://huggingface.co/spaces/mysticaldragon/HF/resolve/main/console/src/pages/Coding/FilePreview.test.tsx
1.26 kB
| 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( | |
| <FilePreview | |
| filePath="memory-search.md" | |
| content={[ | |
| "---", | |
| "description: Memory Search query guidance", | |
| "name: memory-search-query-best-practices", | |
| "---", | |
| "", | |
| "## When to Use", | |
| "", | |
| "Use this when searching memory.", | |
| ].join("\n")} | |
| />, | |
| ); | |
| 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(); | |
| }); | |
| }); | |