From bab754714eebb2743c955fc59922bbc5418d2b1b Mon Sep 17 00:00:00 2001 From: Alex Blank Date: Tue, 25 Aug 2026 19:27:00 +0200 Subject: [PATCH] test(quick-pane): cover settings load --- ui/src/App.test.tsx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/ui/src/App.test.tsx b/ui/src/App.test.tsx index 2b7e861..add9ed5 100644 --- a/ui/src/App.test.tsx +++ b/ui/src/App.test.tsx @@ -1,7 +1,7 @@ import { act, render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { beforeEach, describe, expect, it, vi } from "vitest"; -import type { RuntimeSummary, Workspace } from "./workspace/types"; +import type { RuntimeSummary, UiState, Workspace } from "./workspace/types"; import { initialWorkspaceState, reconcileWorkspace, @@ -44,6 +44,14 @@ const otherSummary: RuntimeSummary = { agentId: "agent-b", label: "Session B", }; +const uiState: UiState = { + version: 1, + directoryOrder: [], + runtimeOrderByDirectory: {}, + drafts: {}, + scroll: {}, + lastSeen: {}, +}; function workspaceState() { const workspace: Workspace = { @@ -82,6 +90,7 @@ function deferred() { describe("App command progress and errors", () => { beforeEach(() => { vi.clearAllMocks(); + mocks.invoke.mockResolvedValue(uiState); mocks.refresh.mockResolvedValue(undefined); mocks.loadSnapshot.mockResolvedValue(true); mocks.useWorkspace.mockReturnValue({ @@ -118,7 +127,11 @@ describe("App command progress and errors", () => { ).toBeInTheDocument(); expect(screen.getByRole("main")).toHaveAttribute("aria-busy", "true"); await user.click(restarting); - expect(mocks.invoke).toHaveBeenCalledTimes(1); + expect(mocks.invoke).toHaveBeenCalledTimes(2); + expect(mocks.invoke).toHaveBeenNthCalledWith(1, "load_ui_state"); + expect(mocks.invoke).toHaveBeenNthCalledWith(2, "restart", { + agentId: "agent-a", + }); await act(async () => restart.resolve(undefined)); expect(screen.getByRole("button", { name: "Restarting Pi…" })).toBeDisabled();