mirror of https://github.com/openclaw/openclaw.git
test: speed up focused pi-tools tool tests
This commit is contained in:
parent
dbcd35f6c2
commit
bc7f845714
|
|
@ -1,6 +1,7 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import "./test-helpers/fast-coding-tools.js";
|
||||
import "./test-helpers/fast-openclaw-tools.js";
|
||||
import { createOpenClawCodingTools } from "./pi-tools.js";
|
||||
|
||||
const defaultTools = createOpenClawCodingTools({ senderIsOwner: true });
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
import "./test-helpers/fast-openclaw-tools.js";
|
||||
import { createOpenClawCodingTools } from "./pi-tools.js";
|
||||
|
||||
function findToolDescription(toolName: string, senderIsOwner: boolean) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { describe, expect, it, vi } from "vitest";
|
||||
import "./test-helpers/fast-coding-tools.js";
|
||||
import "./test-helpers/fast-openclaw-tools.js";
|
||||
import { createOpenClawCodingTools } from "./pi-tools.js";
|
||||
|
||||
vi.mock("./channel-tools.js", () => {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
import { vi } from "vitest";
|
||||
import { stubTool } from "./fast-tool-stubs.js";
|
||||
|
||||
function stubActionTool(name: string, actions: string[]) {
|
||||
return {
|
||||
...stubTool(name),
|
||||
parameters: {
|
||||
type: "object" as const,
|
||||
properties: {
|
||||
action: {
|
||||
type: "string" as const,
|
||||
enum: actions,
|
||||
},
|
||||
},
|
||||
required: ["action"],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const coreTools = [
|
||||
stubActionTool("canvas", ["create", "read"]),
|
||||
stubActionTool("nodes", ["list", "invoke"]),
|
||||
stubActionTool("cron", ["schedule", "cancel"]),
|
||||
stubActionTool("message", ["send", "reply"]),
|
||||
stubActionTool("gateway", ["status"]),
|
||||
stubActionTool("agents_list", ["list", "show"]),
|
||||
stubActionTool("sessions_list", ["list", "show"]),
|
||||
stubActionTool("sessions_history", ["read", "tail"]),
|
||||
stubActionTool("sessions_send", ["send", "reply"]),
|
||||
stubActionTool("sessions_spawn", ["spawn", "handoff"]),
|
||||
stubActionTool("subagents", ["list", "show"]),
|
||||
stubActionTool("session_status", ["get", "show"]),
|
||||
stubTool("tts"),
|
||||
stubTool("image_generate"),
|
||||
stubTool("web_search"),
|
||||
stubTool("web_fetch"),
|
||||
stubTool("image"),
|
||||
stubTool("pdf"),
|
||||
];
|
||||
|
||||
vi.mock("../openclaw-tools.js", () => ({
|
||||
createOpenClawTools: () => coreTools.map((tool) => ({ ...tool })),
|
||||
__testing: {
|
||||
setDepsForTest: () => {},
|
||||
},
|
||||
}));
|
||||
Loading…
Reference in New Issue