workspaceSidebarRemoteNotice.test.ts 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  1. import { beforeEach, describe, expect, it, vi } from "vitest";
  2. import { createElement } from "react";
  3. import { renderToStaticMarkup } from "react-dom/server";
  4. import type { RemoteConnectionLogEntry } from "@/hooks/useRemoteConnectionLogs.js";
  5. import type { WorkspaceTabState } from "@/store/tabStore.js";
  6. const {
  7. archiveWorkspaceTasks,
  8. confirmDialog,
  9. releaseWorkspacePreparation,
  10. toast,
  11. workspaceRuntimeState,
  12. } = vi.hoisted(() => ({
  13. archiveWorkspaceTasks: vi.fn(async () => []),
  14. confirmDialog: vi.fn(async () => true),
  15. releaseWorkspacePreparation: vi.fn(async () => undefined),
  16. toast: vi.fn(),
  17. workspaceRuntimeState: {
  18. draftStatus: "idle",
  19. taskRuntimeByTaskId: {} as Record<string, { status: string }>,
  20. },
  21. }));
  22. vi.mock("border-beam", () => ({
  23. BorderBeam: ({ children }: { children: unknown }) =>
  24. createElement("div", { "data-testid": "border-beam" }, children),
  25. }));
  26. vi.mock("lucide-react", () => {
  27. const createIcon = (name: string) => (props: Record<string, unknown>) =>
  28. createElement("svg", { "data-icon": name, ...props });
  29. return {
  30. CheckIcon: createIcon("check"),
  31. CircleAlert: createIcon("circle-alert"),
  32. Cloud: createIcon("cloud"),
  33. CopyIcon: createIcon("copy"),
  34. Ellipsis: createIcon("ellipsis"),
  35. ListTree: createIcon("list-tree"),
  36. Loader2: createIcon("loader-2"),
  37. Folder: createIcon("folder"),
  38. FolderOpen: createIcon("folder-open"),
  39. House: createIcon("house"),
  40. InfoIcon: createIcon("info"),
  41. LoaderCircle: createIcon("loader"),
  42. RefreshCwIcon: createIcon("refresh"),
  43. MessageCirclePlus: createIcon("message-circle-plus"),
  44. UploadCloud: createIcon("upload-cloud"),
  45. XIcon: createIcon("x"),
  46. };
  47. });
  48. vi.mock("@/hooks/useConfirmDialog.js", () => ({
  49. useConfirmDialog: () => confirmDialog,
  50. }));
  51. vi.mock("@/components/ui/toast.js", () => ({
  52. toast,
  53. }));
  54. vi.mock("@/components/ui/button.js", () => ({
  55. Button: ({ children, className, ...props }: { children: unknown; className?: string }) =>
  56. createElement("button", { className, ...props }, children),
  57. buttonVariants: () => "button-variants",
  58. }));
  59. vi.mock("@/components/ui/collapsible.js", () => ({
  60. Collapsible: ({ children }: { children: unknown }) =>
  61. createElement("div", { "data-testid": "collapsible" }, children),
  62. CollapsibleContent: ({ children }: { children: unknown }) =>
  63. createElement("div", { "data-testid": "collapsible-content" }, children),
  64. CollapsibleTrigger: ({ children }: { children: unknown }) =>
  65. createElement("div", { "data-testid": "collapsible-trigger" }, children),
  66. }));
  67. vi.mock("@/components/ui/dropdown-menu.js", () => ({
  68. DropdownMenu: ({ children }: { children: unknown }) =>
  69. createElement("div", { "data-testid": "dropdown-menu" }, children),
  70. DropdownMenuContent: ({
  71. children,
  72. onClick,
  73. }: {
  74. children: unknown;
  75. onClick?: (event: { stopPropagation(): void }) => void;
  76. }) => {
  77. capturedWorkspaceMenuClick = onClick ?? null;
  78. return createElement("div", { "data-testid": "dropdown-menu-content" }, children);
  79. },
  80. DropdownMenuItem: ({
  81. children,
  82. onSelect,
  83. ...props
  84. }: {
  85. children: unknown;
  86. onSelect?: (event: { preventDefault(): void }) => void;
  87. "data-testid"?: string;
  88. }) => {
  89. if (onSelect && props["data-testid"]?.startsWith("workspace-close-")) {
  90. capturedWorkspaceRemoveSelect = onSelect;
  91. }
  92. return createElement("div", { "data-testid": "dropdown-menu-item", ...props }, children);
  93. },
  94. DropdownMenuTrigger: ({ children }: { children: unknown }) =>
  95. createElement("div", { "data-testid": "dropdown-menu-trigger" }, children),
  96. }));
  97. vi.mock("@/components/ui/tooltip.js", () => ({
  98. TooltipProvider: ({ children }: { children: unknown }) =>
  99. createElement("div", { "data-testid": "tooltip-provider" }, children),
  100. Tooltip: ({ children }: { children: unknown }) =>
  101. createElement("div", { "data-testid": "tooltip-root" }, children),
  102. TooltipTrigger: ({ children }: { children: unknown }) => children,
  103. TooltipContent: ({ children }: { children: unknown }) =>
  104. createElement("div", { "data-testid": "tooltip-content" }, children),
  105. }));
  106. vi.mock("@/ControlHintTooltip.js", () => ({
  107. ControlHintTooltip: ({ children, title }: { children: unknown; title: string }) =>
  108. createElement("div", { "data-title": title }, children),
  109. }));
  110. vi.mock("@/i18n/IntlProvider.js", () => ({
  111. useZCodeIntl: () => ({
  112. intl: {
  113. formatMessage: ({ id }: { id: string }) => {
  114. const messages: Record<string, string> = {
  115. "common.more": "更多",
  116. "workspaceSidebar.remove": "移除工作区",
  117. "workspaceSidebar.notConnected": "未连接",
  118. "workspaceSidebar.connecting": "连接中",
  119. "workspaceSidebar.reconnect": "重新连接",
  120. "workspaceSidebar.sshConnectionTitle": "SSH 连接",
  121. "workspaceSidebar.sshConnectionAlias": "Alias",
  122. "workspaceSidebar.sshConnectionHost": "Host",
  123. "workspaceSidebar.sshConnectionPath": "Path",
  124. "workspaceSidebar.unavailableLocalDirectory":
  125. "工作区目录不存在或无法访问,当前仅可查看历史记录。恢复该目录后重启 ZCode 即可继续使用。",
  126. "settings.skills.remoteSync.open": "同步 Skill",
  127. "settings.mcp.remoteSync.open": "同步 MCP",
  128. "taskList.newThread": "新建任务",
  129. };
  130. return messages[id] ?? id;
  131. },
  132. },
  133. }),
  134. }));
  135. vi.mock("@/TaskList.js", () => ({
  136. TaskList: () => createElement("div", { "data-testid": "task-list" }),
  137. }));
  138. vi.mock("@/WorkspaceSidebar/ReconnectingRemoteWorkspaceLogTooltip.js", () => ({
  139. ReconnectingRemoteWorkspaceLogTooltip: () =>
  140. createElement("div", { "data-testid": "reconnect-tooltip" }),
  141. }));
  142. vi.mock("@/lib/remoteWorkspaceHistory.js", () => ({
  143. buildWorkspaceSessionKey: (entry: { workspacePath: string; workspaceIdentity?: string }) =>
  144. entry.workspaceIdentity?.trim() || entry.workspacePath,
  145. formatRemoteWorkspaceDisplayLabel: (
  146. label: string,
  147. target?: { kind: string; sshConfigAlias?: string },
  148. ) => {
  149. if (target?.kind !== "ssh") {
  150. return label;
  151. }
  152. const sshConfigAlias = target.sshConfigAlias?.trim();
  153. return sshConfigAlias ? `${label} [SSH: ${sshConfigAlias}]` : label;
  154. },
  155. }));
  156. vi.mock("@/hooks/useWorkspaceServices.js", () => ({
  157. useBaseWorkspaceServices: () => ({
  158. fileService: {
  159. readdir: async () => [],
  160. },
  161. skillSyncService: {},
  162. mcpSyncService: {},
  163. pluginSyncService: {},
  164. }),
  165. useWorkspaceServices: () => ({
  166. skillSyncService: {},
  167. mcpSyncService: {},
  168. pluginSyncService: {},
  169. skillsService: {
  170. list: async () => [],
  171. },
  172. legacyTaskService: {
  173. renameTask: async () => ({}),
  174. setTaskPinned: async () => ({}),
  175. archiveTask: async () => ({}),
  176. archiveWorkspaceTasks,
  177. setTaskUnread: async () => ({}),
  178. },
  179. zcodeTaskService: {
  180. releaseWorkspacePreparation,
  181. },
  182. }),
  183. }));
  184. vi.mock("@/settings/RemoteSkillSyncDialog.js", () => ({
  185. RemoteSkillSyncDialog: () => createElement("div", { "data-testid": "remote-skill-sync-dialog" }),
  186. }));
  187. vi.mock("@/settings/RemoteMcpSyncDialog.js", () => ({
  188. RemoteMcpSyncDialog: () => createElement("div", { "data-testid": "remote-mcp-sync-dialog" }),
  189. }));
  190. vi.mock("@/settings/RemotePluginSyncDialog.js", () => ({
  191. RemotePluginSyncDialog: () =>
  192. createElement("div", { "data-testid": "remote-plugin-sync-dialog" }),
  193. }));
  194. vi.mock("@/store/taskQueryCacheStore.js", () => ({
  195. applyTaskQueryCacheMutation: () => {},
  196. invalidateTaskQueryCacheByScopes: () => {},
  197. }));
  198. vi.mock("@/store/zcodeSessionStore.js", () => ({
  199. useZCodeSessionStore: (selector: (state: Record<string, unknown>) => unknown) =>
  200. selector({
  201. startDraft: () => {},
  202. removeTaskState: () => {},
  203. upsertOptimisticTaskListItem: () => {},
  204. removeOptimisticTaskListItem: () => {},
  205. setTaskUnreadIndicator: () => {},
  206. }),
  207. selectWorkspaceZCodeState: () => ({
  208. activeTaskId: null,
  209. draftRuntime: { status: workspaceRuntimeState.draftStatus, error: null },
  210. taskRuntimeByTaskId: workspaceRuntimeState.taskRuntimeByTaskId,
  211. selectedProvider: "codex",
  212. }),
  213. }));
  214. const onReconnectRemoteWorkspace = vi.fn(async () => {});
  215. let capturedWorkspaceRemoveSelect: ((event: { preventDefault(): void }) => void) | null = null;
  216. let capturedWorkspaceMenuClick: ((event: { stopPropagation(): void }) => void) | null = null;
  217. function createRemoteWorkspaceTab(overrides: Partial<WorkspaceTabState> = {}): WorkspaceTabState {
  218. return {
  219. id: "workspace-remote",
  220. kind: "workspace",
  221. label: "remote-project",
  222. workspacePath: "/remote/project",
  223. remoteTarget: {
  224. kind: "ssh",
  225. host: "example.com",
  226. username: "dev",
  227. },
  228. workspaceIdentity: "ssh://dev@example.com/remote/project",
  229. ...overrides,
  230. };
  231. }
  232. function renderWorkspaceItem(params?: {
  233. tab?: WorkspaceTabState;
  234. remoteWorkspaceErrorByWorkspaceKey?: Record<string, string>;
  235. reconnectingRemoteWorkspaceKeys?: string[];
  236. reconnectingRemoteWorkspaceLogsByWorkspaceKey?: Record<string, RemoteConnectionLogEntry[]>;
  237. onOpenFileTree?: Parameters<typeof WorkspaceSidebarItem>[0]["onOpenFileTree"];
  238. closeTab?: Parameters<typeof WorkspaceSidebarItem>[0]["closeTab"];
  239. isExpanded?: boolean;
  240. taskListHasUnread?: boolean;
  241. taskListLiveWorkflowCount?: number;
  242. taskItems?: Parameters<typeof WorkspaceSidebarItem>[0]["taskItems"];
  243. }) {
  244. const tab = params?.tab ?? createRemoteWorkspaceTab();
  245. return renderToStaticMarkup(
  246. createElement(WorkspaceSidebarItem, {
  247. tab,
  248. isActiveWorkspace: false,
  249. isExpanded: params?.isExpanded ?? false,
  250. activateTab: () => {},
  251. closeTab: params?.closeTab ?? (() => {}),
  252. toggleWorkspaceExpanded: () => {},
  253. onSelectTask: () => {},
  254. onStartDraftInWorkspace: () => {},
  255. taskItems: params?.taskItems ?? [],
  256. taskListLoading: false,
  257. taskListHasMore: false,
  258. taskListHasUnread: params?.taskListHasUnread ?? false,
  259. taskListLiveWorkflowCount: params?.taskListLiveWorkflowCount ?? 0,
  260. onShowMoreTasks: () => {},
  261. reconnectingRemoteWorkspaceKeys: params?.reconnectingRemoteWorkspaceKeys ?? [],
  262. remoteWorkspaceErrorByWorkspaceKey: params?.remoteWorkspaceErrorByWorkspaceKey ?? {},
  263. reconnectingRemoteWorkspaceLogsByWorkspaceKey:
  264. params?.reconnectingRemoteWorkspaceLogsByWorkspaceKey ?? {},
  265. onReconnectRemoteWorkspace,
  266. onOpenFileTree: params?.onOpenFileTree,
  267. }),
  268. );
  269. }
  270. import { WorkspaceSidebarItem } from "@/WorkspaceSidebarItem.js";
  271. describe("WorkspaceSidebarItem remote notice", () => {
  272. beforeEach(() => {
  273. vi.stubGlobal("window", {
  274. matchMedia: () => ({ matches: true }),
  275. });
  276. onReconnectRemoteWorkspace.mockClear();
  277. archiveWorkspaceTasks.mockClear();
  278. confirmDialog.mockClear();
  279. confirmDialog.mockResolvedValue(true);
  280. releaseWorkspacePreparation.mockClear();
  281. toast.mockClear();
  282. workspaceRuntimeState.draftStatus = "idle";
  283. workspaceRuntimeState.taskRuntimeByTaskId = {};
  284. capturedWorkspaceRemoveSelect = null;
  285. capturedWorkspaceMenuClick = null;
  286. });
  287. it("远程项目仅仅未连接时,不显示叹号提示图标", () => {
  288. const html = renderWorkspaceItem();
  289. expect(html).not.toContain('data-icon="info"');
  290. expect(html).not.toContain('data-title="未连接"');
  291. });
  292. it("workspace 收起时显示聚合未读蓝点,展开时只保留 task 行提示", () => {
  293. const collapsedHtml = renderWorkspaceItem({ taskListHasUnread: true });
  294. const expandedHtml = renderWorkspaceItem({ isExpanded: true, taskListHasUnread: true });
  295. expect(collapsedHtml).toContain('data-workspace-unread-indicator="true"');
  296. expect(collapsedHtml).toContain("bg-sky-500 dark:bg-sky-400");
  297. expect(expandedHtml).not.toContain('data-workspace-unread-indicator="true"');
  298. });
  299. it("workspace 收起时在未读点旁显示在跑工作流的脉冲灯,>1 带数量;展开时不显示", () => {
  300. const one = renderWorkspaceItem({ taskListLiveWorkflowCount: 1 });
  301. const three = renderWorkspaceItem({ taskListHasUnread: true, taskListLiveWorkflowCount: 3 });
  302. const expanded = renderWorkspaceItem({ isExpanded: true, taskListLiveWorkflowCount: 2 });
  303. const none = renderWorkspaceItem();
  304. expect(one).toContain('data-workspace-workflow-indicator="true"');
  305. expect(one).toContain('data-count="1"');
  306. expect(one).toContain("animate-pulse bg-warning");
  307. expect(three).toContain('data-workspace-unread-indicator="true"');
  308. expect(three).toContain('data-count="3"');
  309. expect(three).toMatch(/data-count="3"[^>]*>.*3</);
  310. expect(expanded).not.toContain("data-workspace-workflow-indicator");
  311. expect(none).not.toContain("data-workspace-workflow-indicator");
  312. });
  313. it("失效的本地 workspace 标题后显示红色告警并禁用目录操作", () => {
  314. const html = renderWorkspaceItem({
  315. tab: createRemoteWorkspaceTab({
  316. id: "workspace-local-missing",
  317. label: "missing-project",
  318. workspacePath: "/workspace/missing-project",
  319. availability: "unavailable-local-directory",
  320. remoteSessionId: undefined,
  321. remoteTarget: undefined,
  322. workspaceIdentity: undefined,
  323. }),
  324. onOpenFileTree: () => {},
  325. });
  326. expect(html).toContain('data-icon="circle-alert"');
  327. expect(html).toContain("size-3.5 text-destructive");
  328. expect(html).toContain(
  329. "工作区目录不存在或无法访问,当前仅可查看历史记录。恢复该目录后重启 ZCode 即可继续使用。",
  330. );
  331. expect(html).toContain('data-icon="list-tree"');
  332. expect(html).toContain('disabled=""');
  333. });
  334. it("SSH 远程工作区有配置别名时,在任务列表标题后展示 SSH 别名标签", () => {
  335. const html = renderWorkspaceItem({
  336. tab: createRemoteWorkspaceTab({
  337. label: "root",
  338. workspacePath: "/root",
  339. remoteTarget: {
  340. kind: "ssh",
  341. host: "localhost",
  342. port: 2223,
  343. username: "root",
  344. sshConfigAlias: "linux-arm64",
  345. },
  346. workspaceIdentity: "remote:ssh:localhost:2223:root:/root",
  347. }),
  348. });
  349. expect(html).toContain("root [SSH: linux-arm64]");
  350. });
  351. it("SSH 远程工作区没有配置别名时,workspace tooltip 展示连接 host 和路径", () => {
  352. const html = renderWorkspaceItem({
  353. tab: createRemoteWorkspaceTab({
  354. label: "demo-project",
  355. workspacePath: "/srv/demo-project",
  356. remoteTarget: {
  357. kind: "ssh",
  358. host: "10.0.0.8",
  359. port: 2202,
  360. username: "root",
  361. },
  362. workspaceIdentity: "remote:ssh:10.0.0.8:2202:root:/srv/demo-project",
  363. }),
  364. });
  365. expect(html).toContain('data-testid="tooltip-content"');
  366. expect(html).toContain("SSH 连接");
  367. expect(html).toContain("root@10.0.0.8:2202");
  368. expect(html).toContain("/srv/demo-project");
  369. });
  370. it("远程项目有连接错误时,显示叹号提示图标和错误内容", () => {
  371. const html = renderWorkspaceItem({
  372. remoteWorkspaceErrorByWorkspaceKey: {
  373. "ssh://dev@example.com/remote/project": "ssh connection refused",
  374. },
  375. });
  376. expect(html).toContain('data-icon="info"');
  377. expect(html).toContain("ssh connection refused");
  378. });
  379. it("远程项目未连接时,不显示 file tree 入口", () => {
  380. const html = renderWorkspaceItem({ onOpenFileTree: () => {} });
  381. expect(html).not.toContain('data-icon="list-tree"');
  382. expect(html).not.toContain("workspaceSidebar.showFileTree");
  383. });
  384. it("远程项目已连接时,显示 file tree 入口", () => {
  385. const html = renderWorkspaceItem({
  386. tab: createRemoteWorkspaceTab({ remoteSessionId: "remote-session-1" }),
  387. onOpenFileTree: () => {},
  388. });
  389. expect(html).toContain('data-icon="list-tree"');
  390. expect(html).toContain("workspaceSidebar.showFileTree");
  391. });
  392. it("已连接 SSH 远程工作区的更多菜单显示同步 Skills 和 MCP 入口", () => {
  393. const html = renderWorkspaceItem({
  394. tab: createRemoteWorkspaceTab({ remoteSessionId: "remote-session-1" }),
  395. });
  396. expect(html).toContain('data-icon="upload-cloud"');
  397. expect(html).toContain("同步 Skill");
  398. expect(html).toContain("同步 MCP");
  399. });
  400. it("未连接远程工作区的更多菜单不显示同步 Skills 和 MCP 入口", () => {
  401. const html = renderWorkspaceItem();
  402. expect(html).not.toContain("同步 Skill");
  403. expect(html).not.toContain("同步 MCP");
  404. });
  405. it("远程项目重连中时,右侧 loading 图标使用连接日志 tooltip", () => {
  406. const html = renderWorkspaceItem({
  407. reconnectingRemoteWorkspaceKeys: ["ssh://dev@example.com/remote/project"],
  408. reconnectingRemoteWorkspaceLogsByWorkspaceKey: {
  409. "ssh://dev@example.com/remote/project": [
  410. {
  411. id: "log-1",
  412. level: "info",
  413. timestamp: "10:00:00",
  414. message: "connecting",
  415. },
  416. ],
  417. },
  418. });
  419. expect(html).toContain('data-testid="reconnect-tooltip"');
  420. });
  421. it("移除 workspace 会释放 runtime 且不批量归档已有 task", async () => {
  422. const closeTab = vi.fn();
  423. renderWorkspaceItem({ closeTab });
  424. await capturedWorkspaceRemoveSelect?.({
  425. preventDefault: () => {},
  426. });
  427. await Promise.resolve();
  428. expect(confirmDialog).not.toHaveBeenCalled();
  429. expect(closeTab).toHaveBeenCalledWith("workspace-remote");
  430. expect(releaseWorkspacePreparation).toHaveBeenCalledWith({
  431. workspacePath: "/remote/project",
  432. workspaceIdentity: "ssh://dev@example.com/remote/project",
  433. });
  434. expect(archiveWorkspaceTasks).not.toHaveBeenCalled();
  435. });
  436. it("运行中 workspace 移除被取消时不关闭 tab 也不释放 runtime", async () => {
  437. const closeTab = vi.fn();
  438. confirmDialog.mockResolvedValue(false);
  439. workspaceRuntimeState.taskRuntimeByTaskId = { task_running: { status: "streaming" } };
  440. renderWorkspaceItem({
  441. closeTab,
  442. taskItems: [
  443. {
  444. taskId: "task_running",
  445. traceId: "trace_running",
  446. title: "running task",
  447. workspacePath: "/remote/project",
  448. createdAt: 1,
  449. updatedAt: 1,
  450. mode: "agent",
  451. status: "running",
  452. },
  453. ],
  454. });
  455. await capturedWorkspaceRemoveSelect?.({
  456. preventDefault: () => {},
  457. });
  458. await Promise.resolve();
  459. expect(confirmDialog).toHaveBeenCalledWith(
  460. expect.objectContaining({
  461. title: "workspaceSidebar.removeRunningWorkspace.title",
  462. confirmVariant: "destructive",
  463. }),
  464. );
  465. expect(closeTab).not.toHaveBeenCalled();
  466. expect(releaseWorkspacePreparation).not.toHaveBeenCalled();
  467. });
  468. it("运行中 workspace 移除被确认后继续释放 runtime", async () => {
  469. const closeTab = vi.fn();
  470. workspaceRuntimeState.draftStatus = "creating";
  471. renderWorkspaceItem({ closeTab });
  472. await capturedWorkspaceRemoveSelect?.({
  473. preventDefault: () => {},
  474. });
  475. await Promise.resolve();
  476. expect(confirmDialog).toHaveBeenCalledOnce();
  477. expect(closeTab).toHaveBeenCalledWith("workspace-remote");
  478. expect(releaseWorkspacePreparation).toHaveBeenCalledWith({
  479. workspacePath: "/remote/project",
  480. workspaceIdentity: "ssh://dev@example.com/remote/project",
  481. });
  482. });
  483. it("workspace 操作菜单 click 必须阻止冒泡到 CollapsibleTrigger", () => {
  484. const stopPropagation = vi.fn();
  485. renderWorkspaceItem({ isExpanded: false });
  486. capturedWorkspaceMenuClick?.({ stopPropagation });
  487. expect(stopPropagation).toHaveBeenCalledOnce();
  488. });
  489. });