feat(FN-3091): add plugin view remount routing test coverage

Adds test coverage for plugin view remount routing behavior in the App component.

Fusion-Task-Id: FN-3091
This commit is contained in:
Fusion
2026-05-07 07:08:11 -07:00
committed by gsxdsm
parent 5ffd1485c3
commit 4338b590c6
10 changed files with 480 additions and 0 deletions

View File

@@ -101,4 +101,19 @@ describe("usePluginDashboardViews", () => {
await waitFor(() => expect(second.result.current.loading).toBe(false));
expect(mockFetch).toHaveBeenCalledWith("project-b");
});
it("supports filtering view entries by pluginId in consumers", async () => {
mockFetch.mockResolvedValueOnce([
{ pluginId: "fusion-plugin-dependency-graph", view: { viewId: "graph", label: "Graph", componentPath: "./Graph.js" } },
{ pluginId: "fusion-plugin-queue", view: { viewId: "queue", label: "Queue", componentPath: "./Queue.js" } },
]);
const { result } = renderHook(() => usePluginDashboardViews("project-a"));
await waitFor(() => expect(result.current.loading).toBe(false));
const graphViews = result.current.views.filter((entry) => entry.pluginId === "fusion-plugin-dependency-graph");
expect(graphViews).toEqual([
{ pluginId: "fusion-plugin-dependency-graph", view: { viewId: "graph", label: "Graph", componentPath: "./Graph.js" } },
]);
});
});

View File

@@ -367,6 +367,34 @@ describe("useViewState", () => {
});
});
it("round-trips between built-in and plugin task views", async () => {
localStorage.setItem("kb:proj_123:kb-dashboard-task-view", "board");
const { result } = renderHook(() =>
useViewState(
createOptions({
currentProject: PROJECT,
}),
),
);
await waitFor(() => {
expect(result.current.taskView).toBe("board");
});
await act(async () => {
result.current.handleChangeTaskView("plugin:fusion-plugin-dependency-graph:graph");
});
expect(result.current.taskView).toBe("plugin:fusion-plugin-dependency-graph:graph");
expect(localStorage.getItem("kb:proj_123:kb-dashboard-task-view")).toBe("plugin:fusion-plugin-dependency-graph:graph");
await act(async () => {
result.current.handleChangeTaskView("board");
});
expect(result.current.taskView).toBe("board");
expect(localStorage.getItem("kb:proj_123:kb-dashboard-task-view")).toBe("board");
});
it("restores legacy views (board/list/agents/missions/chat) from scoped storage", async () => {
const legacyViews = ["board", "list", "agents", "missions", "chat"] as const;