refactor: delete unused test helpers · openclaw/openclaw@8fd9264
steipete
·
2026-05-01
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | import type { AgentMessage } from "@mariozechner/pi-agent-core"; |
2 | | -import type { AssistantMessage, ToolResultMessage, UserMessage } from "@mariozechner/pi-ai"; |
| 2 | +import type { AssistantMessage, UserMessage } from "@mariozechner/pi-ai"; |
3 | 3 | import { ZERO_USAGE_FIXTURE } from "./usage-fixtures.js"; |
4 | 4 | |
5 | 5 | export function castAgentMessage(message: unknown): AgentMessage { |
@@ -34,19 +34,3 @@ export function makeAgentAssistantMessage(
|
34 | 34 | ...overrides, |
35 | 35 | }; |
36 | 36 | } |
37 | | - |
38 | | -export function makeAgentToolResultMessage( |
39 | | -overrides: Partial<ToolResultMessage> & |
40 | | -Pick<ToolResultMessage, "toolCallId" | "toolName" | "content">, |
41 | | -): ToolResultMessage { |
42 | | -const { toolCallId, toolName, content, ...rest } = overrides; |
43 | | -return { |
44 | | -role: "toolResult", |
45 | | - toolCallId, |
46 | | - toolName, |
47 | | - content, |
48 | | -isError: false, |
49 | | -timestamp: 0, |
50 | | - ...rest, |
51 | | -}; |
52 | | -} |
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | | -import { mkdirSync, writeFileSync, type RmOptions } from "node:fs"; |
| 1 | +import { mkdirSync, type RmOptions } from "node:fs"; |
2 | 2 | import { mkdir, mkdtemp, rm } from "node:fs/promises"; |
3 | 3 | import { tmpdir } from "node:os"; |
4 | 4 | import path from "node:path"; |
@@ -44,32 +44,3 @@ export function createPluginSdkTestHarness(options?: { cleanup?: RmOptions }) {
|
44 | 44 | createTempDirSync, |
45 | 45 | }; |
46 | 46 | } |
47 | | - |
48 | | -export function createBundledPluginPublicSurfaceFixture(params: { |
49 | | -createTempDirSync: (prefix: string) => string; |
50 | | -marker: string; |
51 | | -prefix: string; |
52 | | -}) { |
53 | | -const rootDir = params.createTempDirSync(params.prefix); |
54 | | -mkdirSync(path.join(rootDir, "demo"), { recursive: true }); |
55 | | -writeFileSync( |
56 | | -path.join(rootDir, "demo", "api.js"), |
57 | | -`export const marker = ${JSON.stringify(params.marker)};\n`, |
58 | | -"utf8", |
59 | | -); |
60 | | -return rootDir; |
61 | | -} |
62 | | - |
63 | | -export function createThrowingBundledPluginPublicSurfaceFixture(params: { |
64 | | -createTempDirSync: (prefix: string) => string; |
65 | | -prefix: string; |
66 | | -}) { |
67 | | -const rootDir = params.createTempDirSync(params.prefix); |
68 | | -mkdirSync(path.join(rootDir, "bad"), { recursive: true }); |
69 | | -writeFileSync( |
70 | | -path.join(rootDir, "bad", "api.js"), |
71 | | -`throw new Error("plugin load failure");\n`, |
72 | | -"utf8", |
73 | | -); |
74 | | -return rootDir; |
75 | | -} |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -39,19 +39,6 @@ export async function writeClaudeBundleManifest(params: {
|
39 | 39 | return pluginRoot; |
40 | 40 | } |
41 | 41 | |
42 | | -export async function writeBundleTextFiles( |
43 | | -rootDir: string, |
44 | | -files: Readonly<Record<string, string>>, |
45 | | -) { |
46 | | -await Promise.all( |
47 | | -Object.entries(files).map(async ([relativePath, contents]) => { |
48 | | -const filePath = path.join(rootDir, relativePath); |
49 | | -await fs.mkdir(path.dirname(filePath), { recursive: true }); |
50 | | -await fs.writeFile(filePath, contents, "utf-8"); |
51 | | -}), |
52 | | -); |
53 | | -} |
54 | | - |
55 | 42 | export function createEnabledPluginEntries(pluginIds: readonly string[]) { |
56 | 43 | return Object.fromEntries(pluginIds.map((pluginId) => [pluginId, { enabled: true }])); |
57 | 44 | } |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。