mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-14 11:30:41 +00:00
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>
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { buildIrcNickServCommands } from "./client.js";
|
|
|
|
describe("irc client nickserv", () => {
|
|
it("builds IDENTIFY command when password is set", () => {
|
|
expect(
|
|
buildIrcNickServCommands({
|
|
password: "secret",
|
|
}),
|
|
).toEqual(["PRIVMSG NickServ :IDENTIFY secret"]);
|
|
});
|
|
|
|
it("builds REGISTER command when enabled with email", () => {
|
|
expect(
|
|
buildIrcNickServCommands({
|
|
password: "secret",
|
|
register: true,
|
|
registerEmail: "bot@example.com",
|
|
}),
|
|
).toEqual([
|
|
"PRIVMSG NickServ :IDENTIFY secret",
|
|
"PRIVMSG NickServ :REGISTER secret bot@example.com",
|
|
]);
|
|
});
|
|
|
|
it("rejects register without registerEmail", () => {
|
|
expect(() =>
|
|
buildIrcNickServCommands({
|
|
password: "secret",
|
|
register: true,
|
|
}),
|
|
).toThrow(/registerEmail/);
|
|
});
|
|
|
|
it("sanitizes outbound NickServ payloads", () => {
|
|
expect(
|
|
buildIrcNickServCommands({
|
|
service: "NickServ\n",
|
|
password: "secret\r\nJOIN #bad",
|
|
}),
|
|
).toEqual(["PRIVMSG NickServ :IDENTIFY secret JOIN #bad"]);
|
|
});
|
|
});
|