Files
openclaw/src/web/auto-reply.broadcast-groups.skips-unknown-broadcast-agent-ids-agents-list.test.ts

36 lines
1.1 KiB
TypeScript

import "./test-helpers.js";
import { describe, expect, it } from "vitest";
import type { OpenClawConfig } from "../config/config.js";
import { sendWebDirectInboundAndCollectSessionKeys } from "./auto-reply.broadcast-groups.test-harness.js";
import {
installWebAutoReplyTestHomeHooks,
installWebAutoReplyUnitTestHooks,
resetLoadConfigMock,
setLoadConfigMock,
} from "./auto-reply.test-harness.js";
installWebAutoReplyTestHomeHooks();
describe("broadcast groups", () => {
installWebAutoReplyUnitTestHooks();
it("skips unknown broadcast agent ids when agents.list is present", async () => {
setLoadConfigMock({
channels: { whatsapp: { allowFrom: ["*"] } },
agents: {
defaults: { maxConcurrent: 10 },
list: [{ id: "alfred" }],
},
broadcast: {
"+1000": ["alfred", "missing"],
},
} satisfies OpenClawConfig);
const { seen, resolver } = await sendWebDirectInboundAndCollectSessionKeys();
expect(resolver).toHaveBeenCalledTimes(1);
expect(seen[0]).toContain("agent:alfred:");
resetLoadConfigMock();
});
});