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(); + }); });