mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-06-10 00:54:18 -04:00
* Implemented the ability to link different series together through Edit Series. CSS pending. * Fixed up the css for related cards to show the relation * Working on making all tabs in edit seris modal save in one go. Taking a break. * Some fixes for Robbie to help with styling on * Linked series pill, center library * Centering library detail and related pill spacing - Library detail cards are now centered if total number of items is > 6 or if mobile. - Added ability to determine if mobile (viewport width <= 480px - Fixed related card spacing - Fixed related card pill spacing * Updating relation form spacing * Fixed a bug in card detail layout when there is no pagination, we create one in a way that all items render at once. * Only auto-close side nav on phones, not tablets * Fixed a bug where we had flipped state on sideNavCollapsed$ * Cleaned up some misleading comments * Implemented RBS back in and now if you have a relationship besides prequel/sequel, the target series will show a link back to it's parent. * Added Parentto pipe * Missed a relationship type Co-authored-by: Robbie Davis <robbie@therobbiedavis.com>
131 lines
5.2 KiB
C#
131 lines
5.2 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using API.Entities;
|
|
using API.Entities.Enums;
|
|
using API.Entities.Metadata;
|
|
using API.Parser;
|
|
using API.Services.Tasks;
|
|
using API.Services.Tasks.Scanner;
|
|
using API.Tests.Helpers;
|
|
using Xunit;
|
|
|
|
namespace API.Tests.Services
|
|
{
|
|
public class ScannerServiceTests
|
|
{
|
|
[Fact]
|
|
public void FindSeriesNotOnDisk_Should_Remove1()
|
|
{
|
|
var infos = new Dictionary<ParsedSeries, List<ParserInfo>>();
|
|
|
|
ParserInfoFactory.AddToParsedInfo(infos, new ParserInfo() {Series = "Darker than Black", Volumes = "1", Format = MangaFormat.Archive});
|
|
//AddToParsedInfo(infos, new ParserInfo() {Series = "Darker than Black", Volumes = "1", Format = MangaFormat.Epub});
|
|
|
|
var existingSeries = new List<Series>
|
|
{
|
|
new Series()
|
|
{
|
|
Name = "Darker Than Black",
|
|
LocalizedName = "Darker Than Black",
|
|
OriginalName = "Darker Than Black",
|
|
Volumes = new List<Volume>()
|
|
{
|
|
new Volume()
|
|
{
|
|
Number = 1,
|
|
Name = "1"
|
|
}
|
|
},
|
|
NormalizedName = API.Parser.Parser.Normalize("Darker Than Black"),
|
|
Metadata = new SeriesMetadata(),
|
|
Format = MangaFormat.Epub
|
|
}
|
|
};
|
|
|
|
Assert.Equal(1, ScannerService.FindSeriesNotOnDisk(existingSeries, infos).Count());
|
|
}
|
|
|
|
[Fact]
|
|
public void FindSeriesNotOnDisk_Should_RemoveNothing_Test()
|
|
{
|
|
var infos = new Dictionary<ParsedSeries, List<ParserInfo>>();
|
|
|
|
ParserInfoFactory.AddToParsedInfo(infos, new ParserInfo() {Series = "Darker than Black", Format = MangaFormat.Archive});
|
|
ParserInfoFactory.AddToParsedInfo(infos, new ParserInfo() {Series = "Cage of Eden", Volumes = "1", Format = MangaFormat.Archive});
|
|
ParserInfoFactory.AddToParsedInfo(infos, new ParserInfo() {Series = "Cage of Eden", Volumes = "10", Format = MangaFormat.Archive});
|
|
|
|
var existingSeries = new List<Series>
|
|
{
|
|
new Series()
|
|
{
|
|
Name = "Cage of Eden",
|
|
LocalizedName = "Cage of Eden",
|
|
OriginalName = "Cage of Eden",
|
|
NormalizedName = API.Parser.Parser.Normalize("Cage of Eden"),
|
|
Metadata = new SeriesMetadata(),
|
|
Format = MangaFormat.Archive
|
|
},
|
|
new Series()
|
|
{
|
|
Name = "Darker Than Black",
|
|
LocalizedName = "Darker Than Black",
|
|
OriginalName = "Darker Than Black",
|
|
NormalizedName = API.Parser.Parser.Normalize("Darker Than Black"),
|
|
Metadata = new SeriesMetadata(),
|
|
Format = MangaFormat.Archive
|
|
}
|
|
};
|
|
|
|
|
|
|
|
Assert.Empty(ScannerService.FindSeriesNotOnDisk(existingSeries, infos));
|
|
}
|
|
|
|
|
|
// TODO: Figure out how to do this with ParseScannedFiles
|
|
// [Theory]
|
|
// [InlineData(new [] {"Darker than Black"}, "Darker than Black", "Darker than Black")]
|
|
// [InlineData(new [] {"Darker than Black"}, "Darker Than Black", "Darker than Black")]
|
|
// [InlineData(new [] {"Darker than Black"}, "Darker Than Black!", "Darker than Black")]
|
|
// [InlineData(new [] {""}, "Runaway Jack", "Runaway Jack")]
|
|
// public void MergeNameTest(string[] existingSeriesNames, string parsedInfoName, string expected)
|
|
// {
|
|
// var collectedSeries = new ConcurrentDictionary<ParsedSeries, List<ParserInfo>>();
|
|
// foreach (var seriesName in existingSeriesNames)
|
|
// {
|
|
// AddToParsedInfo(collectedSeries, new ParserInfo() {Series = seriesName, Format = MangaFormat.Archive});
|
|
// }
|
|
//
|
|
// var actualName = new ParseScannedFiles(_bookService, _logger).MergeName(collectedSeries, new ParserInfo()
|
|
// {
|
|
// Series = parsedInfoName,
|
|
// Format = MangaFormat.Archive
|
|
// });
|
|
//
|
|
// Assert.Equal(expected, actualName);
|
|
// }
|
|
|
|
// [Fact]
|
|
// public void RemoveMissingSeries_Should_RemoveSeries()
|
|
// {
|
|
// var existingSeries = new List<Series>()
|
|
// {
|
|
// EntityFactory.CreateSeries("Darker than Black Vol 1"),
|
|
// EntityFactory.CreateSeries("Darker than Black"),
|
|
// EntityFactory.CreateSeries("Beastars"),
|
|
// };
|
|
// var missingSeries = new List<Series>()
|
|
// {
|
|
// EntityFactory.CreateSeries("Darker than Black Vol 1"),
|
|
// };
|
|
// existingSeries = ScannerService.RemoveMissingSeries(existingSeries, missingSeries, out var removeCount).ToList();
|
|
//
|
|
// Assert.DoesNotContain(missingSeries[0].Name, existingSeries.Select(s => s.Name));
|
|
// Assert.Equal(missingSeries.Count, removeCount);
|
|
// }
|
|
|
|
|
|
|
|
}
|
|
}
|