




















@@ -1,27 +1,6 @@
1-import { beforeEach, describe, expect, it, vi } from "vitest";
1+import { describe, expect, it } from "vitest";
22import type { OpenClawConfig } from "../../config/types.openclaw.js";
3-4-const loggerMocks = vi.hoisted(() => ({
5-warn: vi.fn(),
6-}));
7-8-vi.mock("../../logging/subsystem.js", () => ({
9-createSubsystemLogger: () => ({
10-subsystem: "auto-reply",
11-isEnabled: () => false,
12-trace: vi.fn(),
13-debug: vi.fn(),
14-info: vi.fn(),
15-warn: loggerMocks.warn,
16-error: vi.fn(),
17-fatal: vi.fn(),
18-raw: vi.fn(),
19-child: vi.fn(),
20-}),
21-}));
22-233import {
24-resetVisibleRepliesPrivateDefaultWarningForTest,
254resolveSourceReplyDeliveryMode,
265resolveSourceReplyVisibilityPolicy,
276} from "./source-reply-delivery-mode.js";
@@ -40,11 +19,6 @@ const globalToolOnlyReplyConfig = {
4019},
4120} as const satisfies OpenClawConfig;
422143-beforeEach(() => {
44-loggerMocks.warn.mockClear();
45-resetVisibleRepliesPrivateDefaultWarningForTest();
46-});
47-4822describe("resolveSourceReplyDeliveryMode", () => {
4923it("defaults groups and channels to message-tool-only delivery", () => {
5024expect(resolveSourceReplyDeliveryMode({ cfg: emptyConfig, ctx: { ChatType: "channel" } })).toBe(
@@ -56,10 +30,6 @@ describe("resolveSourceReplyDeliveryMode", () => {
5630expect(resolveSourceReplyDeliveryMode({ cfg: emptyConfig, ctx: { ChatType: "direct" } })).toBe(
5731"automatic",
5832);
59-expect(loggerMocks.warn).toHaveBeenCalledTimes(1);
60-expect(loggerMocks.warn).toHaveBeenCalledWith(
61-expect.stringContaining("Group/channel replies are private by default"),
62-);
6333});
64346535it("honors config and explicit requested mode", () => {
@@ -107,7 +77,6 @@ describe("resolveSourceReplyDeliveryMode", () => {
10777ctx: { ChatType: "group", CommandSource: "native" },
10878}),
10979).toBe("automatic");
110-expect(loggerMocks.warn).not.toHaveBeenCalled();
11180});
1128111382it("falls back to automatic when message tool is unavailable", () => {
@@ -133,7 +102,6 @@ describe("resolveSourceReplyDeliveryMode", () => {
133102messageToolAvailable: false,
134103}),
135104).toBe("automatic");
136-expect(loggerMocks.warn).not.toHaveBeenCalled();
137105});
138106139107it("keeps message-tool-only delivery when message tool availability is unknown", () => {
@@ -150,7 +118,6 @@ describe("resolveSourceReplyDeliveryMode", () => {
150118ctx: { ChatType: "channel" },
151119}),
152120).toBe("message_tool_only");
153-expect(loggerMocks.warn).toHaveBeenCalledTimes(1);
154121});
155122});
156123@@ -294,7 +261,6 @@ describe("resolveSourceReplyVisibilityPolicy", () => {
294261suppressTyping: false,
295262});
296263});
297-298264it("keeps delivery automatic when message-tool-only mode cannot send visibly", () => {
299265expect(
300266resolveSourceReplyVisibilityPolicy({
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。