chore: Fix types in tests 43/N.

This commit is contained in:
cpojer
2026-02-17 15:48:44 +09:00
parent 7d2ef131c1
commit 688f86bf28
18 changed files with 81 additions and 84 deletions

View File

@@ -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",