From f3b3c548596af0a70fb8eddcc49118e5a5e154b2 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Sun, 1 Mar 2026 11:00:13 -0800 Subject: [PATCH] Add coverage for no-upstream default-branch quick actions - test push-only quick action on default branch without upstream - verify push and create PR stay disabled when branch is behind --- .../GitActionsControl.logic.test.ts | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/apps/web/src/components/GitActionsControl.logic.test.ts b/apps/web/src/components/GitActionsControl.logic.test.ts index b31c18cec36f3029660b99f553092bd40d164c1b..c725da105a42680b0af4293438e5728952005015 100644 --- a/apps/web/src/components/GitActionsControl.logic.test.ts +++ b/apps/web/src/components/GitActionsControl.logic.test.ts @@ -608,6 +608,63 @@ describe("when: branch has no upstream configured", () => { }, ]); }); + + it("resolveQuickAction uses push-only on default branch when no upstream exists", () => { + const quick = resolveQuickAction( + status({ + branch: "main", + hasUpstream: false, + aheadCount: 0, + pr: null, + }), + false, + true, + ); + assert.deepInclude(quick, { + kind: "run_action", + action: "commit_push", + label: "Push", + disabled: false, + }); + }); + + it("buildMenuItems still disables push and create PR when branch is behind", () => { + const items = buildMenuItems( + status({ + hasUpstream: false, + behindCount: 1, + aheadCount: 0, + pr: null, + }), + false, + ); + assert.deepEqual(items, [ + { + id: "commit", + label: "Commit", + disabled: true, + icon: "commit", + kind: "open_dialog", + dialogAction: "commit", + }, + { + id: "push", + label: "Push", + disabled: true, + icon: "push", + kind: "open_dialog", + dialogAction: "push", + }, + { + id: "pr", + label: "Create PR", + disabled: true, + icon: "pr", + kind: "open_dialog", + dialogAction: "create_pr", + }, + ]); + }); }); describe("requiresDefaultBranchConfirmation", () => { -- 2.54.0