mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-24 19:35:28 -06:00
34 lines
1.3 KiB
TypeScript
34 lines
1.3 KiB
TypeScript
// Server runtime-state test helper builds minimal gateway runtime state with a
|
|
// configurable plugin registry.
|
|
import { createEmptyPluginRegistry } from "../plugins/registry.js";
|
|
import { createGatewayRuntimeState } from "./server-runtime-state.js";
|
|
|
|
/**
|
|
* Runtime-state fixture factory for gateway server tests.
|
|
*/
|
|
type GatewayRuntimeStateParams = Parameters<typeof createGatewayRuntimeState>[0];
|
|
|
|
/** Creates a minimal gateway runtime state with optional plugin registry fixture. */
|
|
export async function createGatewayRuntimeStateForTest(
|
|
pluginRegistry: GatewayRuntimeStateParams["pluginRegistry"] = createEmptyPluginRegistry(),
|
|
) {
|
|
return await createGatewayRuntimeState({
|
|
cfg: {},
|
|
bindHost: "127.0.0.1",
|
|
port: 0,
|
|
controlUiEnabled: false,
|
|
controlUiBasePath: "/",
|
|
openAiChatCompletionsEnabled: false,
|
|
openResponsesEnabled: false,
|
|
resolvedAuth: {} as never,
|
|
getResolvedAuth: () => ({}) as never,
|
|
hooksConfig: () => null,
|
|
getHookClientIpConfig: () => ({}) as never,
|
|
pluginRegistry,
|
|
deps: {} as never,
|
|
log: { info: () => {}, warn: () => {} },
|
|
logHooks: { info: () => {}, warn: () => {}, error: () => {}, debug: () => {} } as never,
|
|
logPlugins: { info: () => {}, warn: () => {}, error: () => {}, debug: () => {} } as never,
|
|
});
|
|
}
|