From ccb97da75cb8ce8f54caf20bcd97fb64f02d3da6 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Fri, 1 May 2026 18:04:52 -0700 Subject: [PATCH] Update git ref mock data for primary remote - Rename branch fixtures to refs and primary remote flags - Align Git actions and keybinding tests with new ref labels --- apps/web/src/components/ChatView.browser.tsx | 46 +++++++++---------- .../components/GitActionsControl.browser.tsx | 10 +++- .../components/KeybindingsToast.browser.tsx | 4 +- 3 files changed, 34 insertions(+), 26 deletions(-) diff --git a/apps/web/src/components/ChatView.browser.tsx b/apps/web/src/components/ChatView.browser.tsx index 6f35d07023..8a747dbd5e 100644 --- a/apps/web/src/components/ChatView.browser.tsx +++ b/apps/web/src/components/ChatView.browser.tsx @@ -955,10 +955,10 @@ function resolveWsRpc(body: NormalizedWsRpcRequestBody): unknown { if (tag === WS_METHODS.vcsListRefs) { return { isRepo: true, - hasOriginRemote: true, + hasPrimaryRemote: true, nextCursor: null, totalCount: 1, - branches: [ + refs: [ { name: "main", current: true, @@ -2288,18 +2288,18 @@ describe("ChatView timeline estimator parity (full app)", () => { branchButton.click(); const branchInput = await waitForElement( - () => document.querySelector('input[placeholder="Search branches..."]'), - "Unable to find branch search input.", + () => document.querySelector('input[placeholder="Search refs..."]'), + "Unable to find ref search input.", ); branchInput.focus(); - await page.getByPlaceholder("Search branches...").fill("1359"); + await page.getByPlaceholder("Search refs...").fill("1359"); const checkoutItem = await waitForElement( () => Array.from(document.querySelectorAll("span")).find( (element) => element.textContent?.trim() === "Checkout Pull Request", ) as HTMLSpanElement | null, - "Unable to find switchRef pull request option.", + "Unable to find checkout pull request option.", ); checkoutItem.click(); @@ -2576,10 +2576,10 @@ describe("ChatView timeline estimator parity (full app)", () => { if (body._tag === WS_METHODS.vcsListRefs) { return { isRepo: true, - hasOriginRemote: true, + hasPrimaryRemote: true, nextCursor: null, totalCount: 1, - branches: [ + refs: [ { name: "main", current: true, @@ -2599,7 +2599,7 @@ describe("ChatView timeline estimator parity (full app)", () => { }); try { - (await waitForButtonByText("Current switchRef")).click(); + (await waitForButtonByText("Current checkout")).click(); await page.getByText("New worktree", { exact: true }).click(); await vi.waitFor( @@ -2669,10 +2669,10 @@ describe("ChatView timeline estimator parity (full app)", () => { if (body._tag === WS_METHODS.vcsListRefs) { return { isRepo: true, - hasOriginRemote: true, + hasPrimaryRemote: true, nextCursor: null, totalCount: 2, - branches: [ + refs: [ { name: "main", current: true, @@ -2698,7 +2698,7 @@ describe("ChatView timeline estimator parity (full app)", () => { }); try { - (await waitForButtonByText("Current switchRef")).click(); + (await waitForButtonByText("Current checkout")).click(); await page.getByText("New worktree", { exact: true }).click(); await page.getByText("From main", { exact: true }).click(); await page.getByText("release/next", { exact: true }).click(); @@ -2765,10 +2765,10 @@ describe("ChatView timeline estimator parity (full app)", () => { if (body._tag === WS_METHODS.vcsListRefs) { return { isRepo: true, - hasOriginRemote: true, + hasPrimaryRemote: true, nextCursor: null, totalCount: 2, - branches: [ + refs: [ { name: "main", current: true, @@ -2794,7 +2794,7 @@ describe("ChatView timeline estimator parity (full app)", () => { }); try { - (await waitForButtonByText("Current switchRef")).click(); + (await waitForButtonByText("Current checkout")).click(); await page.getByText("New worktree", { exact: true }).click(); await page.getByText("From main", { exact: true }).click(); await page.getByText("release/next", { exact: true }).click(); @@ -2822,13 +2822,13 @@ describe("ChatView timeline estimator parity (full app)", () => { await vi.waitFor( () => { - expect(findButtonByText("Current switchRef")).toBeTruthy(); + expect(findButtonByText("Current checkout")).toBeTruthy(); expect(findButtonByText("From release/next")).toBeNull(); }, { timeout: 8_000, interval: 16 }, ); - (await waitForButtonByText("Current switchRef")).click(); + (await waitForButtonByText("Current checkout")).click(); await page.getByText("New worktree", { exact: true }).click(); await vi.waitFor( @@ -3025,10 +3025,10 @@ describe("ChatView timeline estimator parity (full app)", () => { if (body._tag === WS_METHODS.vcsListRefs) { return { isRepo: true, - hasOriginRemote: true, + hasPrimaryRemote: true, nextCursor: null, totalCount: 2, - branches: [ + refs: [ { name: "main", current: true, @@ -3150,10 +3150,10 @@ describe("ChatView timeline estimator parity (full app)", () => { if (body._tag === WS_METHODS.vcsListRefs) { return { isRepo: true, - hasOriginRemote: true, + hasPrimaryRemote: true, nextCursor: null, totalCount: branches.length, - branches, + refs: branches, }; } return undefined; @@ -3171,8 +3171,8 @@ describe("ChatView timeline estimator parity (full app)", () => { branchButton.click(); await waitForElement( - () => document.querySelector('input[placeholder="Search branches..."]'), - "Unable to find branch search input.", + () => document.querySelector('input[placeholder="Search refs..."]'), + "Unable to find ref search input.", ); const popup = await waitForElement( diff --git a/apps/web/src/components/GitActionsControl.browser.tsx b/apps/web/src/components/GitActionsControl.browser.tsx index beeb136a9c..787e034bd1 100644 --- a/apps/web/src/components/GitActionsControl.browser.tsx +++ b/apps/web/src/components/GitActionsControl.browser.tsx @@ -113,7 +113,15 @@ vi.mock("~/lib/gitStatusState", () => ({ resetGitStatusStateForTests: () => undefined, useGitStatus: vi.fn(() => ({ data: { - branch: BRANCH_NAME, + isRepo: true, + sourceControlProvider: { + kind: "github", + name: "GitHub", + baseUrl: "https://github.com", + }, + hasPrimaryRemote: true, + isDefaultRef: false, + refName: BRANCH_NAME, hasWorkingTreeChanges: false, workingTree: { files: [], insertions: 0, deletions: 0 }, hasUpstream: true, diff --git a/apps/web/src/components/KeybindingsToast.browser.tsx b/apps/web/src/components/KeybindingsToast.browser.tsx index 9493e87c78..c9d081b3fa 100644 --- a/apps/web/src/components/KeybindingsToast.browser.tsx +++ b/apps/web/src/components/KeybindingsToast.browser.tsx @@ -259,10 +259,10 @@ function resolveWsRpc(tag: string): unknown { if (tag === WS_METHODS.vcsListRefs) { return { isRepo: true, - hasOriginRemote: true, + hasPrimaryRemote: true, nextCursor: null, totalCount: 1, - branches: [{ name: "main", current: true, isDefault: true, worktreePath: null }], + refs: [{ name: "main", current: true, isDefault: true, worktreePath: null }], }; } if (tag === WS_METHODS.projectsSearchEntries) {