mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-19 14:00:51 +00:00
40 lines
1.1 KiB
TypeScript
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");
|
|
});
|
|
});
|