




















@@ -6,6 +6,9 @@ const runtime = vi.hoisted(() => ({
66log: vi.fn<(line: string) => void>(),
77error: vi.fn<(line: string) => void>(),
88}));
9+const resolveControlUiLinksMock = vi.hoisted(() =>
10+vi.fn((_opts?: unknown) => ({ httpUrl: "http://127.0.0.1:18789" })),
11+);
9121013vi.mock("../../runtime.js", () => ({
1114defaultRuntime: runtime,
@@ -21,7 +24,7 @@ vi.mock("../../terminal/theme.js", async () => {
2124});
22252326vi.mock("../../gateway/control-ui-links.js", () => ({
24-resolveControlUiLinks: () => ({ httpUrl: "http://127.0.0.1:18789" }),
27+resolveControlUiLinks: resolveControlUiLinksMock,
2528}));
26292730vi.mock("../../daemon/inspect.js", () => ({
@@ -73,6 +76,7 @@ describe("printDaemonStatus", () => {
7376beforeEach(() => {
7477runtime.log.mockReset();
7578runtime.error.mockReset();
79+resolveControlUiLinksMock.mockClear();
7680});
77817882it("prints stale gateway pid guidance when runtime does not own the listener", () => {
@@ -152,4 +156,56 @@ describe("printDaemonStatus", () => {
152156expect(runtime.log).toHaveBeenCalledWith(expect.stringContaining("Connectivity probe: ok"));
153157expect(runtime.log).toHaveBeenCalledWith(expect.stringContaining("Capability: write-capable"));
154158});
159+160+it("passes daemon TLS state to dashboard link rendering", () => {
161+printDaemonStatus(
162+{
163+service: {
164+label: "LaunchAgent",
165+loaded: true,
166+loadedText: "loaded",
167+notLoadedText: "not loaded",
168+runtime: { status: "running", pid: 8000 },
169+},
170+config: {
171+cli: {
172+path: "/tmp/openclaw-cli/openclaw.json",
173+exists: true,
174+valid: true,
175+},
176+daemon: {
177+path: "/tmp/openclaw-daemon/openclaw.json",
178+exists: true,
179+valid: true,
180+controlUi: { basePath: "/ui" },
181+},
182+mismatch: true,
183+},
184+gateway: {
185+bindMode: "lan",
186+bindHost: "0.0.0.0",
187+port: 19001,
188+portSource: "service args",
189+probeUrl: "wss://127.0.0.1:19001",
190+tlsEnabled: true,
191+},
192+rpc: {
193+ok: true,
194+kind: "connect",
195+capability: "write_capable",
196+url: "wss://127.0.0.1:19001",
197+},
198+extraServices: [],
199+},
200+{ json: false },
201+);
202+203+expect(resolveControlUiLinksMock).toHaveBeenCalledWith({
204+port: 19001,
205+bind: "lan",
206+customBindHost: undefined,
207+basePath: "/ui",
208+tlsEnabled: true,
209+});
210+});
155211});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。