





















@@ -202,6 +202,7 @@ describe("irc inbound behavior", () => {
202202203203it("uses channel:# prefix for group channel From and OriginatingTo fields", async () => {
204204const coreRuntime = createPluginRuntimeMock();
205+const runtime = createRuntimeEnv();
205206setIrcRuntime(coreRuntime as never);
206207207208await handleIrcInbound({
@@ -217,22 +218,28 @@ describe("irc inbound behavior", () => {
217218config: {
218219dmPolicy: "open",
219220allowFrom: ["*"],
220-groupPolicy: "allowlist",
221+groupPolicy: "open",
221222groupAllowFrom: [],
222223groups: {
223-"#ops": { enabled: true },
224+"#ops": { enabled: true, requireMention: false },
224225},
225226},
226227}),
227-config: { channels: { rc: {} } } as CoreConfig,
228-runtime: createRuntimeEnv(),
228+config: { channels: { irc: {} } } as CoreConfig,
229+ runtime,
229230sendReply: vi.fn(async () => {}),
230231});
231232232-const assembledRequest = (
233-coreRuntime.channel.turn.runAssembled as unknown as { mock: { calls: unknown[][] } }
234-).mock.calls[0]?.[0] as { ctxPayload?: Record<string, unknown> } | undefined;
235-const ctx = assembledRequest?.ctxPayload as Record<string, unknown> | undefined;
233+const ctx = (
234+coreRuntime.channel.reply.finalizeInboundContext as unknown as {
235+mock: { calls: unknown[][] };
236+}
237+).mock.calls[0]?.[0] as Record<string, unknown> | undefined;
238+expect(
239+(coreRuntime.channel.turn.runAssembled as unknown as { mock: { calls: unknown[][] } }).mock
240+.calls.length,
241+).toBe(1);
242+expect(runtime.log).not.toHaveBeenCalled();
236243expect(ctx?.From).toBe("channel:#ops");
237244expect(ctx?.OriginatingTo).toBe("channel:#ops");
238245});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。