openclaw/src/channels/registry.test.ts
Vignesh fa906b26ad
feat: IRC — add first-class channel support
Adds IRC as a first-class channel with core config surfaces (schema/hints/dock), plugin auto-enable detection, routing/policy alignment, and docs/tests.

Co-authored-by: Vignesh <vigneshnatarajan92@gmail.com>
2026-02-10 17:33:57 -06:00

41 lines
1.3 KiB
TypeScript

import { describe, expect, it } from "vitest";
import {
formatChannelSelectionLine,
listChatChannels,
normalizeChatChannelId,
} from "./registry.js";
describe("channel registry", () => {
it("normalizes aliases", () => {
expect(normalizeChatChannelId("imsg")).toBe("imessage");
expect(normalizeChatChannelId("gchat")).toBe("googlechat");
expect(normalizeChatChannelId("google-chat")).toBe("googlechat");
expect(normalizeChatChannelId("internet-relay-chat")).toBe("irc");
expect(normalizeChatChannelId("web")).toBeNull();
});
it("keeps Telegram first in the default order", () => {
const channels = listChatChannels();
expect(channels[0]?.id).toBe("telegram");
});
it("does not include MS Teams by default", () => {
const channels = listChatChannels();
expect(channels.some((channel) => channel.id === "msteams")).toBe(false);
});
it("formats selection lines with docs labels", () => {
const channels = listChatChannels();
const first = channels[0];
if (!first) {
throw new Error("Missing channel metadata.");
}
const line = formatChannelSelectionLine(first, (path, label) =>
[label, path].filter(Boolean).join(":"),
);
expect(line).not.toContain("Docs:");
expect(line).toContain("/channels/telegram");
expect(line).toContain("https://openclaw.ai");
});
});