The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import { EnvironmentId, ThreadId } from "@t3tools/contracts"; |
| 2 | import { expect, it, vi } from "vite-plus/test"; |
| 3 | import { page } from "vite-plus/test/browser"; |
| 4 | |
| 5 | vi.mock(import("~/hooks/usePullRequestLinking"), async (original) => ({ |
| 6 | ...(await original()), |
| 7 | usePullRequestLinking: (() => ({ |
| 8 | mode: "multiple", |
| 9 | canLink: () => true, |
| 10 | changeLink: vi.fn(), |
| 11 | })) as never, |
| 12 | })); |
| 13 | vi.mock(import("~/state/entities"), async (original) => ({ |
| 14 | ...(await original()), |
| 15 | useProjects: () => [], |
| 16 | useThreadShell: () => null, |
| 17 | })); |
| 18 | |
| 19 | import { RegistryContext } from "@effect/atom-react"; |
| 20 | |
| 21 | import { appAtomRegistry } from "~/rpc/atomRegistry"; |
| 22 | import { act, render } from "../../../test/render"; |
| 23 | import { LinkPullRequestDialogHost, openLinkPullRequestDialog } from "./LinkPullRequestDialog"; |
| 24 | |
| 25 | it("focuses the reference input when the dialog opens", async () => { |
| 26 | await using _screen = await render( |
| 27 | <RegistryContext.Provider value={appAtomRegistry}> |
| 28 | <LinkPullRequestDialogHost /> |
| 29 | </RegistryContext.Provider>, |
| 30 | ); |
| 31 | await act(() => |
| 32 | openLinkPullRequestDialog({ |
| 33 | environmentId: EnvironmentId.make("environment"), |
| 34 | threadId: ThreadId.make("thread"), |
| 35 | }), |
| 36 | ); |
| 37 | |
| 38 | await expect.element(page.getByPlaceholder("Pull request URL or #42")).toHaveFocus(); |
| 39 | }); |