import type { BotConfig, PluginRuntime } from "@hanzo/bot/plugin-sdk/discord"; import { describe, expect, it, vi } from "vitest"; import { discordPlugin } from "./channel.js"; import { setDiscordRuntime } from "./runtime.js"; describe("discordPlugin outbound", () => { it("forwards mediaLocalRoots to sendMessageDiscord", async () => { const sendMessageDiscord = vi.fn(async () => ({ messageId: "m1" })); setDiscordRuntime({ channel: { discord: { sendMessageDiscord, }, }, } as unknown as PluginRuntime); const result = await discordPlugin.outbound!.sendMedia!({ cfg: {} as BotConfig, to: "channel:123", text: "hi", mediaUrl: "/tmp/image.png", mediaLocalRoots: ["/tmp/agent-root"], accountId: "work", }); expect(sendMessageDiscord).toHaveBeenCalledWith( "channel:123", "hi", expect.objectContaining({ mediaUrl: "/tmp/image.png", mediaLocalRoots: ["/tmp/agent-root"], }), ); expect(result).toMatchObject({ channel: "discord", messageId: "m1" }); }); });