From 6dfefa1be10078b0e92a00761ca6f8cc6deeeadc Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 16 Feb 2026 02:55:24 +0000 Subject: [PATCH] test(ui): cover trailing-slash bootstrap basePath --- .../controllers/control-ui-bootstrap.test.ts | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ui/src/ui/controllers/control-ui-bootstrap.test.ts b/ui/src/ui/controllers/control-ui-bootstrap.test.ts index 7efe0b09b6..29e66fab85 100644 --- a/ui/src/ui/controllers/control-ui-bootstrap.test.ts +++ b/ui/src/ui/controllers/control-ui-bootstrap.test.ts @@ -58,4 +58,25 @@ describe("loadControlUiBootstrapConfig", () => { vi.unstubAllGlobals(); }); + + it("normalizes trailing slash basePath for bootstrap fetch path", async () => { + const fetchMock = vi.fn().mockResolvedValue({ ok: false }); + vi.stubGlobal("fetch", fetchMock as unknown as typeof fetch); + + const state = { + basePath: "/openclaw/", + assistantName: "Assistant", + assistantAvatar: null, + assistantAgentId: null, + }; + + await loadControlUiBootstrapConfig(state); + + expect(fetchMock).toHaveBeenCalledWith( + `/openclaw${CONTROL_UI_BOOTSTRAP_CONFIG_PATH}`, + expect.objectContaining({ method: "GET" }), + ); + + vi.unstubAllGlobals(); + }); });