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", () => {