Files
openclaw/extensions/irc/src/channel.test.ts
Ayaan Zaidi 2c8ed54ddb feat(heartbeat): default delivery to the configured owner, never groups (#121988)
Unset heartbeat.target now resolves "owner": elected heartbeat notifications deliver to the operator's DM resolved from commands.ownerAllowFrom or the channel allowFrom (first concrete entry; wildcards and channel-scoped wildcards excluded; configured owners exhausted across channels before any channel-local fallback). Delivery requires the channel's own classifier to positively prove a direct destination — every bundled messaging plugin now ships an inferTargetChatType contract — and unproven or group-shaped destinations fail closed to the visible no-route state. The first implicitly-routed delivery carries a one-line self-explanation naming the target: "none" opt-out. Explicit target "last" remains as the follow-the-conversation opt-in. Refines the unreleased #121892 default before it ships; refs #121880.

Co-authored-by: Ayaan Zaidi <hi@obviy.us>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-11 13:18:22 +00:00

21 lines
898 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);
});
});
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");
});
});