mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-06-23 15:30:34 -04:00
* More cases for parsing regex * Fixed a bug where chapter cover images weren't being updated due to a missed not. * Removed a piece of code that was needed for upgrading, since all beta users agreed to wipe db. * Fixed InProgress to properly respect order and show more recent activity first. Issue is with IEntityDate LastModified not updating in DataContext. * Updated dependencies to lastest stable. * LastModified on Volumes wasn't updating, validated it does update when data is changed. * Fixed #152 - Sorting issue when finding cover image. * Fixed #151 - Sort files during scan. * Fixed #161 - Remove files that don't exist from chapters during scan. * Fixed #155 - Ignore images that start with !, expand cover detection by checking for the word cover as well as folder, and some code cleanup to make code more concise. * Fixed #153 - Ensure that we persist series name changes and don't override on scanning. * Fixed a broken unit test
67 lines
2.3 KiB
C#
67 lines
2.3 KiB
C#
using System;
|
|
using System.Linq;
|
|
using API.Comparators;
|
|
using Xunit;
|
|
|
|
namespace API.Tests.Comparers
|
|
{
|
|
public class NaturalSortComparerTest
|
|
{
|
|
[Theory]
|
|
[InlineData(
|
|
new[] {"x1.jpg", "x10.jpg", "x3.jpg", "x4.jpg", "x11.jpg"},
|
|
new[] {"x1.jpg", "x3.jpg", "x4.jpg", "x10.jpg", "x11.jpg"}
|
|
)]
|
|
[InlineData(
|
|
new[] {"Beelzebub_153b_RHS.zip", "Beelzebub_01_[Noodles].zip",},
|
|
new[] {"Beelzebub_01_[Noodles].zip", "Beelzebub_153b_RHS.zip"}
|
|
)]
|
|
[InlineData(
|
|
new[] {"[SCX-Scans]_Vandread_v02_Act02.zip", "[SCX-Scans]_Vandread_v02_Act01.zip",},
|
|
new[] {"[SCX-Scans]_Vandread_v02_Act01.zip", "[SCX-Scans]_Vandread_v02_Act02.zip",}
|
|
)]
|
|
public void TestNaturalSortComparer(string[] input, string[] expected)
|
|
{
|
|
NaturalSortComparer nc = new NaturalSortComparer();
|
|
Array.Sort(input, nc);
|
|
|
|
var i = 0;
|
|
foreach (var s in input)
|
|
{
|
|
Assert.Equal(s, expected[i]);
|
|
i++;
|
|
}
|
|
}
|
|
|
|
|
|
[Theory]
|
|
[InlineData(
|
|
new[] {"x1.jpg", "x10.jpg", "x3.jpg", "x4.jpg", "x11.jpg"},
|
|
new[] {"x1.jpg", "x3.jpg", "x4.jpg", "x10.jpg", "x11.jpg"}
|
|
)]
|
|
[InlineData(
|
|
new[] {"x2.jpg", "x10.jpg", "x3.jpg", "x4.jpg", "x11.jpg"},
|
|
new[] {"x2.jpg", "x3.jpg", "x4.jpg", "x10.jpg", "x11.jpg"}
|
|
)]
|
|
[InlineData(
|
|
new[] {"Beelzebub_153b_RHS.zip", "Beelzebub_01_[Noodles].zip",},
|
|
new[] {"Beelzebub_01_[Noodles].zip", "Beelzebub_153b_RHS.zip"}
|
|
)]
|
|
[InlineData(
|
|
new[] {"[SCX-Scans]_Vandread_v02_Act02.zip", "[SCX-Scans]_Vandread_v02_Act01.zip","[SCX-Scans]_Vandread_v02_Act07.zip",},
|
|
new[] {"[SCX-Scans]_Vandread_v02_Act01.zip", "[SCX-Scans]_Vandread_v02_Act02.zip","[SCX-Scans]_Vandread_v02_Act07.zip",}
|
|
)]
|
|
public void TestNaturalSortComparerLinq(string[] input, string[] expected)
|
|
{
|
|
NaturalSortComparer nc = new NaturalSortComparer();
|
|
var output = input.OrderBy(c => c, nc);
|
|
|
|
var i = 0;
|
|
foreach (var s in output)
|
|
{
|
|
Assert.Equal(s, expected[i]);
|
|
i++;
|
|
}
|
|
}
|
|
}
|
|
} |