feat(ui): show mergeability and surface approve conflicts in the work console
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
using ClaudeDo.Ui.Services;
|
||||
using ClaudeDo.Ui.ViewModels.Islands;
|
||||
|
||||
namespace ClaudeDo.Ui.Tests.ViewModels;
|
||||
|
||||
public class MergePreviewPresenterTests
|
||||
{
|
||||
[Fact]
|
||||
public void Clean_Plural()
|
||||
{
|
||||
var (text, clean, conflict) = MergePreviewPresenter.Describe(
|
||||
new MergePreviewDto("clean", System.Array.Empty<string>(), 3));
|
||||
Assert.Equal("Merges cleanly · 3 files", text);
|
||||
Assert.True(clean);
|
||||
Assert.False(conflict);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Clean_Singular()
|
||||
{
|
||||
var (text, _, _) = MergePreviewPresenter.Describe(
|
||||
new MergePreviewDto("clean", System.Array.Empty<string>(), 1));
|
||||
Assert.Equal("Merges cleanly · 1 file", text);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Conflict_ListsUpToThree()
|
||||
{
|
||||
var (text, clean, conflict) = MergePreviewPresenter.Describe(
|
||||
new MergePreviewDto("conflict", new[] { "a.cs", "b.cs" }, 0));
|
||||
Assert.Equal("Conflicts in a.cs, b.cs", text);
|
||||
Assert.False(clean);
|
||||
Assert.True(conflict);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Conflict_TruncatesWithMore()
|
||||
{
|
||||
var (text, _, _) = MergePreviewPresenter.Describe(
|
||||
new MergePreviewDto("conflict", new[] { "a", "b", "c", "d", "e" }, 0));
|
||||
Assert.Equal("Conflicts in a, b, c (+2 more)", text);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Unavailable_IsMuted()
|
||||
{
|
||||
var (text, clean, conflict) = MergePreviewPresenter.Describe(
|
||||
new MergePreviewDto("unavailable", System.Array.Empty<string>(), 0));
|
||||
Assert.Equal("Mergeability unknown", text);
|
||||
Assert.False(clean);
|
||||
Assert.False(conflict);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Null_IsEmpty()
|
||||
{
|
||||
var (text, clean, conflict) = MergePreviewPresenter.Describe(null);
|
||||
Assert.Equal("", text);
|
||||
Assert.False(clean);
|
||||
Assert.False(conflict);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user