Files
openclaw/src/agents/openclaw-tools.image-generation.test.ts
2026-03-17 01:09:58 -07:00

40 lines
1.1 KiB
TypeScript

import { describe, expect, it, vi } from "vitest";
import type { OpenClawConfig } from "../config/config.js";
import { createOpenClawTools } from "./openclaw-tools.js";
vi.mock("../plugins/tools.js", () => ({
resolvePluginTools: () => [],
}));
function asConfig(value: unknown): OpenClawConfig {
return value as OpenClawConfig;
}
describe("openclaw tools image generation registration", () => {
it("registers image_generate when image-generation config is present", () => {
const tools = createOpenClawTools({
config: asConfig({
agents: {
defaults: {
imageGenerationModel: {
primary: "openai/gpt-image-1",
},
},
},
}),
agentDir: "/tmp/openclaw-agent-main",
});
expect(tools.map((tool) => tool.name)).toContain("image_generate");
});
it("omits image_generate when image-generation config is absent", () => {
const tools = createOpenClawTools({
config: asConfig({}),
agentDir: "/tmp/openclaw-agent-main",
});
expect(tools.map((tool) => tool.name)).not.toContain("image_generate");
});
});