using TeleWave.Domain.Images;
using Xunit;

namespace TeleWave.Domain.Tests.Images;

public class ImageTests
{
    [Theory]
    [InlineData("jpg", ".jpg")]
    [InlineData(".PNG", ".png")]
    [InlineData("  .WebP ", ".webp")]
    public void Create_NormalizesExtension(string input, string expected)
    {
        var img = Image.Create(ImageCategory.ShowPoster, input, "poster.jpg");

        Assert.Equal(expected, img.FileExtension);
        Assert.Equal(ImageCategory.ShowPoster, img.Category);
        Assert.Equal("poster.jpg", img.OriginalFileName);
        Assert.NotEqual(Guid.Empty, img.Id);
    }

    [Fact]
    public void Create_BlankFileName_BecomesNull()
    {
        var img = Image.Create(ImageCategory.Library, ".jpg", "   ");
        Assert.Null(img.OriginalFileName);
    }
}
