using ClaudeDo.Ui.ViewModels.Islands;

namespace ClaudeDo.Worker.Tests.UiVm;

public class ParseDiffStatTests
{
    [Fact]
    public void Null_Returns_Zero()
    {
        var (add, del) = DetailsIslandViewModel.ParseDiffStat(null);
        Assert.Equal(0, add);
        Assert.Equal(0, del);
    }

    [Fact]
    public void Empty_Returns_Zero()
    {
        var (add, del) = DetailsIslandViewModel.ParseDiffStat("");
        Assert.Equal(0, add);
        Assert.Equal(0, del);
    }

    [Fact]
    public void Full_Stat_Parses_Both()
    {
        var (add, del) = DetailsIslandViewModel.ParseDiffStat("2 files changed, 10 insertions(+), 3 deletions(-)");
        Assert.Equal(10, add);
        Assert.Equal(3, del);
    }

    [Fact]
    public void Insertions_Only_Returns_Zero_Deletions()
    {
        var (add, del) = DetailsIslandViewModel.ParseDiffStat("1 file changed, 5 insertions(+)");
        Assert.Equal(5, add);
        Assert.Equal(0, del);
    }
}
