




















@@ -1,8 +1,6 @@
1-import { afterEach, describe, expect, it, vi } from "vitest";
1+import { describe, expect, it } from "vitest";
22import { normalizeChatType } from "./chat-type.js";
334-const readLazyString = (value: unknown): string => String(value);
5-64describe("normalizeChatType", () => {
75it.each([
86{ name: "normalizes direct", value: "direct", expected: "direct" },
@@ -28,43 +26,3 @@ describe("normalizeChatType", () => {
2826});
2927});
3028});
31-32-describe("WA_WEB_AUTH_DIR", () => {
33-afterEach(() => {
34-vi.doUnmock("../plugins/runtime/runtime-web-channel-plugin.js");
35-});
36-37-it("resolves lazily and caches across the legacy and channels/web entrypoints", async () => {
38-const resolveWebChannelAuthDir = vi.fn(() => "/tmp/openclaw-whatsapp-auth");
39-40-vi.resetModules();
41-vi.doMock("../plugins/runtime/runtime-web-channel-plugin.js", () => ({
42-createWebChannelSocket: vi.fn(),
43-extractMediaPlaceholder: vi.fn(),
44-extractText: vi.fn(),
45-formatError: vi.fn(),
46-getStatusCode: vi.fn(),
47-logWebSelfId: vi.fn(),
48-loginWeb: vi.fn(),
49-logoutWeb: vi.fn(),
50-monitorWebChannel: vi.fn(),
51-monitorWebInbox: vi.fn(),
52-pickWebChannel: vi.fn(),
53-resolveHeartbeatRecipients: vi.fn(),
54- resolveWebChannelAuthDir,
55-runWebHeartbeatOnce: vi.fn(),
56-sendWebChannelMessage: vi.fn(),
57-sendWebChannelReaction: vi.fn(),
58-waitForWebChannelConnection: vi.fn(),
59-webAuthExists: vi.fn(),
60-}));
61-62-const channelWeb = await import("../channel-web.js");
63-const webEntry = await import("./web/index.js");
64-65-expect(resolveWebChannelAuthDir).not.toHaveBeenCalled();
66-expect(readLazyString(channelWeb.WA_WEB_AUTH_DIR)).toBe("/tmp/openclaw-whatsapp-auth");
67-expect(readLazyString(webEntry.WA_WEB_AUTH_DIR)).toBe("/tmp/openclaw-whatsapp-auth");
68-expect(resolveWebChannelAuthDir).toHaveBeenCalledTimes(1);
69-});
70-});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。