feat(FN-3916): fix bundled Dependency Graph view load path

Fixed the bundled Dependency Graph view load path in the dashboard app, adding regression tests across the App and plugin registration test suites, and documenting the bundled loading contract in the plugin README.

Fusion-Task-Id: FN-3916
This commit is contained in:
Fusion
2026-05-10 01:24:20 -07:00
committed by gsxdsm
parent c96629e6af
commit d7302b3325
4 changed files with 55 additions and 5 deletions

View File

@@ -1,16 +1,20 @@
import { describe, expect, it, beforeEach, vi } from "vitest";
import { getPluginViewComponent, __test_clearPluginViewRegistry } from "../pluginViewRegistry";
import { createElement } from "react";
import { getPluginViewComponent, isPluginViewRegistered, __test_clearPluginViewRegistry } from "../pluginViewRegistry";
import {
__test_resetBundledPluginViewRegistration,
registerBundledPluginViews,
} from "../registerBundledPluginViews";
const MockDependencyGraphDashboardView = () => createElement("div", { "data-testid": "dep-graph-view" });
const MockRoadmapDashboardView = () => createElement("div", { "data-testid": "roadmap-view" });
vi.mock("@fusion-plugin-examples/dependency-graph/dashboard-view", () => ({
DependencyGraphDashboardView: () => null,
DependencyGraphDashboardView: (...args: unknown[]) => MockDependencyGraphDashboardView(...args),
}));
vi.mock("@fusion-plugin-examples/roadmap/dashboard-view", () => ({
RoadmapDashboardView: () => null,
RoadmapDashboardView: (...args: unknown[]) => MockRoadmapDashboardView(...args),
}));
describe("registerBundledPluginViews", () => {
@@ -33,4 +37,15 @@ describe("registerBundledPluginViews", () => {
expect(() => registerBundledPluginViews()).not.toThrow();
expect(getPluginViewComponent("fusion-plugin-dependency-graph", "graph")).toBe(firstGraph);
});
// FN-3916 regression: verifies the registry reports the graph view as registered
// so App.tsx can fall back to bundled static registration when API has no views.
it("reports dependency graph as registered via isPluginViewRegistered", () => {
registerBundledPluginViews();
expect(isPluginViewRegistered("fusion-plugin-dependency-graph", "graph")).toBe(true);
expect(isPluginViewRegistered("roadmap-planner", "roadmaps")).toBe(true);
// Unknown plugin/view should not be registered
expect(isPluginViewRegistered("unknown-plugin", "unknown")).toBe(false);
});
});