Kavita/API.Tests/Entities/ComicInfoTests.cs
Joseph Milazzo 1e51e39f66
Feature/misc (#1234)
* Fixed a bug where publication status could show as filled in when total number is 0 but there is a max count.

Add ComicInfo support for LocalizedSeries which will populate a Series LocalizedName.

Fixed an issue in tag constraint issues.

* Hooked in LocalizedSeries tag into merge step in scanner.

* Hooked in LocalizedSeries from ComicInfo into Kavita and also use it to help during merge phase to avoid 2 different series, if one file is using the name of the localized series.

* Reduced some extra string creation and updated epub library to ignore bad ToCs.

* Bumped dependencies to latest. When an epub doesn't have a dc:date with publication event type, default back to just a normal dc:date tag.

* Fixed a bug where webtoon reader would error out on first load due to how we passed the function to the reader

* Reverted the centering code
2022-04-28 14:50:31 -07:00

39 lines
1.3 KiB
C#

using API.Data.Metadata;
using API.Entities.Enums;
using Xunit;
namespace API.Tests.Entities;
public class ComicInfoTests
{
#region ConvertAgeRatingToEnum
[Theory]
[InlineData("G", AgeRating.G)]
[InlineData("Everyone", AgeRating.Everyone)]
[InlineData("Teen", AgeRating.Teen)]
[InlineData("Adults Only 18+", AgeRating.AdultsOnly)]
[InlineData("Early Childhood", AgeRating.EarlyChildhood)]
[InlineData("Everyone 10+", AgeRating.Everyone10Plus)]
[InlineData("M", AgeRating.Mature)]
[InlineData("MA15+", AgeRating.Mature15Plus)]
[InlineData("Mature 17+", AgeRating.Mature17Plus)]
[InlineData("Rating Pending", AgeRating.RatingPending)]
[InlineData("X18+", AgeRating.X18Plus)]
[InlineData("Kids to Adults", AgeRating.KidsToAdults)]
[InlineData("NotValid", AgeRating.Unknown)]
[InlineData("PG", AgeRating.PG)]
[InlineData("R18+", AgeRating.R18Plus)]
public void ConvertAgeRatingToEnum_ShouldConvertCorrectly(string input, AgeRating expected)
{
Assert.Equal(expected, ComicInfo.ConvertAgeRatingToEnum(input));
}
[Fact]
public void ConvertAgeRatingToEnum_ShouldCompareCaseInsensitive()
{
Assert.Equal(AgeRating.RatingPending, ComicInfo.ConvertAgeRatingToEnum("rating pending"));
}
#endregion
}