-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmarkdown.test.ts
More file actions
33 lines (28 loc) · 1.2 KB
/
markdown.test.ts
File metadata and controls
33 lines (28 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { describe, expect, test } from "vitest";
import { getDetailMarkdown } from "../api/content-markdown";
describe("detail markdown resolver", () => {
test("resolves docs markdown", () => {
const markdown = getDetailMarkdown("docs", "get-started/getting-started");
expect(markdown).toContain("---");
expect(markdown).toContain("title:");
});
test("resolves solution markdown", () => {
const markdown = getDetailMarkdown("solutions", "what-is-a-lakebase");
expect(markdown).toContain("# What is a Lakebase?");
});
test("resolves template markdown", () => {
const markdown = getDetailMarkdown("templates", "base-app-template");
expect(markdown).toContain("# Base App Template");
expect(markdown).toContain("## Databricks Local Bootstrap");
});
test("does not duplicate recipe headings in legacy template export", () => {
const markdown = getDetailMarkdown("templates", "ai-chat-app-template");
const matches = markdown.match(/## Databricks Local Bootstrap/g) ?? [];
expect(matches).toHaveLength(1);
});
test("rejects path traversal", () => {
expect(() => getDetailMarkdown("docs", "../package.json")).toThrow(
"path traversal",
);
});
});