diff --git a/ui/src/ui/views/agents-utils.test.ts b/ui/src/ui/views/agents-utils.test.ts index eea9bec03c8..e9a57242ecf 100644 --- a/ui/src/ui/views/agents-utils.test.ts +++ b/ui/src/ui/views/agents-utils.test.ts @@ -98,3 +98,63 @@ describe("sortLocaleStrings", () => { expect(sortLocaleStrings(new Set(["beta", "alpha"]))).toEqual(["alpha", "beta"]); }); }); + +describe("renderOverview", () => { + it("includes Cortex status details from the gateway snapshot", async () => { + Object.defineProperty(globalThis, "localStorage", { + configurable: true, + value: { + getItem: () => null, + setItem: () => {}, + removeItem: () => {}, + }, + }); + const { renderOverview } = await import("./overview.ts"); + const template = renderOverview({ + connected: true, + hello: { + snapshot: { + cortex: { + enabled: true, + mode: "technical", + graphPath: ".cortex/context.json", + lastCaptureAtMs: Date.now() - 5_000, + lastCaptureReason: "high-signal memory candidate", + lastCaptureStored: true, + lastSyncPlatforms: ["claude-code", "cursor"], + }, + }, + } as never, + settings: { + gatewayUrl: "ws://127.0.0.1:18789", + token: "", + sessionKey: "main", + }, + password: "", + lastError: null, + lastErrorCode: null, + presenceCount: 1, + sessionsCount: 1, + cronEnabled: null, + cronNext: null, + lastChannelsRefresh: null, + onSettingsChange: () => {}, + onPasswordChange: () => {}, + onSessionKeyChange: () => {}, + onConnect: () => {}, + onRefresh: () => {}, + onOpenCortexPreview: () => {}, + onOpenCortexConflicts: () => {}, + onOpenCortexSync: () => {}, + }) as { strings: TemplateStringsArray; values: unknown[] }; + + expect(template.strings.join("")).toContain("Cortex"); + const renderedValues = JSON.stringify(template.values); + + expect(renderedValues).toContain("Preview in chat"); + expect(renderedValues).toContain("Conflicts in chat"); + expect(renderedValues).toContain("Sync coding"); + expect(renderedValues).toContain("technical ยท stored"); + expect(renderedValues).toContain("high-signal memory candidate"); + }); +});