mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
test(plugins): remove stale test plumbing (#122175)
This commit is contained in:
committed by
GitHub
parent
0e52f4c4ce
commit
86bc5aa726
@@ -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", () => {
|
it("publishes the exact Claude Sonnet 5 API contract", () => {
|
||||||
const models = manifest.modelCatalog?.providers?.anthropic?.models ?? [];
|
const models = manifest.modelCatalog?.providers?.anthropic?.models ?? [];
|
||||||
expect(models.find((model) => model.id === "claude-sonnet-5")).toEqual({
|
expect(models.find((model) => model.id === "claude-sonnet-5")).toEqual({
|
||||||
|
|||||||
@@ -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);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -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",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,2 @@
|
|||||||
// Discord API module exposes the plugin public contract.
|
// Discord test API exposes the gateway lifecycle fixture.
|
||||||
export { discordPlugin } from "./src/channel.js";
|
|
||||||
export { buildFinalizedDiscordDirectInboundContext } from "./src/monitor/inbound-context.test-helpers.js";
|
|
||||||
export { testing as discordGatewayLifecycleTesting } from "./src/monitor/provider.lifecycle.js";
|
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";
|
|
||||||
|
|||||||
@@ -1,12 +1,2 @@
|
|||||||
// Minimax API module exposes the plugin public contract.
|
// MiniMax test API exposes the web-search fixture.
|
||||||
export {
|
|
||||||
buildMinimaxImageGenerationProvider,
|
|
||||||
buildMinimaxPortalImageGenerationProvider,
|
|
||||||
} from "./image-generation-provider.js";
|
|
||||||
export { buildMinimaxMusicGenerationProvider } from "./music-generation-provider.js";
|
|
||||||
export {
|
|
||||||
minimaxMediaUnderstandingProvider,
|
|
||||||
minimaxPortalMediaUnderstandingProvider,
|
|
||||||
} from "./media-understanding-provider.js";
|
|
||||||
export { testing as minimaxWebSearchTesting } from "./src/minimax-web-search-provider.runtime.js";
|
export { testing as minimaxWebSearchTesting } from "./src/minimax-web-search-provider.runtime.js";
|
||||||
export { buildMinimaxVideoGenerationProvider } from "./video-generation-provider.js";
|
|
||||||
|
|||||||
@@ -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 { testing } from "./src/kimi-web-search-provider.runtime.js";
|
||||||
export { moonshotMediaUnderstandingProvider } from "./media-understanding-provider.js";
|
|
||||||
|
|||||||
@@ -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);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -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";
|
|
||||||
@@ -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>): 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();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,11 +1,3 @@
|
|||||||
// Slack API module exposes the plugin public contract.
|
// Slack test API exposes outbound payload fixtures.
|
||||||
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";
|
|
||||||
export { createSlackOutboundPayloadHarness } from "./src/outbound-payload.test-harness.js";
|
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 { slackOutbound } from "./src/outbound-adapter.js";
|
||||||
export { sendMessageSlack } from "./src/send.js";
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import {
|
|||||||
} from "openclaw/plugin-sdk/channel-test-helpers";
|
} from "openclaw/plugin-sdk/channel-test-helpers";
|
||||||
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-contracts";
|
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-contracts";
|
||||||
import { listSkillCommandsForAgents as listActualSkillCommandsForAgents } from "openclaw/plugin-sdk/skill-commands-runtime";
|
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 { afterEach, describe, expect, it, vi } from "vitest";
|
||||||
import { registerTelegramNativeCommands } from "./bot-native-commands.js";
|
import { registerTelegramNativeCommands } from "./bot-native-commands.js";
|
||||||
import {
|
import {
|
||||||
@@ -15,7 +16,6 @@ import {
|
|||||||
listSkillCommandsForAgents,
|
listSkillCommandsForAgents,
|
||||||
resetNativeCommandMenuMocks,
|
resetNativeCommandMenuMocks,
|
||||||
} from "./bot-native-commands.menu-test-support.js";
|
} from "./bot-native-commands.menu-test-support.js";
|
||||||
import { writeSkill } from "./test-support/write-skill.js";
|
|
||||||
|
|
||||||
const tempDirs: string[] = [];
|
const tempDirs: string[] = [];
|
||||||
|
|
||||||
|
|||||||
@@ -467,7 +467,7 @@ async function loadEnvelopeTimestampHelpers() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function loadInboundContextContract() {
|
async function loadInboundContextContract() {
|
||||||
return await import("./test-support/inbound-context-contract.js");
|
return await import("openclaw/plugin-sdk/channel-contract-testing");
|
||||||
}
|
}
|
||||||
|
|
||||||
type MockCallSource = {
|
type MockCallSource = {
|
||||||
|
|||||||
@@ -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);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
// Telegram plugin module implements inbound context contract behavior.
|
|
||||||
export { expectChannelInboundContextContract } from "openclaw/plugin-sdk/channel-contract-testing";
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
// Telegram plugin module implements write skill behavior.
|
|
||||||
export { writeSkill } from "openclaw/plugin-sdk/test-fixtures";
|
|
||||||
@@ -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);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user