





















@@ -2,6 +2,14 @@ import { describe, expect, it, vi } from "vitest";
22import type { OpenClawConfig } from "../config/config.js";
33import { noteMacLaunchctlGatewayEnvOverrides } from "./doctor-platform-notes.js";
445+function requireNoteCall(noteFn: { mock: { calls: unknown[][] } }, index = 0): unknown[] {
6+const call = noteFn.mock.calls.at(index);
7+if (!call) {
8+throw new Error(`expected note call ${index}`);
9+}
10+return call;
11+}
12+513describe("noteMacLaunchctlGatewayEnvOverrides", () => {
614it("prints clear unsetenv instructions for token override", async () => {
715const noteFn = vi.fn();
@@ -21,7 +29,7 @@ describe("noteMacLaunchctlGatewayEnvOverrides", () => {
2129expect(noteFn).toHaveBeenCalledTimes(1);
2230expect(getenv).toHaveBeenCalledTimes(2);
233124-const [message, title] = noteFn.mock.calls[0] ?? [];
32+const [message, title] = requireNoteCall(noteFn);
2533expect(title).toBe("Gateway (macOS)");
2634expect(message).toContain("Host-wide launchctl gateway auth overrides detected");
2735expect(message).toContain("Current managed Gateway installs do not need these values");
@@ -62,7 +70,7 @@ describe("noteMacLaunchctlGatewayEnvOverrides", () => {
6270await noteMacLaunchctlGatewayEnvOverrides(cfg, { platform: "darwin", getenv, noteFn });
63716472expect(noteFn).toHaveBeenCalledTimes(1);
65-const [message] = noteFn.mock.calls[0] ?? [];
73+const [message] = requireNoteCall(noteFn);
6674expect(message).toContain("OPENCLAW_GATEWAY_PASSWORD");
6775});
6876此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。