Files
openclaw/extensions/irc/src/connect-options.test.ts
Peter Steinberger 992948356f fix(secrets): fail closed for configured references (#127669)
* fix(secrets): fail closed for configured references

Keep explicit SecretRefs authoritative across Gateway auth, onboarding, probes, channel credentials, outbound sends, and GitHub Copilot discovery/embeddings. Ambient credentials remain available only when no reference owns the surface.

* test(secrets): align gateway fallback expectations

* test(providers): remove load-sensitive stream timing

* test(xai): normalize stream capture failures

* fix(copilot): preserve direct auth precedence

* test(ollama): keep progressing streams alive

* test(models): mark resolved config fixtures

* fix(models): drop stale probe import
2026-08-21 18:00:28 -07:00

59 lines
1.5 KiB
TypeScript

// Irc tests cover connect options plugin behavior.
import { describe, expect, it } from "vitest";
import { buildIrcConnectOptions } from "./connect-options.js";
describe("buildIrcConnectOptions", () => {
const account = {
accountId: "default",
enabled: true,
configured: true,
host: "irc.libera.chat",
port: 6697,
tls: true,
nick: "openclaw",
username: "openclaw",
realname: "OpenClaw Bot",
password: "server-pass",
passwordSource: "config" as const,
config: {
nickserv: {
enabled: true,
service: "NickServ",
password: "nickserv-pass",
register: true,
registerEmail: "bot@example.com",
},
},
};
it("copies resolved account connection fields and NickServ config", () => {
expect(
buildIrcConnectOptions(account, {
connectTimeoutMs: 1234,
}),
).toEqual({
host: "irc.libera.chat",
port: 6697,
tls: true,
nick: "openclaw",
username: "openclaw",
realname: "OpenClaw Bot",
password: "server-pass",
nickserv: {
enabled: true,
service: "NickServ",
password: "nickserv-pass",
register: true,
registerEmail: "bot@example.com",
},
connectTimeoutMs: 1234,
});
});
it("rejects unavailable credentials before constructing an IRC connection", () => {
expect(() =>
buildIrcConnectOptions({ ...account, password: "", tokenStatus: "configured_unavailable" }),
).toThrow(/configured but unavailable/i);
});
});