authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-03-01 11:00:13-08:00
committergravatar for jmarminge@gmail.comJulius Marminge <jmarminge@gmail.com> 2026-03-01 20:06:01-08:00
logf3b3c548596af0a70fb8eddcc49118e5a5e154b2
tree718e0670f79161c22c7afc65d41403d1e55778fc
parent02eca40c3b854377ec7bfff629c638379b04e030

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

1 files changed, 57 insertions(+), 0 deletions(-)

apps/web/src/components/GitActionsControl.logic.test.ts+57
...@@ -608,6 +608,63 @@ describe("when: branch has no upstream configured", () => {...@@ -608,6 +608,63 @@ describe("when: branch has no upstream configured", () => {
608 },608 },
609 ]);609 ]);
610 });610 });
611
612 it("resolveQuickAction uses push-only on default branch when no upstream exists", () => {
613 const quick = resolveQuickAction(
614 status({
615 branch: "main",
616 hasUpstream: false,
617 aheadCount: 0,
618 pr: null,
619 }),
620 false,
621 true,
622 );
623 assert.deepInclude(quick, {
624 kind: "run_action",
625 action: "commit_push",
626 label: "Push",
627 disabled: false,
628 });
629 });
630
631 it("buildMenuItems still disables push and create PR when branch is behind", () => {
632 const items = buildMenuItems(
633 status({
634 hasUpstream: false,
635 behindCount: 1,
636 aheadCount: 0,
637 pr: null,
638 }),
639 false,
640 );
641 assert.deepEqual(items, [
642 {
643 id: "commit",
644 label: "Commit",
645 disabled: true,
646 icon: "commit",
647 kind: "open_dialog",
648 dialogAction: "commit",
649 },
650 {
651 id: "push",
652 label: "Push",
653 disabled: true,
654 icon: "push",
655 kind: "open_dialog",
656 dialogAction: "push",
657 },
658 {
659 id: "pr",
660 label: "Create PR",
661 disabled: true,
662 icon: "pr",
663 kind: "open_dialog",
664 dialogAction: "create_pr",
665 },
666 ]);
667 });
611});668});
612669
613describe("requiresDefaultBranchConfirmation", () => {670describe("requiresDefaultBranchConfirmation", () => {