| ... | @@ -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 | }); |
| 612 | | 669 | |
| 613 | describe("requiresDefaultBranchConfirmation", () => { | 670 | describe("requiresDefaultBranchConfirmation", () => { |