diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/store.test.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/store.test.ts index 061815a3f8..fd95bbdb2c 100644 --- a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/store.test.ts +++ b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/store.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, it, beforeEach, vi } from "vitest"; +import { describe, expect, it, beforeEach, afterEach, vi } from "vitest"; import { useCopilotUIStore } from "../store"; vi.mock("@sentry/nextjs", () => ({ @@ -243,3 +243,24 @@ describe("useCopilotUIStore", () => { }); }); }); + +describe("useCopilotUIStore localStorage initialisation", () => { + afterEach(() => { + vi.resetModules(); + window.localStorage.clear(); + }); + + it("reads fast chat mode from localStorage on store creation", async () => { + window.localStorage.setItem("copilot-mode", "fast"); + vi.resetModules(); + const { useCopilotUIStore: fresh } = await import("../store"); + expect(fresh.getState().copilotChatMode).toBe("fast"); + }); + + it("reads advanced model from localStorage on store creation", async () => { + window.localStorage.setItem("copilot-model", "advanced"); + vi.resetModules(); + const { useCopilotUIStore: fresh } = await import("../store"); + expect(fresh.getState().copilotLlmModel).toBe("advanced"); + }); +});