refactor(channels): dedupe transport and gateway test scaffolds

This commit is contained in:
Peter Steinberger
2026-02-16 14:52:15 +00:00
parent f717a13039
commit 93ca0ed54f
95 changed files with 4068 additions and 5221 deletions

View File

@@ -1,12 +1,14 @@
import "./test-helpers.js";
import { describe, expect, it, vi } from "vitest";
import type { OpenClawConfig } from "../config/config.js";
import { monitorWebChannelWithCapture } from "./auto-reply.broadcast-groups.test-harness.js";
import {
monitorWebChannelWithCapture,
sendWebDirectInboundAndCollectSessionKeys,
} from "./auto-reply.broadcast-groups.test-harness.js";
import {
installWebAutoReplyTestHomeHooks,
installWebAutoReplyUnitTestHooks,
resetLoadConfigMock,
sendWebDirectInboundMessage,
sendWebGroupInboundMessage,
setLoadConfigMock,
} from "./auto-reply.test-harness.js";
@@ -29,22 +31,7 @@ describe("broadcast groups", () => {
},
} satisfies OpenClawConfig);
const seen: string[] = [];
const resolver = vi.fn(async (ctx: { SessionKey?: unknown }) => {
seen.push(String(ctx.SessionKey));
return { text: "ok" };
});
const { spies, onMessage } = await monitorWebChannelWithCapture(resolver);
await sendWebDirectInboundMessage({
onMessage,
spies,
id: "m1",
from: "+1000",
to: "+2000",
body: "hello",
});
const { seen, resolver } = await sendWebDirectInboundAndCollectSessionKeys();
expect(resolver).toHaveBeenCalledTimes(2);
expect(seen[0]).toContain("agent:alfred:");