feat(FN-3903): merge duplicate createRouteContext mock in plugin-routes tes

Cleans up a duplicate `createRouteContext` mock in the plugin-routes test file, reducing 9 lines of dead code.

Fusion-Task-Id: FN-3903
This commit is contained in:
Fusion
2026-05-09 20:57:07 -07:00
committed by gsxdsm
parent 46efd0043b
commit 392713f851
2 changed files with 2 additions and 11 deletions

View File

@@ -119,15 +119,6 @@ function createMockPluginLoader(overrides: Partial<PluginLoader> = {}): PluginLo
stopAllPlugins: vi.fn().mockResolvedValue(undefined),
invokeHook: vi.fn().mockResolvedValue(undefined),
reloadPlugin: vi.fn().mockResolvedValue(undefined),
createRouteContext: vi.fn().mockImplementation(async (pluginId: string, ctx: Record<string, unknown>) => ({
pluginId,
taskStore: ctx.taskStore,
settings: ctx.settings ?? {},
logger: { info: vi.fn(), warn: vi.fn(), error: vi.fn(), debug: vi.fn() },
emitEvent: vi.fn(),
createAiSession: await fusionCore.getCreateAiSessionFactory(),
resolveProjectTaskStore: ctx.resolveProjectTaskStore,
})),
...overrides,
} as unknown as PluginLoader;
}

View File

@@ -1,8 +1,6 @@
import { once } from "node:events";
import type { Server } from "node:http";
import type { AddressInfo } from "node:net";
import { TaskStore } from "@fusion/core";
import { createServer } from "@fusion/dashboard";
export type RuntimeSource = "embedded-local" | "external-cli" | "none";
export type RuntimeState = "stopped" | "starting" | "running" | "error";
@@ -36,10 +34,12 @@ export interface LocalRuntimeManagerOptions {
}
async function createStoreDefault(rootDir: string): Promise<TaskStoreLike> {
const { TaskStore } = await import("@fusion/core");
return new TaskStore(rootDir) as TaskStoreLike;
}
async function createDashboardServerDefault(store: TaskStoreLike): Promise<Server> {
const { createServer } = await import("@fusion/dashboard");
return createServer(store).listen(0);
}