mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-27 00:52:05 +00:00
refactor: move extension-owned tests to extensions
This commit is contained in:
@@ -4,11 +4,11 @@ import { createChannelTestPluginBase, createOutboundTestPlugin } from "./channel
|
||||
describe("createChannelTestPluginBase", () => {
|
||||
it("builds a plugin base with defaults", () => {
|
||||
const cfg = {} as never;
|
||||
const base = createChannelTestPluginBase({ id: "telegram", label: "Telegram" });
|
||||
expect(base.id).toBe("telegram");
|
||||
expect(base.meta.label).toBe("Telegram");
|
||||
expect(base.meta.selectionLabel).toBe("Telegram");
|
||||
expect(base.meta.docsPath).toBe("/channels/telegram");
|
||||
const base = createChannelTestPluginBase({ id: "demo-channel", label: "Demo Channel" });
|
||||
expect(base.id).toBe("demo-channel");
|
||||
expect(base.meta.label).toBe("Demo Channel");
|
||||
expect(base.meta.selectionLabel).toBe("Demo Channel");
|
||||
expect(base.meta.docsPath).toBe("/channels/demo-channel");
|
||||
expect(base.capabilities.chatTypes).toEqual(["direct"]);
|
||||
expect(base.config.listAccountIds(cfg)).toEqual(["default"]);
|
||||
expect(base.config.resolveAccount(cfg)).toEqual({});
|
||||
@@ -17,16 +17,16 @@ describe("createChannelTestPluginBase", () => {
|
||||
it("honors config and metadata overrides", async () => {
|
||||
const cfg = {} as never;
|
||||
const base = createChannelTestPluginBase({
|
||||
id: "discord",
|
||||
label: "Discord Bot",
|
||||
docsPath: "/custom/discord",
|
||||
id: "demo-chat",
|
||||
label: "Demo Chat",
|
||||
docsPath: "/custom/demo-chat",
|
||||
capabilities: { chatTypes: ["group"] },
|
||||
config: {
|
||||
listAccountIds: () => ["acct-1"],
|
||||
isConfigured: async () => true,
|
||||
},
|
||||
});
|
||||
expect(base.meta.docsPath).toBe("/custom/discord");
|
||||
expect(base.meta.docsPath).toBe("/custom/demo-chat");
|
||||
expect(base.capabilities.chatTypes).toEqual(["group"]);
|
||||
expect(base.config.listAccountIds(cfg)).toEqual(["acct-1"]);
|
||||
const account = base.config.resolveAccount(cfg);
|
||||
@@ -38,11 +38,11 @@ describe("createOutboundTestPlugin", () => {
|
||||
it("keeps outbound test plugin account list behavior", () => {
|
||||
const cfg = {} as never;
|
||||
const plugin = createOutboundTestPlugin({
|
||||
id: "signal",
|
||||
id: "demo-outbound",
|
||||
outbound: {
|
||||
deliveryMode: "direct",
|
||||
resolveTarget: () => ({ ok: true, to: "target" }),
|
||||
sendText: async () => ({ channel: "signal", messageId: "m1" }),
|
||||
sendText: async () => ({ channel: "demo-outbound", messageId: "m1" }),
|
||||
},
|
||||
});
|
||||
expect(plugin.config.listAccountIds(cfg)).toEqual([]);
|
||||
|
||||
Reference in New Issue
Block a user