





















@@ -29,6 +29,7 @@ const hoisted = vi.hoisted(() => ({
2929detectWhatsAppLinked: vi.fn<(cfg: OpenClawConfig, accountId: string) => Promise<boolean>>(
3030async () => false,
3131),
32+hasWebCredsSync: vi.fn(() => false),
3233loginWeb: vi.fn(async () => {}),
3334pathExists: vi.fn(async () => false),
3435readWebAuthState: vi.fn<(authDir: string) => Promise<"linked" | "not-linked" | "unstable">>(
@@ -53,6 +54,14 @@ vi.mock("./setup-finalize.js", async () => {
5354};
5455});
555657+vi.mock("./creds-files.js", async () => {
58+const actual = await vi.importActual<typeof import("./creds-files.js")>("./creds-files.js");
59+return {
60+ ...actual,
61+hasWebCredsSync: hoisted.hasWebCredsSync,
62+};
63+});
64+5665vi.mock("openclaw/plugin-sdk/setup", async () => {
5766const actual = await vi.importActual<typeof import("openclaw/plugin-sdk/setup")>(
5867"openclaw/plugin-sdk/setup",
@@ -142,6 +151,8 @@ describe("whatsapp setup wizard", () => {
142151beforeEach(() => {
143152hoisted.detectWhatsAppLinked.mockReset();
144153hoisted.detectWhatsAppLinked.mockResolvedValue(false);
154+hoisted.hasWebCredsSync.mockReset();
155+hoisted.hasWebCredsSync.mockReturnValue(false);
145156hoisted.loginWeb.mockReset();
146157hoisted.pathExists.mockReset();
147158hoisted.pathExists.mockResolvedValue(false);
@@ -338,7 +349,7 @@ describe("whatsapp setup wizard", () => {
338349});
339350340351it("skips relink note when already linked and relink is declined", async () => {
341-hoisted.pathExists.mockResolvedValue(true);
352+hoisted.hasWebCredsSync.mockReturnValue(true);
342353const harness = createSeparatePhoneHarness({
343354selectValues: ["separate", "disabled"],
344355});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。