mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 14:38:25 +00:00
chore: Fix types in tests 43/N.
This commit is contained in:
@@ -4,7 +4,7 @@ import { describe, expect, it } from "vitest";
|
||||
import { toToolDefinitions } from "./pi-tool-definition-adapter.js";
|
||||
|
||||
type ToolExecute = ReturnType<typeof toToolDefinitions>[number]["execute"];
|
||||
const extensionContext = {} as Parameters<ToolExecute>[3];
|
||||
const extensionContext = {} as Parameters<ToolExecute>[4];
|
||||
|
||||
describe("pi tool definition adapter", () => {
|
||||
it("wraps tool errors into a tool result", async () => {
|
||||
@@ -19,14 +19,12 @@ describe("pi tool definition adapter", () => {
|
||||
} satisfies AgentTool;
|
||||
|
||||
const defs = toToolDefinitions([tool]);
|
||||
const args: Parameters<(typeof defs)[number]["execute"]> = [
|
||||
"call1",
|
||||
{},
|
||||
undefined,
|
||||
extensionContext,
|
||||
undefined,
|
||||
];
|
||||
const result = await defs[0].execute(...args);
|
||||
const def = defs[0];
|
||||
if (!def) {
|
||||
throw new Error("missing tool definition");
|
||||
}
|
||||
const execute = (...args: Parameters<(typeof defs)[0]["execute"]>) => def.execute(...args);
|
||||
const result = await execute("call1", {}, undefined, undefined, extensionContext);
|
||||
|
||||
expect(result.details).toMatchObject({
|
||||
status: "error",
|
||||
@@ -48,14 +46,12 @@ describe("pi tool definition adapter", () => {
|
||||
} satisfies AgentTool;
|
||||
|
||||
const defs = toToolDefinitions([tool]);
|
||||
const args: Parameters<(typeof defs)[number]["execute"]> = [
|
||||
"call2",
|
||||
{},
|
||||
undefined,
|
||||
extensionContext,
|
||||
undefined,
|
||||
];
|
||||
const result = await defs[0].execute(...args);
|
||||
const def = defs[0];
|
||||
if (!def) {
|
||||
throw new Error("missing tool definition");
|
||||
}
|
||||
const execute = (...args: Parameters<(typeof defs)[0]["execute"]>) => def.execute(...args);
|
||||
const result = await execute("call2", {}, undefined, undefined, extensionContext);
|
||||
|
||||
expect(result.details).toMatchObject({
|
||||
status: "error",
|
||||
|
||||
Reference in New Issue
Block a user