47 lines
1.3 KiB
C#
47 lines
1.3 KiB
C#
using ClaudeDo.Ui.ViewModels.Islands;
|
|
using Xunit;
|
|
|
|
namespace ClaudeDo.Ui.Tests.ViewModels;
|
|
|
|
/// <summary>Detail pane in a company repo: approve becomes "create draft PR" / "update PR", and the PR link only exists once there is a PR.</summary>
|
|
public sealed class MergeSectionCompanyRepoTests
|
|
{
|
|
private sealed class Worker : StubWorkerClient { }
|
|
|
|
private static MergeSectionViewModel Vm() => new(new Worker(), services: null!);
|
|
|
|
[Fact]
|
|
public void PrivateRepo_ShowsOnlyApproveAndMerge()
|
|
{
|
|
var vm = Vm();
|
|
|
|
Assert.True(vm.ShowApproveMerge);
|
|
Assert.False(vm.ShowCreatePr);
|
|
Assert.False(vm.ShowUpdatePr);
|
|
Assert.False(vm.OpenPullRequestCommand.CanExecute(null));
|
|
}
|
|
|
|
[Fact]
|
|
public void CompanyRepo_WithoutPr_OffersCreateDraftPr()
|
|
{
|
|
var vm = Vm();
|
|
vm.IsCompanyRepo = true;
|
|
|
|
Assert.False(vm.ShowApproveMerge);
|
|
Assert.True(vm.ShowCreatePr);
|
|
Assert.False(vm.ShowUpdatePr);
|
|
}
|
|
|
|
[Fact]
|
|
public void CompanyRepo_WithPr_OffersUpdateAndLink()
|
|
{
|
|
var vm = Vm();
|
|
vm.IsCompanyRepo = true;
|
|
vm.PullRequestUrl = "https://srv/Coll/Proj/_git/Repo/pullrequest/5";
|
|
|
|
Assert.False(vm.ShowCreatePr);
|
|
Assert.True(vm.ShowUpdatePr);
|
|
Assert.True(vm.OpenPullRequestCommand.CanExecute(null));
|
|
}
|
|
}
|