The best way to control Claude Code, Codex and more from any computer or phone

main
ts 36 lines 1.36 KB
Raw
1 import { expect } from "e2e";
2 import * as Effect from "effect/Effect";
3 import * as FileSystem from "effect/FileSystem";
4
5 import { run } from "./shell.ts";
6 import { runPromise, test, WEB } from "./t3.ts";
7
8 test(
9 "The commit dialog before the first commit counts a file staged then edited once",
10 WEB,
11 async ({ t3, app, screen }) => {
12 const project = await t3.project("demo");
13 const git = (...args: ReadonlyArray<string>) => runPromise(run("git", args, { cwd: project }));
14 const write = (text: string) =>
15 runPromise(
16 Effect.flatMap(FileSystem.FileSystem, (fs) =>
17 fs.writeFileString(`${project}/new.txt`, `${text}\n`),
18 ),
19 );
20 // No commits yet: staged "staged", then edited to "actual" without restaging.
21 await git("update-ref", "-d", "HEAD");
22 await git("rm", "-r", "--cached", "--quiet", ".");
23 await write("staged");
24 await git("add", "new.txt");
25 await write("actual");
26 const thread = await t3.thread({ project, title: "First commit", messages: ["first"] });
27
28 await t3.open(thread);
29 await screen.getByRole("button", "Git action options").tap();
30 await screen.getByRole("menuitem", "Commit").tap();
31 const row = screen.getByRole("button", "Open new.txt in editor");
32 await expect(row).toBeVisible();
33 await app.screenshot("commit-dialog");
34 await expect(row).toHaveText(/\+1 \/ -0/);
35 },
36 );