refactor: eliminate jscpd clones and boost tests

This commit is contained in:
Peter Steinberger
2026-02-19 14:59:36 +00:00
parent 71983716ff
commit dcd592a601
16 changed files with 408 additions and 235 deletions

View File

@@ -7,11 +7,11 @@ import { whatsappPlugin } from "../../extensions/whatsapp/src/channel.js";
import { BARE_SESSION_RESET_PROMPT } from "../auto-reply/reply/session-reset-prompt.js";
import type { ChannelPlugin } from "../channels/plugins/types.js";
import { emitAgentEvent, registerAgentRunContext } from "../infra/agent-events.js";
import { GATEWAY_CLIENT_MODES, GATEWAY_CLIENT_NAMES } from "../utils/message-channel.js";
import { setRegistry } from "./server.agent.gateway-server-agent.mocks.js";
import { createRegistry } from "./server.e2e-registry-helpers.js";
import {
agentCommand,
connectWebchatClient,
connectOk,
installGatewayTestHooks,
onceMessage,
@@ -367,18 +367,7 @@ describe("gateway server agent", () => {
test("agent events stream to webchat clients when run context is registered", async () => {
await writeMainSessionEntry({ sessionId: "sess-main" });
const webchatWs = new WebSocket(`ws://127.0.0.1:${port}`, {
headers: { origin: `http://127.0.0.1:${port}` },
});
await new Promise<void>((resolve) => webchatWs.once("open", resolve));
await connectOk(webchatWs, {
client: {
id: GATEWAY_CLIENT_NAMES.WEBCHAT,
version: "1.0.0",
platform: "test",
mode: GATEWAY_CLIENT_MODES.WEBCHAT,
},
});
const webchatWs = await connectWebchatClient({ port });
registerAgentRunContext("run-auto-1", { sessionKey: "main" });