From 8fd9264ae73226e36099e77f72a10fb47253c605 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 1 May 2026 12:20:50 +0100 Subject: [PATCH] refactor: delete unused test helpers --- .../test-helpers/agent-message-fixtures.ts | 18 +---------- src/plugin-sdk/test-helpers.ts | 31 +------------------ src/plugins/bundle-mcp.test-support.ts | 13 -------- 3 files changed, 2 insertions(+), 60 deletions(-) diff --git a/src/agents/test-helpers/agent-message-fixtures.ts b/src/agents/test-helpers/agent-message-fixtures.ts index 040be7f1dd8..9d1f5da85f0 100644 --- a/src/agents/test-helpers/agent-message-fixtures.ts +++ b/src/agents/test-helpers/agent-message-fixtures.ts @@ -1,5 +1,5 @@ import type { AgentMessage } from "@mariozechner/pi-agent-core"; -import type { AssistantMessage, ToolResultMessage, UserMessage } from "@mariozechner/pi-ai"; +import type { AssistantMessage, UserMessage } from "@mariozechner/pi-ai"; import { ZERO_USAGE_FIXTURE } from "./usage-fixtures.js"; export function castAgentMessage(message: unknown): AgentMessage { @@ -34,19 +34,3 @@ export function makeAgentAssistantMessage( ...overrides, }; } - -export function makeAgentToolResultMessage( - overrides: Partial & - Pick, -): ToolResultMessage { - const { toolCallId, toolName, content, ...rest } = overrides; - return { - role: "toolResult", - toolCallId, - toolName, - content, - isError: false, - timestamp: 0, - ...rest, - }; -} diff --git a/src/plugin-sdk/test-helpers.ts b/src/plugin-sdk/test-helpers.ts index 1062e915cd2..b4ca0418079 100644 --- a/src/plugin-sdk/test-helpers.ts +++ b/src/plugin-sdk/test-helpers.ts @@ -1,4 +1,4 @@ -import { mkdirSync, writeFileSync, type RmOptions } from "node:fs"; +import { mkdirSync, type RmOptions } from "node:fs"; import { mkdir, mkdtemp, rm } from "node:fs/promises"; import { tmpdir } from "node:os"; import path from "node:path"; @@ -44,32 +44,3 @@ export function createPluginSdkTestHarness(options?: { cleanup?: RmOptions }) { createTempDirSync, }; } - -export function createBundledPluginPublicSurfaceFixture(params: { - createTempDirSync: (prefix: string) => string; - marker: string; - prefix: string; -}) { - const rootDir = params.createTempDirSync(params.prefix); - mkdirSync(path.join(rootDir, "demo"), { recursive: true }); - writeFileSync( - path.join(rootDir, "demo", "api.js"), - `export const marker = ${JSON.stringify(params.marker)};\n`, - "utf8", - ); - return rootDir; -} - -export function createThrowingBundledPluginPublicSurfaceFixture(params: { - createTempDirSync: (prefix: string) => string; - prefix: string; -}) { - const rootDir = params.createTempDirSync(params.prefix); - mkdirSync(path.join(rootDir, "bad"), { recursive: true }); - writeFileSync( - path.join(rootDir, "bad", "api.js"), - `throw new Error("plugin load failure");\n`, - "utf8", - ); - return rootDir; -} diff --git a/src/plugins/bundle-mcp.test-support.ts b/src/plugins/bundle-mcp.test-support.ts index 8e5a86979c2..24cc8d0e9aa 100644 --- a/src/plugins/bundle-mcp.test-support.ts +++ b/src/plugins/bundle-mcp.test-support.ts @@ -39,19 +39,6 @@ export async function writeClaudeBundleManifest(params: { return pluginRoot; } -export async function writeBundleTextFiles( - rootDir: string, - files: Readonly>, -) { - await Promise.all( - Object.entries(files).map(async ([relativePath, contents]) => { - const filePath = path.join(rootDir, relativePath); - await fs.mkdir(path.dirname(filePath), { recursive: true }); - await fs.writeFile(filePath, contents, "utf-8"); - }), - ); -} - export function createEnabledPluginEntries(pluginIds: readonly string[]) { return Object.fromEntries(pluginIds.map((pluginId) => [pluginId, { enabled: true }])); }