Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

test(ui): verify chat-first home migration and stable navigation label

rubenluetke10-beep73042e9dcc1d
diff --git a/jarvis/ui/web/frontend/src/components/layout/navGroups.test.ts b/jarvis/ui/web/frontend/src/components/layout/navGroups.test.ts
index 2dad879f8a..4c98af14ee 100644
--- a/jarvis/ui/web/frontend/src/components/layout/navGroups.test.ts
+++ b/jarvis/ui/web/frontend/src/components/layout/navGroups.test.ts
@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest";
-import { MessageSquare, Mic } from "lucide-react";
+import { MessageSquare } from "lucide-react";
import { NAV_GROUPS, presentNavItem } from "@/components/layout/navGroups";
@@ -7,10 +7,10 @@ const chats = NAV_GROUPS.flat().find((i) => i.id === "chats")!;
const agents = NAV_GROUPS.flat().find((i) => i.id === "agents")!;
describe("presentNavItem", () => {
- it("names the front page after the face the Voice | Chat switch picked", () => {
+ it("keeps the front page named Chat while voice mode is active", () => {
const voice = presentNavItem(chats, "voice");
- expect(voice.labelKey).toBe("sidebar.surface_voice");
- expect(voice.icon).toBe(Mic);
+ expect(voice.labelKey).toBe("sidebar.surface_chat");
+ expect(voice.icon).toBe(MessageSquare);
const chat = presentNavItem(chats, "chat");
expect(chat.labelKey).toBe("sidebar.surface_chat");
diff --git a/jarvis/ui/web/frontend/src/views/ChatsSurface.test.tsx b/jarvis/ui/web/frontend/src/views/ChatsSurface.test.tsx
index e8913be834..c959d889fb 100644
--- a/jarvis/ui/web/frontend/src/views/ChatsSurface.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/ChatsSurface.test.tsx
@@ -21,7 +21,7 @@ vi.mock("@/components/home/ChatStage", () => ({
ChatStage: () => <div data-testid="chat">chat</div>,
}));
-const STORAGE_KEY = "jarvis.home.surface.v1";
+const STORAGE_KEY = "jarvis.home.surface.v2";
describe("ChatsSurface (the front page)", () => {
beforeEach(() => {
@@ -31,14 +31,15 @@ describe("ChatsSurface (the front page)", () => {
afterEach(cleanup);
- it("opens on the voice stage by default", () => {
+ it("opens on the chat stage by default", async () => {
render(<ChatsSurface />);
- expect(screen.getByTestId("voice")).toBeTruthy();
- expect(screen.queryByTestId("chat")).toBeNull();
- expect(screen.getByTestId("home-view").getAttribute("data-surface")).toBe("voice");
+ expect(await screen.findByTestId("chat")).toBeTruthy();
+ expect(screen.queryByTestId("voice")).toBeNull();
+ expect(screen.getByTestId("home-view").getAttribute("data-surface")).toBe("chat");
});
it("switches to the chat stage from the sidebar switch and remembers it", async () => {
+ useHomeStore.setState({ surface: "voice" });
render(
<>
<SurfaceSwitch />
@@ -75,10 +76,17 @@ describe("ChatsSurface (the front page)", () => {
expect(window.localStorage.getItem(STORAGE_KEY)).toBe("voice");
});
- it("lands on voice when the stored value is corrupt", () => {
+ it("lands on chat when the stored value is corrupt", async () => {
window.localStorage.setItem(STORAGE_KEY, "garbage");
useHomeStore.setState({ surface: readHomeSurface() });
render(<ChatsSurface />);
- expect(screen.getByTestId("voice")).toBeTruthy();
+ expect(await screen.findByTestId("chat")).toBeTruthy();
+ });
+
+ it("migrates the old voice-first preference to chat once", () => {
+ window.localStorage.setItem("jarvis.home.surface.v1", "voice");
+ expect(readHomeSurface()).toBe("chat");
+ window.localStorage.setItem(STORAGE_KEY, "voice");
+ expect(readHomeSurface()).toBe("voice");
});
});