From 86bc5aa72644227c8bb21fa6a73c0713221e175e Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Tue, 11 Aug 2026 11:01:05 -0700 Subject: [PATCH] test(plugins): remove stale test plumbing (#122175) --- extensions/anthropic/openclaw.plugin.test.ts | 18 ----- .../src/inbound-context.contract.test.ts | 12 ---- .../monitor/inbound-context.test-helpers.ts | 39 ----------- extensions/discord/test-api.ts | 6 +- extensions/minimax/test-api.ts | 12 +--- extensions/moonshot/test-api.ts | 3 +- .../src/inbound-context.contract.test.ts | 33 ---------- extensions/slack/inbound-contract-test-api.ts | 3 - .../src/inbound-context.contract.test.ts | 66 ------------------- extensions/slack/test-api.ts | 10 +-- ...t-native-commands.skills-allowlist.test.ts | 2 +- extensions/telegram/src/bot.test.ts | 2 +- .../src/inbound-context.contract.test.ts | 43 ------------ .../test-support/inbound-context-contract.ts | 2 - .../telegram/src/test-support/write-skill.ts | 2 - .../src/inbound-context.contract.test.ts | 33 ---------- 16 files changed, 6 insertions(+), 280 deletions(-) delete mode 100644 extensions/discord/src/inbound-context.contract.test.ts delete mode 100644 extensions/discord/src/monitor/inbound-context.test-helpers.ts delete mode 100644 extensions/signal/src/inbound-context.contract.test.ts delete mode 100644 extensions/slack/inbound-contract-test-api.ts delete mode 100644 extensions/slack/src/inbound-context.contract.test.ts delete mode 100644 extensions/telegram/src/inbound-context.contract.test.ts delete mode 100644 extensions/telegram/src/test-support/inbound-context-contract.ts delete mode 100644 extensions/telegram/src/test-support/write-skill.ts delete mode 100644 extensions/whatsapp/src/inbound-context.contract.test.ts diff --git a/extensions/anthropic/openclaw.plugin.test.ts b/extensions/anthropic/openclaw.plugin.test.ts index ac7cb5e23394..b36a03070370 100644 --- a/extensions/anthropic/openclaw.plugin.test.ts +++ b/extensions/anthropic/openclaw.plugin.test.ts @@ -51,24 +51,6 @@ describe("Anthropic plugin manifest", () => { } }); - it("publishes the exact Claude Opus 5 API contract", () => { - const models = manifest.modelCatalog?.providers?.anthropic?.models ?? []; - expect(models.find((model) => model.id === "claude-opus-5")).toEqual({ - id: "claude-opus-5", - name: "Claude Opus 5", - reasoning: true, - input: ["text", "image"], - mediaInput: { - image: { maxSidePx: 2576, preferredSidePx: 2576, tokenMode: "provider" }, - }, - cost: { input: 5, output: 25, cacheRead: 0.5, cacheWrite: 6.25 }, - contextWindow: 1_000_000, - maxTokens: 128_000, - thinkingLevelMap: { xhigh: "xhigh", max: "max" }, - compat: { codeMode: "preferred" }, - }); - }); - it("publishes the exact Claude Sonnet 5 API contract", () => { const models = manifest.modelCatalog?.providers?.anthropic?.models ?? []; expect(models.find((model) => model.id === "claude-sonnet-5")).toEqual({ diff --git a/extensions/discord/src/inbound-context.contract.test.ts b/extensions/discord/src/inbound-context.contract.test.ts deleted file mode 100644 index 01b29b88a45f..000000000000 --- a/extensions/discord/src/inbound-context.contract.test.ts +++ /dev/null @@ -1,12 +0,0 @@ -// Discord tests cover inbound context.contract plugin behavior. -import { expectChannelInboundContextContract } from "openclaw/plugin-sdk/channel-contract-testing"; -import { describe, it } from "vitest"; -import { buildFinalizedDiscordDirectInboundContext } from "./monitor/inbound-context.test-helpers.js"; - -describe("Discord inbound context contract", () => { - it("keeps inbound context finalized", () => { - const ctx = buildFinalizedDiscordDirectInboundContext(); - - expectChannelInboundContextContract(ctx); - }); -}); diff --git a/extensions/discord/src/monitor/inbound-context.test-helpers.ts b/extensions/discord/src/monitor/inbound-context.test-helpers.ts deleted file mode 100644 index b40c43cedf43..000000000000 --- a/extensions/discord/src/monitor/inbound-context.test-helpers.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Discord helper module supports inbound context helpers behavior. -import { finalizeInboundContext } from "openclaw/plugin-sdk/reply-dispatch-runtime"; -import { buildDiscordInboundAccessContext } from "./inbound-context.js"; - -export function buildFinalizedDiscordDirectInboundContext() { - const { groupSystemPrompt, ownerAllowFrom, channelStructuredContext } = - buildDiscordInboundAccessContext({ - channelConfig: null, - guildInfo: null, - sender: { id: "U1", name: "Alice", tag: "alice" }, - isGuild: false, - }); - - return finalizeInboundContext({ - Body: "hi", - BodyForAgent: "hi", - RawBody: "hi", - CommandBody: "hi", - From: "discord:U1", - To: "user:U1", - SessionKey: "agent:main:discord:direct:u1", - AccountId: "default", - ChatType: "direct", - ConversationLabel: "Alice", - SenderName: "Alice", - SenderId: "U1", - SenderUsername: "alice", - GroupSystemPrompt: groupSystemPrompt, - OwnerAllowFrom: ownerAllowFrom, - ChannelStructuredContext: channelStructuredContext, - Provider: "discord", - Surface: "discord", - WasMentioned: false, - MessageSid: "m1", - CommandAuthorized: true, - OriginatingChannel: "discord", - OriginatingTo: "user:U1", - }); -} diff --git a/extensions/discord/test-api.ts b/extensions/discord/test-api.ts index 9b17e332d648..d00434289dd7 100644 --- a/extensions/discord/test-api.ts +++ b/extensions/discord/test-api.ts @@ -1,6 +1,2 @@ -// Discord API module exposes the plugin public contract. -export { discordPlugin } from "./src/channel.js"; -export { buildFinalizedDiscordDirectInboundContext } from "./src/monitor/inbound-context.test-helpers.js"; +// Discord test API exposes the gateway lifecycle fixture. export { testing as discordGatewayLifecycleTesting } from "./src/monitor/provider.lifecycle.js"; -export { testing as discordThreadBindingTesting } from "./src/monitor/thread-bindings.manager.js"; -export { discordOutbound } from "./src/outbound-adapter.js"; diff --git a/extensions/minimax/test-api.ts b/extensions/minimax/test-api.ts index b7fb15730861..633b80d8d3a4 100644 --- a/extensions/minimax/test-api.ts +++ b/extensions/minimax/test-api.ts @@ -1,12 +1,2 @@ -// Minimax API module exposes the plugin public contract. -export { - buildMinimaxImageGenerationProvider, - buildMinimaxPortalImageGenerationProvider, -} from "./image-generation-provider.js"; -export { buildMinimaxMusicGenerationProvider } from "./music-generation-provider.js"; -export { - minimaxMediaUnderstandingProvider, - minimaxPortalMediaUnderstandingProvider, -} from "./media-understanding-provider.js"; +// MiniMax test API exposes the web-search fixture. export { testing as minimaxWebSearchTesting } from "./src/minimax-web-search-provider.runtime.js"; -export { buildMinimaxVideoGenerationProvider } from "./video-generation-provider.js"; diff --git a/extensions/moonshot/test-api.ts b/extensions/moonshot/test-api.ts index a0313698dac8..df19fc235927 100644 --- a/extensions/moonshot/test-api.ts +++ b/extensions/moonshot/test-api.ts @@ -1,3 +1,2 @@ -// Moonshot API module exposes the plugin public contract. +// Moonshot test API exposes the web-search fixture. export { testing } from "./src/kimi-web-search-provider.runtime.js"; -export { moonshotMediaUnderstandingProvider } from "./media-understanding-provider.js"; diff --git a/extensions/signal/src/inbound-context.contract.test.ts b/extensions/signal/src/inbound-context.contract.test.ts deleted file mode 100644 index 984b06224120..000000000000 --- a/extensions/signal/src/inbound-context.contract.test.ts +++ /dev/null @@ -1,33 +0,0 @@ -// Signal tests cover inbound context.contract plugin behavior. -import { expectChannelInboundContextContract } from "openclaw/plugin-sdk/channel-contract-testing"; -import { finalizeInboundContext } from "openclaw/plugin-sdk/reply-runtime"; -import { describe, it } from "vitest"; - -describe("Signal inbound context contract", () => { - it("keeps inbound context finalized", () => { - const ctx = finalizeInboundContext({ - Body: "Alice: hi", - BodyForAgent: "hi", - RawBody: "hi", - CommandBody: "hi", - BodyForCommands: "hi", - From: "group:g1", - To: "group:g1", - SessionKey: "agent:main:signal:group:g1", - AccountId: "default", - ChatType: "group", - ConversationLabel: "Alice", - GroupSubject: "Test Group", - SenderName: "Alice", - SenderId: "+15550001111", - Provider: "signal", - Surface: "signal", - MessageSid: "1700000000000", - OriginatingChannel: "signal", - OriginatingTo: "group:g1", - CommandAuthorized: true, - }); - - expectChannelInboundContextContract(ctx); - }); -}); diff --git a/extensions/slack/inbound-contract-test-api.ts b/extensions/slack/inbound-contract-test-api.ts deleted file mode 100644 index 10cc22319a97..000000000000 --- a/extensions/slack/inbound-contract-test-api.ts +++ /dev/null @@ -1,3 +0,0 @@ -// Slack API module exposes the plugin public contract. -export { prepareSlackMessage } from "./src/monitor/message-handler/prepare.js"; -export { createInboundSlackTestContext } from "./src/monitor/message-handler/prepare.test-helpers.js"; diff --git a/extensions/slack/src/inbound-context.contract.test.ts b/extensions/slack/src/inbound-context.contract.test.ts deleted file mode 100644 index 1dbe35dbc725..000000000000 --- a/extensions/slack/src/inbound-context.contract.test.ts +++ /dev/null @@ -1,66 +0,0 @@ -// Slack tests cover inbound context.contract plugin behavior. -import { expectChannelInboundContextContract } from "openclaw/plugin-sdk/channel-contract-testing"; -import type { OpenClawConfig } from "openclaw/plugin-sdk/config-contracts"; -import { createTempHomeEnv } from "openclaw/plugin-sdk/test-env"; -import { describe, it } from "vitest"; -import { - createInboundSlackTestContext, - prepareSlackMessage, -} from "../inbound-contract-test-api.js"; -import type { ResolvedSlackAccount } from "./accounts.js"; -import type { SlackMessageEvent } from "./types.js"; - -function createSlackAccount(config: ResolvedSlackAccount["config"] = {}): ResolvedSlackAccount { - return { - accountId: "default", - enabled: true, - identity: "bot", - botTokenSource: "config", - appTokenSource: "config", - userTokenSource: "none", - config, - replyToMode: config.replyToMode, - replyToModeByChatType: config.replyToModeByChatType, - dm: config.dm, - } as ResolvedSlackAccount; -} - -function createSlackMessage(overrides: Partial): SlackMessageEvent { - return { - type: "message", - channel: "D123", - channel_type: "im", - user: "U1", - text: "hi", - ts: "1.000", - ...overrides, - }; -} - -describe("Slack inbound context contract", () => { - it("keeps inbound context finalized", async () => { - const tempHome = await createTempHomeEnv("openclaw-slack-inbound-contract-"); - try { - const ctx = createInboundSlackTestContext({ - cfg: { - channels: { slack: { enabled: true } }, - } as OpenClawConfig, - }); - ctx.resolveUserName = async () => ({ name: "Alice" }) as never; - - const prepared = await prepareSlackMessage({ - ctx, - account: createSlackAccount(), - message: createSlackMessage({}), - opts: { source: "message" }, - }); - - if (!prepared) { - throw new Error("expected slack message to prepare an inbound context payload"); - } - expectChannelInboundContextContract(prepared.ctxPayload); - } finally { - await tempHome.restore(); - } - }); -}); diff --git a/extensions/slack/test-api.ts b/extensions/slack/test-api.ts index 254721c55658..da630ce02d41 100644 --- a/extensions/slack/test-api.ts +++ b/extensions/slack/test-api.ts @@ -1,11 +1,3 @@ -// Slack API module exposes the plugin public contract. -export type { ResolvedSlackAccount } from "./src/accounts.js"; -export type { SlackMessageEvent } from "./src/types.js"; -export { slackPlugin } from "./src/channel.js"; -export { setSlackRuntime } from "./src/runtime.js"; -export { createSlackActions } from "./src/channel-actions.js"; +// Slack test API exposes outbound payload fixtures. export { createSlackOutboundPayloadHarness } from "./src/outbound-payload.test-harness.js"; -export { prepareSlackMessage } from "./src/monitor/message-handler/prepare.js"; -export { createInboundSlackTestContext } from "./src/monitor/message-handler/prepare.test-helpers.js"; export { slackOutbound } from "./src/outbound-adapter.js"; -export { sendMessageSlack } from "./src/send.js"; diff --git a/extensions/telegram/src/bot-native-commands.skills-allowlist.test.ts b/extensions/telegram/src/bot-native-commands.skills-allowlist.test.ts index c85981e896c7..ba09cec9e890 100644 --- a/extensions/telegram/src/bot-native-commands.skills-allowlist.test.ts +++ b/extensions/telegram/src/bot-native-commands.skills-allowlist.test.ts @@ -8,6 +8,7 @@ import { } from "openclaw/plugin-sdk/channel-test-helpers"; import type { OpenClawConfig } from "openclaw/plugin-sdk/config-contracts"; import { listSkillCommandsForAgents as listActualSkillCommandsForAgents } from "openclaw/plugin-sdk/skill-commands-runtime"; +import { writeSkill } from "openclaw/plugin-sdk/test-fixtures"; import { afterEach, describe, expect, it, vi } from "vitest"; import { registerTelegramNativeCommands } from "./bot-native-commands.js"; import { @@ -15,7 +16,6 @@ import { listSkillCommandsForAgents, resetNativeCommandMenuMocks, } from "./bot-native-commands.menu-test-support.js"; -import { writeSkill } from "./test-support/write-skill.js"; const tempDirs: string[] = []; diff --git a/extensions/telegram/src/bot.test.ts b/extensions/telegram/src/bot.test.ts index 8426e9b224b2..432baa26ee25 100644 --- a/extensions/telegram/src/bot.test.ts +++ b/extensions/telegram/src/bot.test.ts @@ -467,7 +467,7 @@ async function loadEnvelopeTimestampHelpers() { } async function loadInboundContextContract() { - return await import("./test-support/inbound-context-contract.js"); + return await import("openclaw/plugin-sdk/channel-contract-testing"); } type MockCallSource = { diff --git a/extensions/telegram/src/inbound-context.contract.test.ts b/extensions/telegram/src/inbound-context.contract.test.ts deleted file mode 100644 index c6f0b4fb64c6..000000000000 --- a/extensions/telegram/src/inbound-context.contract.test.ts +++ /dev/null @@ -1,43 +0,0 @@ -// Telegram tests cover inbound context.contract plugin behavior. -import { expectChannelInboundContextContract } from "openclaw/plugin-sdk/channel-contract-testing"; -import type { OpenClawConfig } from "openclaw/plugin-sdk/config-contracts"; -import { describe, it } from "vitest"; -import { buildTelegramMessageContextForTest } from "./bot-message-context.test-harness.js"; - -describe("Telegram inbound context contract", () => { - it("keeps inbound context finalized", async () => { - const context = await buildTelegramMessageContextForTest({ - cfg: { - agents: { - defaults: { - envelopeTimezone: "utc", - }, - }, - channels: { - telegram: { - groupPolicy: "open", - groups: { "*": { requireMention: false } }, - }, - }, - } satisfies OpenClawConfig, - message: { - chat: { id: 42, type: "group", title: "Ops" }, - text: "hello", - date: 1_736_380_800, - message_id: 2, - from: { - id: 99, - first_name: "Ada", - last_name: "Lovelace", - username: "ada", - }, - }, - }); - - const payload = context?.ctxPayload; - if (!payload) { - throw new Error("expected telegram inbound payload"); - } - expectChannelInboundContextContract(payload); - }); -}); diff --git a/extensions/telegram/src/test-support/inbound-context-contract.ts b/extensions/telegram/src/test-support/inbound-context-contract.ts deleted file mode 100644 index d1005d90a062..000000000000 --- a/extensions/telegram/src/test-support/inbound-context-contract.ts +++ /dev/null @@ -1,2 +0,0 @@ -// Telegram plugin module implements inbound context contract behavior. -export { expectChannelInboundContextContract } from "openclaw/plugin-sdk/channel-contract-testing"; diff --git a/extensions/telegram/src/test-support/write-skill.ts b/extensions/telegram/src/test-support/write-skill.ts deleted file mode 100644 index 153284ea8bec..000000000000 --- a/extensions/telegram/src/test-support/write-skill.ts +++ /dev/null @@ -1,2 +0,0 @@ -// Telegram plugin module implements write skill behavior. -export { writeSkill } from "openclaw/plugin-sdk/test-fixtures"; diff --git a/extensions/whatsapp/src/inbound-context.contract.test.ts b/extensions/whatsapp/src/inbound-context.contract.test.ts deleted file mode 100644 index cbd651b0f518..000000000000 --- a/extensions/whatsapp/src/inbound-context.contract.test.ts +++ /dev/null @@ -1,33 +0,0 @@ -// Whatsapp tests cover inbound context.contract plugin behavior. -import { expectChannelInboundContextContract } from "openclaw/plugin-sdk/channel-contract-testing"; -import { describe, it } from "vitest"; - -describe("WhatsApp inbound context contract", () => { - it("keeps inbound context finalized", () => { - const ctx = { - Body: "Alice: hi", - BodyForAgent: "hi", - RawBody: "hi", - CommandBody: "hi", - BodyForCommands: "hi", - From: "123@g.us", - To: "+15550001111", - SessionKey: "agent:main:whatsapp:group:123", - AccountId: "default", - ChatType: "group", - ConversationLabel: "123@g.us", - GroupSubject: "Test Group", - SenderName: "Alice", - SenderId: "alice@s.whatsapp.net", - SenderE164: "+15550002222", - Provider: "whatsapp", - Surface: "whatsapp", - MessageSid: "msg1", - OriginatingChannel: "whatsapp", - OriginatingTo: "123@g.us", - CommandAuthorized: true, - }; - - expectChannelInboundContextContract(ctx); - }); -});