mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-06-21 06:20:33 -04:00
* Fixed inputs not showing inline validation due to a missing class * Fixed some checks * Increased the button size on manga reader (develop) * Migrated a type cast to a pure pipe * Sped up the check for if SendTo should render on the menu * Don't allow user to bookmark in bookmark mode * Fixed a bug where Scan Series would skip over Specials due to how new scan loop works. * Fixed scroll to top button persisting when navigating between pages * Edit Series modal now doesn't have a lock field for Series, which can't be locked as it is inheritently locked. Added some validation to ensure Name and SortName are required. * Fixed up some spacing * Fixed actionable menu not opening submenu on mobile * Cleaned up the layout of cover image on series detail * Show all volume or chapters (if only one volume) for cover selection on series * Don't open submenu to right if there is no space * Fixed up cover image not allowing custom saves of existing series/chapter/volume images. Fixed up logging so console output matches log file. * Implemented the ability to turn off css transitions in the UI. * Updated a note internally * Code smells * Added InstallId when pinging the email service to allow throughput tracking
54 lines
2.1 KiB
C#
54 lines
2.1 KiB
C#
using System.Collections.Generic;
|
|
using System.IO.Abstractions.TestingHelpers;
|
|
using System.Linq;
|
|
using API.Entities.Enums;
|
|
using API.Extensions;
|
|
using API.Parser;
|
|
using API.Services;
|
|
using API.Services.Tasks.Scanner.Parser;
|
|
using API.Tests.Helpers;
|
|
using Microsoft.Extensions.Logging;
|
|
using NSubstitute;
|
|
using Xunit;
|
|
|
|
namespace API.Tests.Extensions;
|
|
|
|
public class ParserInfoListExtensions
|
|
{
|
|
private readonly IDefaultParser _defaultParser;
|
|
public ParserInfoListExtensions()
|
|
{
|
|
_defaultParser =
|
|
new DefaultParser(new DirectoryService(Substitute.For<ILogger<DirectoryService>>(),
|
|
new MockFileSystem()));
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(new[] {"1", "1", "3-5", "5", "8", "0", "0"}, new[] {"1", "3-5", "5", "8", "0"})]
|
|
public void DistinctVolumesTest(string[] volumeNumbers, string[] expectedNumbers)
|
|
{
|
|
var infos = volumeNumbers.Select(n => new ParserInfo() {Volumes = n}).ToList();
|
|
Assert.Equal(expectedNumbers, infos.DistinctVolumes());
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(new[] {@"Cynthia The Mission - c000-006 (v06) [Desudesu&Brolen].zip"}, new[] {@"E:\Manga\Cynthia the Mission\Cynthia The Mission - c000-006 (v06) [Desudesu&Brolen].zip"}, true)]
|
|
[InlineData(new[] {@"Cynthia The Mission - c000-006 (v06-07) [Desudesu&Brolen].zip"}, new[] {@"E:\Manga\Cynthia the Mission\Cynthia The Mission - c000-006 (v06) [Desudesu&Brolen].zip"}, true)]
|
|
[InlineData(new[] {@"Cynthia The Mission v20 c12-20 [Desudesu&Brolen].zip"}, new[] {@"E:\Manga\Cynthia the Mission\Cynthia The Mission - c000-006 (v06) [Desudesu&Brolen].zip"}, false)]
|
|
public void HasInfoTest(string[] inputInfos, string[] inputChapters, bool expectedHasInfo)
|
|
{
|
|
var infos = new List<ParserInfo>();
|
|
foreach (var filename in inputInfos)
|
|
{
|
|
infos.Add(_defaultParser.Parse(
|
|
filename,
|
|
string.Empty));
|
|
}
|
|
|
|
var files = inputChapters.Select(s => EntityFactory.CreateMangaFile(s, MangaFormat.Archive, 199)).ToList();
|
|
var chapter = EntityFactory.CreateChapter("0-6", false, files);
|
|
|
|
Assert.Equal(expectedHasInfo, infos.HasInfo(chapter));
|
|
}
|
|
}
|