Files
fusion/packages/dashboard/src/__tests__/dashboard-guide.test.ts
Fusion e151cf2c55 feat(FN-3974): document reports view in dashboard guide
Added documentation for the dashboard's reports view to the dashboard guide, including a corresponding test assertion.

Fusion-Task-Id: FN-3974
2026-05-10 23:36:10 -07:00

57 lines
1.8 KiB
TypeScript

// @vitest-environment node
import { describe, it, expect } from "vitest";
import { readFileSync } from "node:fs";
import path from "node:path";
const repoRoot = path.resolve(__dirname, "../../../../");
function readDashboardGuide(): string {
return readFileSync(path.join(repoRoot, "docs/dashboard-guide.md"), "utf8");
}
function getSectionBody(doc: string, heading: string): string {
const escaped = heading.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
const match = doc.match(new RegExp(`## ${escaped}\\n([\\s\\S]*?)(?=\\n## |$)`));
return match?.[1]?.trim() ?? "";
}
describe("dashboard guide coverage for lazy-loaded views", () => {
const requiredSections = [
"Dev Server View",
"Agents View",
"Roadmaps View",
"Insights View",
"Reports View",
"Plugin Manager",
"Pi Extensions Manager",
] as const;
it("includes all required section headings", () => {
const guide = readDashboardGuide();
for (const section of requiredSections) {
expect(guide).toContain(`## ${section}`);
}
});
it("documents non-empty section bodies with guide-style structure markers", () => {
const guide = readDashboardGuide();
for (const section of requiredSections) {
const body = getSectionBody(guide, section);
expect(body.length).toBeGreaterThan(0);
expect(body).toMatch(/(?:^|\n)(?:- |> |\|\s|!\[)/m);
}
});
it("includes key navigation/settings terms for plugin surfaces", () => {
const guide = readDashboardGuide();
const pluginBody = getSectionBody(guide, "Plugin Manager");
const piBody = getSectionBody(guide, "Pi Extensions Manager");
expect(pluginBody).toContain("Settings → Plugins → Fusion Plugins");
expect(piBody).toContain("Settings → Plugins → Pi Extensions");
});
});