mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-06-20 22:10:33 -04:00
* Moved Collapse Series with relationships into a user preference rather than library setting. * Fixed bookmarks not converting to webp after initial save * Fixed a bug where when merging we'd print out a duplicate series error when we shouldn't have * Fixed a bug where clicking on a genre or tag from server stats wouldn't load all-series page in a filtered state. * Implemented the ability to have Login role and thus disable accounts. * Ensure first time flow gets the Login role * Refactored user management screen so that pending users can be edited or deleted before the end user accepts the invite. A side effect is old legacy users that were here before email was required can now be deleted. * Show a progress bar under the main series image on larger viewports to show whole series progress. * Removed code no longer needed * Cleanup tags, people, collections without connections after editing series metadata. * Moved the Entity Builders to the main project
96 lines
2.3 KiB
C#
96 lines
2.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
|
|
|
|
#region CalculatedCount
|
|
|
|
[Fact]
|
|
public void CalculatedCount_ReturnsVolumeCount()
|
|
{
|
|
var ci = new ComicInfo()
|
|
{
|
|
Number = "5",
|
|
Volume = "10",
|
|
Count = 10
|
|
};
|
|
|
|
Assert.Equal(5, ci.CalculatedCount());
|
|
}
|
|
|
|
[Fact]
|
|
public void CalculatedCount_ReturnsNoCountWhenCountNotSet()
|
|
{
|
|
var ci = new ComicInfo()
|
|
{
|
|
Number = "5",
|
|
Volume = "10",
|
|
Count = 0
|
|
};
|
|
|
|
Assert.Equal(5, ci.CalculatedCount());
|
|
}
|
|
|
|
[Fact]
|
|
public void CalculatedCount_ReturnsNumberCount()
|
|
{
|
|
var ci = new ComicInfo()
|
|
{
|
|
Number = "5",
|
|
Volume = "",
|
|
Count = 10
|
|
};
|
|
|
|
Assert.Equal(5, ci.CalculatedCount());
|
|
}
|
|
|
|
[Fact]
|
|
public void CalculatedCount_ReturnsNumberCount_OnlyWholeNumber()
|
|
{
|
|
var ci = new ComicInfo()
|
|
{
|
|
Number = "5.7",
|
|
Volume = "",
|
|
Count = 10
|
|
};
|
|
|
|
Assert.Equal(5, ci.CalculatedCount());
|
|
}
|
|
|
|
|
|
#endregion
|
|
}
|