31 lines
837 B
TypeScript
31 lines
837 B
TypeScript
import { vi } from "vitest";
|
|
|
|
export type StubTool = {
|
|
name: string;
|
|
description: string;
|
|
parameters: { type: "object"; properties: Record<string, unknown> };
|
|
// Keep the exported type portable: don't leak Vitest's mock types into .d.ts.
|
|
execute: (...args: unknown[]) => unknown;
|
|
};
|
|
|
|
export const stubTool = (name: string): StubTool => ({
|
|
name,
|
|
description: `${name} stub`,
|
|
parameters: { type: "object", properties: {} },
|
|
execute: vi.fn() as unknown as (...args: unknown[]) => unknown,
|
|
});
|
|
|
|
vi.mock("../tools/image-tool.js", () => ({
|
|
createImageTool: () => stubTool("image"),
|
|
}));
|
|
|
|
vi.mock("../tools/web-tools.js", () => ({
|
|
createWebSearchTool: () => null,
|
|
createWebFetchTool: () => null,
|
|
}));
|
|
|
|
vi.mock("../../plugins/tools.js", () => ({
|
|
resolvePluginTools: () => [],
|
|
getPluginToolMeta: () => undefined,
|
|
}));
|