mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 19:24:59 +00:00
chore: widen hook-runner test mock signatures for tsgo
This commit is contained in:
@@ -1,10 +1,31 @@
|
|||||||
import { vi } from "vitest";
|
import { vi } from "vitest";
|
||||||
|
import type {
|
||||||
|
PluginHookAgentContext,
|
||||||
|
PluginHookBeforeAgentStartResult,
|
||||||
|
PluginHookBeforeModelResolveResult,
|
||||||
|
PluginHookBeforePromptBuildResult,
|
||||||
|
} from "../../plugins/types.js";
|
||||||
|
|
||||||
export const mockedGlobalHookRunner = {
|
export const mockedGlobalHookRunner = {
|
||||||
hasHooks: vi.fn(() => false),
|
hasHooks: vi.fn((_hookName: string) => false),
|
||||||
runBeforeAgentStart: vi.fn(async () => undefined),
|
runBeforeAgentStart: vi.fn(
|
||||||
runBeforePromptBuild: vi.fn(async () => undefined),
|
async (
|
||||||
runBeforeModelResolve: vi.fn(async () => undefined),
|
_event: { prompt: string; messages?: unknown[] },
|
||||||
|
_ctx: PluginHookAgentContext,
|
||||||
|
): Promise<PluginHookBeforeAgentStartResult | undefined> => undefined,
|
||||||
|
),
|
||||||
|
runBeforePromptBuild: vi.fn(
|
||||||
|
async (
|
||||||
|
_event: { prompt: string; messages: unknown[] },
|
||||||
|
_ctx: PluginHookAgentContext,
|
||||||
|
): Promise<PluginHookBeforePromptBuildResult | undefined> => undefined,
|
||||||
|
),
|
||||||
|
runBeforeModelResolve: vi.fn(
|
||||||
|
async (
|
||||||
|
_event: { prompt: string },
|
||||||
|
_ctx: PluginHookAgentContext,
|
||||||
|
): Promise<PluginHookBeforeModelResolveResult | undefined> => undefined,
|
||||||
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
vi.mock("../../plugins/hook-runner-global.js", () => ({
|
vi.mock("../../plugins/hook-runner-global.js", () => ({
|
||||||
|
|||||||
Reference in New Issue
Block a user