Skip to content

Commit 3bc0daf

Browse files
committed
test(web): retain diff recovery coverage through panel host
1 parent a7cf699 commit 3bc0daf

4 files changed

Lines changed: 21 additions & 2 deletions

File tree

‎apps/web/src/components/DiffPanel.browser.test.tsx‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ vi.mock("./diffs/AnnotatableCodeView", () => ({ AnnotatableCodeView: () => null
8181
vi.mock("./diffs/DiffFileTree", () => ({ DiffFileTree: () => null }));
8282
vi.mock("./DiffFilePathCopyButton", () => ({ DiffFilePathCopyButton: () => null }));
8383

84-
import DiffPanel from "./DiffPanel";
84+
import DiffSidePanel from "~/panels/diff/DiffSidePanel";
85+
import { PanelHostContext } from "~/panels/panelHost";
8586
import { useDiffPanelSessionStore, useDiffPanelStore } from "~/diffPanelStore";
8687

8788
const cwd = "/project-worktree";
@@ -194,7 +195,17 @@ it.each([
194195
using context = setup(failedBaseRef);
195196
await using screen = await render(
196197
<RegistryContext.Provider value={context.registry}>
197-
<DiffPanel composerDraftTarget={context.threadRef} workspaceMutationId={null} visible />
198+
<PanelHostContext
199+
value={{
200+
threadRef: context.threadRef,
201+
composerDraftTarget: context.threadRef,
202+
workspaceMutationId: null,
203+
visible: true,
204+
sendAnnotation: () => {},
205+
}}
206+
>
207+
<DiffSidePanel />
208+
</PanelHostContext>
198209
</RegistryContext.Provider>,
199210
);
200211
await expect.element(screen.getByText(errorMessage, { exact: true })).toBeVisible();

‎apps/web/src/panels/files/FilesSidePanel.browser.test.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ describe("files side panel", () => {
261261
it("opens a sibling file as a tab in the host's own thread", async () => {
262262
resetFixture();
263263
await import("./FilesSidePanel");
264+
// PanelHostContext supplies the thread; these interactions do not use route navigation.
264265
await using screen = await renderScreen(null, { router: false });
265266
const threadRef = refOn("environment-a");
266267
await renderFileFor(screen, threadRef);
@@ -277,6 +278,7 @@ describe("files side panel", () => {
277278
it("follows the host to another environment's thread with the same id", async () => {
278279
resetFixture();
279280
await import("./FilesSidePanel");
281+
// PanelHostContext supplies the thread; these interactions do not use route navigation.
280282
await using screen = await renderScreen(null, { router: false });
281283
await renderFileFor(screen, refOn("environment-a"));
282284
const threadRef = refOn("environment-b");

‎apps/web/src/panels/pullRequest/PullRequestSidePanel.browser.test.tsx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ describe("pull request side panel", () => {
295295
// Runs first, while the body's code is still held back.
296296
it("shows the pull request loading state until its body is ready", async () => {
297297
resetFixture();
298+
// PanelHostContext supplies the thread; these interactions do not use route navigation.
298299
await using screen = await renderScreen(null, { router: false });
299300
await renderFor(screen, refOn("environment-new"));
300301
expect(isLoading(screen)).toBe(true);
@@ -311,6 +312,7 @@ describe("pull request side panel", () => {
311312

312313
it("follows the host environment's pull request support", async () => {
313314
resetFixture();
315+
// PanelHostContext supplies the thread; these interactions do not use route navigation.
314316
await using screen = await renderScreen(null, { router: false });
315317
await loadBody();
316318
await renderFor(screen, refOn("environment-loading"));
@@ -331,6 +333,7 @@ describe("pull request side panel", () => {
331333

332334
it("writes a question into the host thread's composer only", async () => {
333335
resetFixture();
336+
// PanelHostContext supplies the thread; these interactions do not use route navigation.
334337
await using screen = await renderScreen(null, { router: false });
335338
await loadBody();
336339
const threadRef = refOn("environment-new");
@@ -345,6 +348,7 @@ describe("pull request side panel", () => {
345348

346349
it("opens a stack layer as a tab in the host's own thread", async () => {
347350
resetFixture();
351+
// PanelHostContext supplies the thread; these interactions do not use route navigation.
348352
await using screen = await renderScreen(null, { router: false });
349353
await loadBody();
350354
const threadRef = refOn("environment-new");

‎apps/web/src/panels/pullRequest/PullRequestsSidePanel.browser.test.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ describe("linked pull requests side panel", () => {
171171
it("lists and unlinks the host thread's pull requests", async () => {
172172
resetFixture();
173173
await import("./PullRequestsSidePanel");
174+
// PanelHostContext supplies the thread; these interactions do not use route navigation.
174175
await using screen = await renderScreen(null, { router: false });
175176
await renderFor(screen, refOn("environment-new"));
176177
expect(hasText(screen, "owner/alpha")).toBe(true);
@@ -195,6 +196,7 @@ describe("linked pull requests side panel", () => {
195196
it("follows the host to a thread whose environment cannot link pull requests", async () => {
196197
resetFixture();
197198
await import("./PullRequestsSidePanel");
199+
// PanelHostContext supplies the thread; these interactions do not use route navigation.
198200
await using screen = await renderScreen(null, { router: false });
199201
await renderFor(screen, refOn("environment-new"));
200202
expect(hasText(screen, "owner/alpha")).toBe(true);

0 commit comments

Comments
 (0)