The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { RegistryContext, useAtomValue } from "@effect/atom-react"; |
| 2 | import type { EnvironmentProject } from "@t3tools/client-runtime/state/shell"; |
| 3 | import { EnvironmentRegistry } from "@t3tools/client-runtime/connection"; |
| 4 | import { createEnvironmentSubscriptionAtomFamily } from "@t3tools/client-runtime/state/runtime"; |
| 5 | import { |
| 6 | AuthFilesystemReadScope, |
| 7 | DEFAULT_SERVER_SETTINGS, |
| 8 | EnvironmentId, |
| 9 | ProjectId, |
| 10 | type VcsListRefsResult, |
| 11 | } from "@t3tools/contracts"; |
| 12 | import * as Effect from "effect/Effect"; |
| 13 | import * as Layer from "effect/Layer"; |
| 14 | import * as Queue from "effect/Queue"; |
| 15 | import * as Stream from "effect/Stream"; |
| 16 | import { AsyncResult, Atom, AtomRegistry } from "effect/reactivity"; |
| 17 | import { act, useEffect, useLayoutEffect } from "react"; |
| 18 | import { createRoot } from "react-dom/client"; |
| 19 | import { expect, it, vi } from "vite-plus/test"; |
| 20 | import type { ComposerDraft } from "../../state/use-composer-drafts"; |
| 21 | |
| 22 | const mocks = vi.hoisted(() => ({ |
| 23 | projects: vi.fn(), |
| 24 | status: vi.fn(), |
| 25 | refs: vi.fn(), |
| 26 | readFile: vi.fn(), |
| 27 | session: vi.fn(), |
| 28 | presentation: vi.fn(), |
| 29 | registry: vi.fn(), |
| 30 | drafts: vi.fn(), |
| 31 | snapshot: vi.fn(), |
| 32 | createDraft: vi.fn(), |
| 33 | retargetDraft: vi.fn(), |
| 34 | writeSettings: vi.fn(), |
| 35 | writeText: vi.fn(), |
| 36 | serverConfig: vi.fn(), |
| 37 | openScratch: vi.fn(), |
| 38 | prepareTriage: vi.fn(), |
| 39 | })); |
| 40 | vi.mock("../../state/atom-registry", () => ({ |
| 41 | appAtomRegistry: { |
| 42 | get: (atom: Atom.Atom<unknown>) => mocks.registry().get(atom), |
| 43 | set: (atom: Atom.Writable<unknown, unknown>, value: unknown) => |
| 44 | mocks.registry().set(atom, value), |
| 45 | }, |
| 46 | })); |
| 47 | vi.mock("../../state/entities", () => ({ |
| 48 | useProjects: mocks.projects, |
| 49 | useThreadShells: () => [], |
| 50 | useEnvironmentServerConfig: () => mocks.serverConfig() ?? null, |
| 51 | useServerConfigs: () => new Map(), |
| 52 | })); |
| 53 | vi.mock("../../state/vcs", () => ({ |
| 54 | vcsEnvironment: { status: mocks.status, listRefs: mocks.refs }, |
| 55 | })); |
| 56 | vi.mock("../../state/projects", () => ({ |
| 57 | projectEnvironment: { readFile: mocks.readFile, openScratch: {} }, |
| 58 | })); |
| 59 | vi.mock("../../state/session", () => ({ |
| 60 | environmentSession: { sessionStateAtom: mocks.session }, |
| 61 | })); |
| 62 | vi.mock("../../state/presentation", () => ({ |
| 63 | useEnvironmentPresentation: mocks.presentation, |
| 64 | })); |
| 65 | vi.mock("../../state/orchestration", () => ({ orchestrationEnvironment: {} })); |
| 66 | vi.mock("../../state/threads", () => ({ olderSettledThreads: {}, threadFamilies: {} })); |
| 67 | vi.mock("../../state/pull-requests", () => ({ composerPullRequests: {} })); |
| 68 | vi.mock("../../state/olderSettledShelf", () => ({ useOlderSettledCount: () => 0 })); |
| 69 | vi.mock("../../state/project-grouping", () => ({ |
| 70 | useMobileProjectGroupingSettings: () => ({ sidebarProjectGroupingMode: "none" }), |
| 71 | })); |
| 72 | vi.mock("../../components/ui/Dialog", () => ({ alert: vi.fn() })); |
| 73 | vi.mock("../../state/use-atom-command", () => ({ useAtomCommand: () => mocks.openScratch })); |
| 74 | vi.mock("../triage/usePrepareTriage", () => ({ usePrepareTriage: () => mocks.prepareTriage })); |
| 75 | vi.mock("../../state/use-remote-environment-registry", () => ({ |
| 76 | useSavedRemoteConnections: () => ({ savedConnectionsById: {} }), |
| 77 | useRemoteConnectionStatus: () => ({ connectedEnvironments: [] }), |
| 78 | setPendingConnectionError: vi.fn(), |
| 79 | })); |
| 80 | vi.mock("../../state/use-model-option-memory", () => ({ |
| 81 | rememberModelOptions: vi.fn(), |
| 82 | withRememberedModelOptions: (value: unknown) => value, |
| 83 | })); |
| 84 | vi.mock("../../state/use-composer-drafts", () => ({ |
| 85 | composerDraftsLoadedAtom: Atom.make(true), |
| 86 | useComposerDraft: mocks.drafts, |
| 87 | getComposerDraftSnapshot: mocks.snapshot, |
| 88 | createNewTaskDraft: mocks.createDraft, |
| 89 | retargetNewTaskDraft: mocks.retargetDraft, |
| 90 | updateComposerDraftSettings: mocks.writeSettings, |
| 91 | setComposerDraftText: mocks.writeText, |
| 92 | useStickyComposerModelSelection: () => null, |
| 93 | isNewTaskDraftKey: (key: string) => key.startsWith("new-task:"), |
| 94 | clearComposerDraft: vi.fn(), |
| 95 | appendComposerDraftAttachments: vi.fn(), |
| 96 | removeComposerDraftAttachment: vi.fn(), |
| 97 | replaceComposerDraftAttachments: vi.fn(), |
| 98 | setStickyComposerModelSelection: vi.fn(), |
| 99 | setComposerDraftContext: vi.fn(), |
| 100 | scheduleUnusedComposerAttachmentCleanup: vi.fn(), |
| 101 | isComposerDraftEmpty: (draft: ComposerDraft) => |
| 102 | draft.text === "" && draft.attachments.length === 0, |
| 103 | })); |
| 104 | |
| 105 | vi.mock("../../state/peerLinks", () => ({ useLinkedEnvironments: () => new Map() })); |
| 106 | vi.mock("../../state/project-has-threads", () => ({ useProjectHasThreads: () => false })); |
| 107 | vi.mock("../../state/workspace", () => ({ |
| 108 | useConnectionsReady: () => true, |
| 109 | useWorkspaceEnvironments: () => [], |
| 110 | })); |
| 111 | vi.mock("../../state/shell", () => ({ useEnvironmentShellReadiness: () => ({}) })); |
| 112 | vi.mock("../../lib/clock", () => ({ useNowMinuteMs: () => 0 })); |
| 113 | |
| 114 | import { NewTaskFlowProvider, useNewTaskFlow } from "./new-task-flow-provider"; |
| 115 | |
| 116 | function project(environment: string, id: string): EnvironmentProject { |
| 117 | return { |
| 118 | environmentId: EnvironmentId.make(environment), |
| 119 | id: ProjectId.make(id), |
| 120 | title: id, |
| 121 | workspaceRoot: `/${id}`, |
| 122 | repositoryIdentity: null, |
| 123 | defaultModelSelection: null, |
| 124 | defaultThreadEnvMode: "worktree", |
| 125 | scripts: [], |
| 126 | createdAt: "2026-10-26T00:00:00Z", |
| 127 | updatedAt: "2026-10-26T00:00:00Z", |
| 128 | }; |
| 129 | } |
| 130 | |
| 131 | function setup() { |
| 132 | (globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true; |
| 133 | vi.useFakeTimers(); |
| 134 | vi.clearAllMocks(); |
| 135 | const registry = AtomRegistry.make(); |
| 136 | mocks.registry.mockReturnValue(registry); |
| 137 | const projects = [project("one", "a"), project("one", "b"), project("two", "b")]; |
| 138 | mocks.projects.mockReturnValue(projects); |
| 139 | mocks.presentation.mockReturnValue({ |
| 140 | isReady: true, |
| 141 | presentation: { connection: { phase: "connected", error: null } }, |
| 142 | }); |
| 143 | const events: string[] = []; |
| 144 | let checkout = "main"; |
| 145 | let checkoutIsRepo = true; |
| 146 | let holdStatus = false; |
| 147 | const emitters = new Map<string, (branch: string, isRepo?: boolean) => void>(); |
| 148 | const runtime = Atom.runtime( |
| 149 | Layer.succeed(EnvironmentRegistry.EnvironmentRegistry, { |
| 150 | followStream: (_environmentId, source) => source, |
| 151 | } as EnvironmentRegistry.EnvironmentRegistry["Service"]), |
| 152 | ); |
| 153 | const status = createEnvironmentSubscriptionAtomFamily(runtime, { |
| 154 | label: "test:new-task-status", |
| 155 | idleTtlMs: 10_000, |
| 156 | subscribe: ({ cwd }: { cwd: string }) => |
| 157 | Stream.callback<{ refName: string; isRepo: boolean }>((queue) => |
| 158 | Effect.acquireRelease( |
| 159 | Effect.sync(() => { |
| 160 | events.push(`start:${cwd}`); |
| 161 | const emit = (refName: string, isRepo = true) => |
| 162 | void Queue.offerUnsafe(queue, { refName, isRepo }); |
| 163 | emitters.set(cwd, emit); |
| 164 | if (!holdStatus) emit(checkout, checkoutIsRepo); |
| 165 | }), |
| 166 | () => Effect.sync(() => void events.push(`stop:${cwd}`)), |
| 167 | ), |
| 168 | ), |
| 169 | }); |
| 170 | mocks.status.mockImplementation(status); |
| 171 | const refs = Atom.family((key: string) => |
| 172 | Atom.make(() => { |
| 173 | const [, cwd] = JSON.parse(key) as [string, string]; |
| 174 | const result: VcsListRefsResult = { |
| 175 | refs: [{ name: "main", current: true, isDefault: true, worktreePath: cwd }], |
| 176 | isRepo: true, |
| 177 | hasPrimaryRemote: true, |
| 178 | nextCursor: null, |
| 179 | totalCount: 1, |
| 180 | }; |
| 181 | return AsyncResult.success(result); |
| 182 | }).pipe(Atom.keepAlive), |
| 183 | ); |
| 184 | mocks.refs.mockImplementation(({ environmentId, input }) => |
| 185 | refs(JSON.stringify([environmentId, input.cwd])), |
| 186 | ); |
| 187 | const session = Atom.make( |
| 188 | AsyncResult.success({ authenticated: true, scopes: [AuthFilesystemReadScope] }), |
| 189 | ); |
| 190 | mocks.session.mockReturnValue(session); |
| 191 | const file = Atom.make(AsyncResult.success({ exists: true, contents: "{}" })); |
| 192 | mocks.readFile.mockReturnValue(file); |
| 193 | |
| 194 | const empty: ComposerDraft = { text: "", attachments: [] }; |
| 195 | const drafts = Atom.make<Record<string, ComposerDraft>>({}).pipe(Atom.keepAlive); |
| 196 | const snapshot = (key: string | null): ComposerDraft => |
| 197 | (key === null ? undefined : registry.get(drafts)[key]) ?? empty; |
| 198 | const write = (key: string, patch: Partial<ComposerDraft>) => |
| 199 | registry.set(drafts, { ...registry.get(drafts), [key]: { ...snapshot(key), ...patch } }); |
| 200 | mocks.drafts.mockImplementation((key: string | null) => { |
| 201 | const all = useAtomValue(drafts); |
| 202 | return (key === null ? undefined : all[key]) ?? empty; |
| 203 | }); |
| 204 | mocks.snapshot.mockImplementation(snapshot); |
| 205 | mocks.createDraft.mockImplementation((target) => { |
| 206 | const key = `new-task:${Object.keys(registry.get(drafts)).length}`; |
| 207 | write(key, { project: target }); |
| 208 | return key; |
| 209 | }); |
| 210 | mocks.retargetDraft.mockImplementation((key, target) => |
| 211 | write(key, { project: target, workspaceSelection: undefined }), |
| 212 | ); |
| 213 | mocks.writeSettings.mockImplementation(write); |
| 214 | mocks.writeText.mockImplementation((key, text) => write(key, { text })); |
| 215 | let current: ReturnType<typeof useNewTaskFlow>; |
| 216 | function Probe(props: { readonly pickOnMount?: EnvironmentProject }) { |
| 217 | const value = useNewTaskFlow(); |
| 218 | useLayoutEffect(() => { |
| 219 | current = value; |
| 220 | }); |
| 221 | // Mirrors the draft screen applying its route project on mount, before the provider's effects run. |
| 222 | useEffect(() => { |
| 223 | if (props.pickOnMount) value.setProject(props.pickOnMount); |
| 224 | // oxlint-disable-next-line react/exhaustive-effect-dependencies -- picks once on mount; setProject changes every render |
| 225 | }, []); |
| 226 | return null; |
| 227 | } |
| 228 | const root = createRoot(document.createElement("div")); |
| 229 | return { |
| 230 | projects, |
| 231 | events, |
| 232 | checkout(branch: string, isRepo = true) { |
| 233 | checkout = branch; |
| 234 | checkoutIsRepo = isRepo; |
| 235 | }, |
| 236 | holdStatus() { |
| 237 | holdStatus = true; |
| 238 | }, |
| 239 | offline() { |
| 240 | mocks.presentation.mockReturnValue({ |
| 241 | isReady: true, |
| 242 | presentation: { connection: { phase: "offline", error: null } }, |
| 243 | }); |
| 244 | holdStatus = true; |
| 245 | }, |
| 246 | snapshot, |
| 247 | clearWorkspace(key: string) { |
| 248 | act(() => write(key, { workspaceSelection: undefined })); |
| 249 | }, |
| 250 | get current() { |
| 251 | return current; |
| 252 | }, |
| 253 | async render(active: boolean, pickOnMount?: EnvironmentProject) { |
| 254 | await act(async () => |
| 255 | root.render( |
| 256 | <RegistryContext.Provider value={registry}> |
| 257 | <NewTaskFlowProvider active={active} flowKey="test-flow"> |
| 258 | <Probe pickOnMount={pickOnMount} /> |
| 259 | </NewTaskFlowProvider> |
| 260 | </RegistryContext.Provider>, |
| 261 | ), |
| 262 | ); |
| 263 | // The draft screen applies a project whenever it shows without a draft. |
| 264 | if (active && current.draftKey === null) { |
| 265 | await act(async () => current.setProject(projects[0]!)); |
| 266 | } |
| 267 | }, |
| 268 | async emit(cwd: string, branch: string, isRepo = true) { |
| 269 | await act(async () => emitters.get(cwd)!(branch, isRepo)); |
| 270 | }, |
| 271 | async expireIdle() { |
| 272 | await act(async () => vi.advanceTimersByTime(11_000)); |
| 273 | }, |
| 274 | [Symbol.dispose]() { |
| 275 | act(() => root.unmount()); |
| 276 | registry.dispose(); |
| 277 | vi.useRealTimers(); |
| 278 | }, |
| 279 | }; |
| 280 | } |
| 281 | |
| 282 | it("keeps the draft on a project the screen picks as it mounts", async () => { |
| 283 | using screen = setup(); |
| 284 | await screen.render(true, screen.projects[2]); |
| 285 | expect(screen.current.selectedProject).toEqual(screen.projects[2]); |
| 286 | expect(screen.snapshot(screen.current.draftKey).project).toEqual({ |
| 287 | environmentId: "two", |
| 288 | projectId: "b", |
| 289 | }); |
| 290 | }); |
| 291 | |
| 292 | it("owns a status stream only while the draft is active, retaining draft choices on reopen", async () => { |
| 293 | using screen = setup(); |
| 294 | await screen.render(false); |
| 295 | expect(screen.current.selectedProject).toEqual(screen.projects[0]); |
| 296 | expect.soft([...screen.events]).toEqual([]); |
| 297 | expect(mocks.createDraft).not.toHaveBeenCalled(); |
| 298 | |
| 299 | await screen.render(true); |
| 300 | expect(screen.events).toEqual(["start:/a"]); |
| 301 | const draftKey = screen.current.draftKey!; |
| 302 | act(() => screen.current.setPrompt("keep this draft")); |
| 303 | |
| 304 | await act(async () => screen.current.setProject(screen.projects[1]!)); |
| 305 | expect(screen.current.prompt).toBe("keep this draft"); |
| 306 | expect(screen.current.draftKey).toBe(draftKey); |
| 307 | expect(screen.events).toEqual(["start:/a", "start:/b"]); |
| 308 | await act(async () => screen.current.selectEnvironment(EnvironmentId.make("two"))); |
| 309 | expect(screen.current.selectedProject).toEqual(screen.projects[2]); |
| 310 | expect(screen.snapshot(draftKey).project).toEqual({ |
| 311 | environmentId: "two", |
| 312 | projectId: "b", |
| 313 | }); |
| 314 | expect(screen.events).toEqual(["start:/a", "start:/b", "start:/b"]); |
| 315 | // A late old-project result cannot replace the current environment's checkout. |
| 316 | await screen.emit("/a", "stale-branch"); |
| 317 | expect(screen.current.currentCheckoutBranchName).toBe("main"); |
| 318 | expect(screen.snapshot(draftKey).workspaceSelection).toBeUndefined(); |
| 319 | act(() => screen.current.setWorkspaceMode("worktree")); |
| 320 | act(() => |
| 321 | screen.current.selectBranch({ |
| 322 | name: "feature", |
| 323 | current: false, |
| 324 | isDefault: false, |
| 325 | worktreePath: null, |
| 326 | }), |
| 327 | ); |
| 328 | act(() => screen.current.setStartFromOrigin(true)); |
| 329 | const chosenWorkspace = screen.snapshot(draftKey).workspaceSelection; |
| 330 | expect(chosenWorkspace).toEqual({ |
| 331 | mode: "worktree", |
| 332 | branch: "feature", |
| 333 | worktreePath: null, |
| 334 | startFromOrigin: true, |
| 335 | }); |
| 336 | |
| 337 | await screen.render(false); |
| 338 | const settingsWrites = mocks.writeSettings.mock.calls.length; |
| 339 | await screen.expireIdle(); |
| 340 | expect.soft(screen.events.filter((event) => event.startsWith("stop:"))).toHaveLength(3); |
| 341 | expect(mocks.writeSettings).toHaveBeenCalledTimes(settingsWrites); |
| 342 | expect(screen.snapshot(draftKey).workspaceSelection).toEqual(chosenWorkspace); |
| 343 | expect(screen.current.prompt).toBe("keep this draft"); |
| 344 | |
| 345 | screen.checkout("updated-checkout"); |
| 346 | await screen.render(true); |
| 347 | expect.soft(screen.events.filter((event) => event.startsWith("start:"))).toHaveLength(4); |
| 348 | expect.soft(screen.current.currentCheckoutBranchName).toBe("updated-checkout"); |
| 349 | expect(screen.current.prompt).toBe("keep this draft"); |
| 350 | expect(screen.snapshot(draftKey).workspaceSelection).toEqual(chosenWorkspace); |
| 351 | }); |
| 352 | |
| 353 | it("does not persist a provisional workspace default after releasing inactive status", async () => { |
| 354 | using screen = setup(); |
| 355 | await screen.render(true); |
| 356 | await screen.emit("/a", "main", false); |
| 357 | const draftKey = screen.current.draftKey!; |
| 358 | screen.clearWorkspace(draftKey); |
| 359 | mocks.writeSettings.mockClear(); |
| 360 | expect(screen.snapshot(draftKey).workspaceSelection).toBeUndefined(); |
| 361 | await screen.render(false); |
| 362 | expect(screen.snapshot(draftKey).workspaceSelection).toBeUndefined(); |
| 363 | expect(mocks.writeSettings).not.toHaveBeenCalled(); |
| 364 | await screen.expireIdle(); |
| 365 | screen.holdStatus(); |
| 366 | await screen.render(true); |
| 367 | expect(screen.snapshot(draftKey).workspaceSelection).toBeUndefined(); |
| 368 | await screen.emit("/a", "main", false); |
| 369 | expect(screen.snapshot(draftKey).workspaceSelection).toBeUndefined(); |
| 370 | expect(mocks.writeSettings).not.toHaveBeenCalled(); |
| 371 | }); |
| 372 | |
| 373 | it("uses cached repository capability and branch defaults while offline", async () => { |
| 374 | using screen = setup(); |
| 375 | screen.offline(); |
| 376 | await screen.render(true); |
| 377 | expect(screen.current.currentCheckoutBranchName).toBeNull(); |
| 378 | expect(screen.current.isGitRepoKnown).toBe(true); |
| 379 | expect(screen.current.workspaceMode).toBe("worktree"); |
| 380 | expect(screen.current.selectedBranchName).toBe("main"); |
| 381 | const draftKey = screen.current.draftKey!; |
| 382 | expect(screen.snapshot(draftKey).workspaceSelection).toBeUndefined(); |
| 383 | await screen.render(false); |
| 384 | await screen.expireIdle(); |
| 385 | await screen.render(true); |
| 386 | expect(screen.current.draftKey).toBe(draftKey); |
| 387 | expect(screen.current.selectedBranchName).toBe("main"); |
| 388 | }); |
| 389 | |
| 390 | const playbookPrompt = (machine: string) => |
| 391 | `Read [triage-playbook.md](/${machine}/triage-playbook.md) and follow it. `; |
| 392 | |
| 393 | /** A triage draft on machine one's No project home; machine two opens its own. */ |
| 394 | async function renderTriageDraft(screen: ReturnType<typeof setup>) { |
| 395 | mocks.serverConfig.mockReturnValue({ |
| 396 | scratchWorkspaceRoot: "/a", |
| 397 | providers: [], |
| 398 | settings: DEFAULT_SERVER_SETTINGS, |
| 399 | }); |
| 400 | mocks.openScratch.mockResolvedValue({ _tag: "Success", value: screen.projects[2] }); |
| 401 | await screen.render(true); |
| 402 | act(() => screen.current.setPrompt(`${playbookPrompt("one")}It is slow.`)); |
| 403 | } |
| 404 | |
| 405 | it("takes a triage draft's session along when its machine changes", async () => { |
| 406 | using screen = setup(); |
| 407 | await renderTriageDraft(screen); |
| 408 | mocks.prepareTriage.mockResolvedValue({ |
| 409 | _tag: "Success", |
| 410 | value: { prompt: playbookPrompt("two") }, |
| 411 | }); |
| 412 | |
| 413 | await act(async () => { |
| 414 | await screen.current.switchEnvironment(EnvironmentId.make("two")); |
| 415 | }); |
| 416 | |
| 417 | expect(screen.current.prompt).toBe(`${playbookPrompt("two")}It is slow.`); |
| 418 | expect(screen.current.selectedProject).toEqual(screen.projects[2]); |
| 419 | }); |
| 420 | |
| 421 | it.each([ |
| 422 | [ |
| 423 | "a project is picked", |
| 424 | 1, |
| 425 | (flow: ReturnType<typeof useNewTaskFlow>, picked: EnvironmentProject) => |
| 426 | flow.setProject(picked), |
| 427 | ], |
| 428 | [ |
| 429 | "a send starts and ends", |
| 430 | 0, |
| 431 | (flow: ReturnType<typeof useNewTaskFlow>) => { |
| 432 | flow.setSubmitting(true); |
| 433 | flow.setSubmitting(false); |
| 434 | }, |
| 435 | ], |
| 436 | ] as const)( |
| 437 | "leaves a triage draft alone when %s while its new machine prepares", |
| 438 | async (_name, expectedProject, interrupt) => { |
| 439 | using screen = setup(); |
| 440 | await renderTriageDraft(screen); |
| 441 | let finishPreparing!: (result: unknown) => void; |
| 442 | mocks.prepareTriage.mockReturnValue( |
| 443 | new Promise((resolve) => { |
| 444 | finishPreparing = resolve; |
| 445 | }), |
| 446 | ); |
| 447 | |
| 448 | let switching!: Promise<boolean>; |
| 449 | act(() => { |
| 450 | switching = screen.current.switchEnvironment(EnvironmentId.make("two")); |
| 451 | }); |
| 452 | await act(async () => interrupt(screen.current, screen.projects[1]!)); |
| 453 | let switched = true; |
| 454 | await act(async () => { |
| 455 | finishPreparing({ _tag: "Success", value: { prompt: playbookPrompt("two") } }); |
| 456 | switched = await switching; |
| 457 | }); |
| 458 | |
| 459 | expect(switched).toBe(false); |
| 460 | expect(screen.current.prompt).toBe(`${playbookPrompt("one")}It is slow.`); |
| 461 | expect(screen.current.selectedProject).toEqual(screen.projects[expectedProject]); |
| 462 | }, |
| 463 | ); |