/** * @file WorkspaceHome.test.tsx * @description The workspace home: a new session starts in the first free * pane slot and opens it, on the AI tool picked for it (the workspace's by * default), AI and Model in the box and AI Proxy / Permission / Worktree * under it (the proxy's models on a proxy), all-busy is refused, Recents open a live pane or the * transcript (never a resume), instructions save, context files upload and * remove, a folder is added with the repo's untracked worktrees suggested * (minus hidden sources), an unsupported tool is said so, and memory opens * read-only. * @author Nguyễn Ngọc Trí Vĩ */ import { beforeEach, describe, expect, it, vi } from "vitest"; import { fireEvent, render, screen, waitFor, within } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { MemoryRouter, Route, Routes, useLocation } from "react-router-dom"; import type { Lane, Session } from "../../../lib/types"; import type { LaneSourcesView, RunHandle } from "../../../lib/api"; vi.mock("../../run/RunSetup", () => ({ promptWithImages: (text: string, images: { path: string }[]) => [text.trim(), ...images.map((i) => i.path)].filter(Boolean).join(" "), PromptEditor: ({ value, onChange, onSubmit, placeholder, }: { value: string; onChange: (s: string) => void; onSubmit: () => void; placeholder: string; }) => (