feat(FN-3446): expand dashboard guide view sections and add regression test
Merged two commits completing the FN-3446 dashboard guide feature: the documentation was expanded with new view sections, and a regression test suite was added for the dashboard guide to prevent future regressions. Fusion-Task-Id: FN-3446
This commit is contained in:
55
packages/dashboard/src/__tests__/dashboard-guide.test.ts
Normal file
55
packages/dashboard/src/__tests__/dashboard-guide.test.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
// @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",
|
||||
"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");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user