Skip to content

Commit ca1f9e5

Browse files
authored
Add PTY sidebar jump coverage (#142)
1 parent b209e85 commit ca1f9e5

2 files changed

Lines changed: 65 additions & 0 deletions

File tree

test/integration/tuistory-hunk.integration.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,40 @@ describe("Hunk integration via tuistory", () => {
153153
}
154154
});
155155

156+
test("sidebar selection jumps the main pane without collapsing the review stream", async () => {
157+
const fixture = harness.createSidebarJumpRepoFixture();
158+
const session = await harness.launchHunk({
159+
args: ["diff", "--mode", "split"],
160+
cwd: fixture.dir,
161+
cols: 220,
162+
rows: 12,
163+
});
164+
165+
try {
166+
const initial = await session.waitForText(/View\s+Navigate\s+Theme\s+Agent\s+Help/, {
167+
timeout: 15_000,
168+
});
169+
170+
expect(initial).toContain("alphaOnly = true");
171+
expect(initial).toContain("betaValue = 2");
172+
expect(initial).not.toContain("deltaOnly = true");
173+
174+
await session.click(/M delta\.ts\s+\+2 -1/);
175+
const jumped = await harness.waitForSnapshot(
176+
session,
177+
(text) => text.includes("deltaOnly = true") && !text.includes("alphaOnly = true"),
178+
5_000,
179+
);
180+
181+
expect(jumped).toContain("deltaValue = 2");
182+
expect(jumped).toContain("deltaOnly = true");
183+
expect(jumped).not.toContain("alphaOnly = true");
184+
expect(harness.countMatches(jumped, /epsilon\.ts/g)).toBeGreaterThanOrEqual(2);
185+
} finally {
186+
session.close();
187+
}
188+
});
189+
156190
test("filter focus narrows the visible review stream in the live app", async () => {
157191
const fixture = harness.createTwoFileRepoFixture();
158192
const session = await harness.launchHunk({

test/integration/tuistoryHarness.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,36 @@ export function createTuistoryHarness() {
224224
]);
225225
}
226226

227+
function createSidebarJumpRepoFixture() {
228+
return createGitRepoFixture([
229+
{
230+
path: "alpha.ts",
231+
before: "export const alpha = 1;\n",
232+
after: "export const alphaValue = 2;\nexport const alphaOnly = true;\n",
233+
},
234+
{
235+
path: "beta.ts",
236+
before: "export const beta = 1;\n",
237+
after: "export const betaValue = 2;\nexport const betaOnly = true;\n",
238+
},
239+
{
240+
path: "gamma.ts",
241+
before: "export const gamma = 1;\n",
242+
after: "export const gammaValue = 2;\nexport const gammaOnly = true;\n",
243+
},
244+
{
245+
path: "delta.ts",
246+
before: "export const delta = 1;\n",
247+
after: "export const deltaValue = 2;\nexport const deltaOnly = true;\n",
248+
},
249+
{
250+
path: "epsilon.ts",
251+
before: "export const epsilon = 1;\n",
252+
after: "export const epsilonValue = 2;\nexport const epsilonOnly = true;\n",
253+
},
254+
]);
255+
}
256+
227257
function createPagerPatchFixture(lines = 40) {
228258
const dir = makeTempDir("hunk-tuistory-pager-");
229259
const beforeDir = join(dir, "before");
@@ -313,6 +343,7 @@ export function createTuistoryHarness() {
313343
createMultiHunkFilePair,
314344
createPagerPatchFixture,
315345
createScrollableFilePair,
346+
createSidebarJumpRepoFixture,
316347
createTwoFileRepoFixture,
317348
launchHunk,
318349
waitForSnapshot,

0 commit comments

Comments
 (0)