openclaw/src/gateway/server/__tests__/test-utils.ts

25 lines
609 B
TypeScript

import type { PluginRegistry } from "../../../plugins/registry.js";
export const createTestRegistry = (overrides: Partial<PluginRegistry> = {}): PluginRegistry => {
const base: PluginRegistry = {
plugins: [],
tools: [],
hooks: [],
typedHooks: [],
channels: [],
providers: [],
gatewayHandlers: {},
httpHandlers: [],
cliRegistrars: [],
services: [],
commands: [],
diagnostics: [],
};
const merged = { ...base, ...overrides };
return {
...merged,
gatewayHandlers: merged.gatewayHandlers ?? {},
httpHandlers: merged.httpHandlers ?? [],
};
};