| ... | ... | @@ -515,15 +515,15 @@ describe("when: HEAD is detached and there are no local changes", () => { |
| 515 | 515 | }); |
| 516 | 516 | |
| 517 | 517 | describe("when: branch has no upstream configured", () => { |
| 518 | | it("resolveQuickAction runs push and create PR when clean, no upstream, and no local commits are ahead", () => { |
| 518 | it("resolveQuickAction runs push when clean, no upstream, and no local commits are ahead", () => { |
| 519 | 519 | const quick = resolveQuickAction( |
| 520 | 520 | status({ hasUpstream: false, pr: null, aheadCount: 0 }), |
| 521 | 521 | false, |
| 522 | 522 | ); |
| 523 | 523 | assert.deepInclude(quick, { |
| 524 | 524 | kind: "run_action", |
| 525 | | action: "commit_push_pr", |
| 526 | | label: "Push & create PR", |
| 525 | action: "commit_push", |
| 526 | label: "Push", |
| 527 | 527 | disabled: false, |
| 528 | 528 | }); |
| 529 | 529 | }); |
| ... | ... | @@ -576,11 +576,61 @@ describe("when: branch has no upstream configured", () => { |
| 576 | 576 | }); |
| 577 | 577 | }); |
| 578 | 578 | |
| 579 | | it("buildMenuItems enables push and create PR to publish branch when no upstream exists", () => { |
| 579 | it("buildMenuItems enables push but keeps create PR disabled when no commits are ahead", () => { |
| 580 | 580 | const items = buildMenuItems( |
| 581 | 581 | status({ hasUpstream: false, pr: null, aheadCount: 0 }), |
| 582 | 582 | false, |
| 583 | 583 | ); |
| 584 | assert.deepEqual(items, [ |
| 585 | { |
| 586 | id: "commit", |
| 587 | label: "Commit", |
| 588 | disabled: true, |
| 589 | icon: "commit", |
| 590 | kind: "open_dialog", |
| 591 | dialogAction: "commit", |
| 592 | }, |
| 593 | { |
| 594 | id: "push", |
| 595 | label: "Push", |
| 596 | disabled: false, |
| 597 | icon: "push", |
| 598 | kind: "open_dialog", |
| 599 | dialogAction: "push", |
| 600 | }, |
| 601 | { |
| 602 | id: "pr", |
| 603 | label: "Create PR", |
| 604 | disabled: true, |
| 605 | icon: "pr", |
| 606 | kind: "open_dialog", |
| 607 | dialogAction: "create_pr", |
| 608 | }, |
| 609 | ]); |
| 610 | }); |
| 611 | |
| 612 | it("resolveQuickAction runs push and create PR when no upstream and commits are ahead", () => { |
| 613 | const quick = resolveQuickAction( |
| 614 | status({ |
| 615 | hasUpstream: false, |
| 616 | aheadCount: 2, |
| 617 | pr: null, |
| 618 | }), |
| 619 | false, |
| 620 | ); |
| 621 | assert.deepInclude(quick, { |
| 622 | kind: "run_action", |
| 623 | action: "commit_push_pr", |
| 624 | label: "Push & create PR", |
| 625 | disabled: false, |
| 626 | }); |
| 627 | }); |
| 628 | |
| 629 | it("buildMenuItems enables create PR when no upstream and commits are ahead", () => { |
| 630 | const items = buildMenuItems( |
| 631 | status({ hasUpstream: false, pr: null, aheadCount: 2 }), |
| 632 | false, |
| 633 | ); |
| 584 | 634 | assert.deepEqual(items, [ |
| 585 | 635 | { |
| 586 | 636 | id: "commit", |