mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-26 12:26:38 -06:00
c34b97f0c6
* perf(irc): reuse transient connection across chunks Amp-Thread-ID: https://ampcode.com/threads/T-01a02f9f-3359-7327-bff0-6a4f85f666b7 * fix(irc): honor cancellation during connect * fix(irc): stop chunk fanout after disconnect --------- Co-authored-by: Amp <amp@ampcode.com>
22 lines
972 B
TypeScript
22 lines
972 B
TypeScript
// Irc tests cover channel plugin behavior.
|
|
import { describe, expect, it } from "vitest";
|
|
import { ircPlugin } from "./channel.js";
|
|
import { ircOutboundBaseAdapter } from "./outbound-base.js";
|
|
|
|
describe("irc outbound chunking", () => {
|
|
it("chunks outbound text without requiring IRC runtime initialization", () => {
|
|
expect(ircOutboundBaseAdapter.chunker("alpha beta", 5)).toEqual(["alpha", "beta"]);
|
|
expect(ircOutboundBaseAdapter.deliveryMode).toBe("direct");
|
|
expect(ircOutboundBaseAdapter.chunkerMode).toBe("markdown");
|
|
expect(ircOutboundBaseAdapter.textChunkLimit).toBe(350);
|
|
expect(ircPlugin.outbound?.sendFormattedText).toBeTypeOf("function");
|
|
});
|
|
});
|
|
|
|
describe("irc target classification", () => {
|
|
it("distinguishes nicknames from channels", () => {
|
|
expect(ircPlugin.messaging?.inferTargetChatType?.({ to: "alice" })).toBe("direct");
|
|
expect(ircPlugin.messaging?.inferTargetChatType?.({ to: "#operators" })).toBe("group");
|
|
});
|
|
});
|