refactor(test): share plugin hook registry helper

This commit is contained in:
Peter Steinberger
2026-02-15 14:44:15 +00:00
parent 6ec76af3a6
commit e2c68cb169
4 changed files with 38 additions and 85 deletions

View File

@@ -0,0 +1,25 @@
import type { PluginRegistry } from "./registry.js";
export function createMockPluginRegistry(
hooks: Array<{ hookName: string; handler: (...args: unknown[]) => unknown }>,
): PluginRegistry {
return {
hooks: hooks as never[],
typedHooks: hooks.map((h) => ({
pluginId: "test-plugin",
hookName: h.hookName,
handler: h.handler,
priority: 0,
source: "test",
})),
tools: [],
httpHandlers: [],
httpRoutes: [],
channelRegistrations: [],
gatewayHandlers: {},
cliRegistrars: [],
services: [],
providers: [],
commands: [],
} as unknown as PluginRegistry;
}