mirror of
https://github.com/Kareadita/Kavita.git
synced 2026-05-28 02:22:37 -04:00
Tweaks (#1890)
* Updated number inputs with a more mobile friendly control * Started writing lots of unit tests on PersonHelper to try and hammer out foreign constraint * Fixes side-nav actionable alignment * Added some unit tests * Buffed out the unit tests * Applied input modes throughout the app * Fixed a small bug in refresh token validation to make it work correctly * Try out a new way to block multithreading from interacting with people during series metadata update. * Fixed the lock code to properly lock, which should help with any constraint issues. * Locking notes * Tweaked locking on people to prevent a constraint issue. This slows down the scanner a bit, but not much. Will tweak after validating on a user's server. * Replaced all DBFactory.Series with SeriesBuilder. * Replaced all DBFactory.Volume() with VolumeBuilder * Replaced SeriesMetadata with Builder * Replaced DBFactory.CollectionTag * Lots of refactoring to streamline entity creation * Fixed one of the unit tests * Refactored all of new Library() * Removed tag and genre * Removed new SeriesMetadata * Refactored new Volume() * MangaFile() * ReadingList() * Refactored all of Chapter and ReadingList * Add title to all event widget flows * Updated Base Url to inform user it doesn't work for docker users with non-root user. * Added unit test coverage to FormatChapterTitle and FormatChapterName. * Started on Unit test for scanner, but need to finish it later. --------- Co-authored-by: Robbie Davis <robbie@therobbiedavis.com>
This commit is contained in:
@@ -7,6 +7,7 @@ using API.Data;
|
||||
using API.Entities;
|
||||
using API.Entities.Enums;
|
||||
using API.Helpers;
|
||||
using API.Helpers.Builders;
|
||||
using API.Services;
|
||||
using AutoMapper;
|
||||
using Microsoft.Data.Sqlite;
|
||||
@@ -70,10 +71,10 @@ public class CollectionTagRepositoryTests
|
||||
|
||||
_context.ServerSetting.Update(setting);
|
||||
|
||||
var lib = new Library()
|
||||
{
|
||||
Name = "Manga", Folders = new List<FolderPath>() {new FolderPath() {Path = "C:/data/"}}
|
||||
};
|
||||
|
||||
var lib = new LibraryBuilder("Manga")
|
||||
.WithFolderPath(new FolderPathBuilder("C:/data/").Build())
|
||||
.Build();
|
||||
|
||||
_context.AppUser.Add(new AppUser()
|
||||
{
|
||||
@@ -118,13 +119,13 @@ public class CollectionTagRepositoryTests
|
||||
[Fact]
|
||||
public async Task RemoveTagsWithoutSeries_ShouldRemoveTags()
|
||||
{
|
||||
var library = DbFactory.Library("Test", LibraryType.Manga);
|
||||
var series = DbFactory.Series("Test 1");
|
||||
var commonTag = DbFactory.CollectionTag(0, "Tag 1");
|
||||
var library = new LibraryBuilder("Test", LibraryType.Manga).Build();
|
||||
var series = new SeriesBuilder("Test 1").Build();
|
||||
var commonTag = new CollectionTagBuilder("Tag 1").Build();
|
||||
series.Metadata.CollectionTags.Add(commonTag);
|
||||
series.Metadata.CollectionTags.Add(DbFactory.CollectionTag(0, "Tag 2"));
|
||||
series.Metadata.CollectionTags.Add(new CollectionTagBuilder("Tag 2").Build());
|
||||
|
||||
var series2 = DbFactory.Series("Test 1");
|
||||
var series2 = new SeriesBuilder("Test 1").Build();
|
||||
series2.Metadata.CollectionTags.Add(commonTag);
|
||||
library.Series.Add(series);
|
||||
library.Series.Add(series2);
|
||||
@@ -151,13 +152,13 @@ public class CollectionTagRepositoryTests
|
||||
[Fact]
|
||||
public async Task RemoveTagsWithoutSeries_ShouldNotRemoveTags()
|
||||
{
|
||||
var library = DbFactory.Library("Test", LibraryType.Manga);
|
||||
var series = DbFactory.Series("Test 1");
|
||||
var commonTag = DbFactory.CollectionTag(0, "Tag 1");
|
||||
var library = new LibraryBuilder("Test", LibraryType.Manga).Build();
|
||||
var series = new SeriesBuilder("Test 1").Build();
|
||||
var commonTag = new CollectionTagBuilder("Tag 1").Build();
|
||||
series.Metadata.CollectionTags.Add(commonTag);
|
||||
series.Metadata.CollectionTags.Add(DbFactory.CollectionTag(0, "Tag 2"));
|
||||
series.Metadata.CollectionTags.Add(new CollectionTagBuilder("Tag 2").Build());
|
||||
|
||||
var series2 = DbFactory.Series("Test 1");
|
||||
var series2 = new SeriesBuilder("Test 1").Build();
|
||||
series2.Metadata.CollectionTags.Add(commonTag);
|
||||
library.Series.Add(series);
|
||||
library.Series.Add(series2);
|
||||
|
||||
@@ -72,10 +72,9 @@ public class SeriesRepositoryTests
|
||||
|
||||
_context.ServerSetting.Update(setting);
|
||||
|
||||
var lib = new Library()
|
||||
{
|
||||
Name = "Manga", Folders = new List<FolderPath>() {new FolderPath() {Path = "C:/data/"}}
|
||||
};
|
||||
var lib = new LibraryBuilder("Manga")
|
||||
.WithFolderPath(new FolderPathBuilder("C:/data/").Build())
|
||||
.Build();
|
||||
|
||||
_context.AppUser.Add(new AppUser()
|
||||
{
|
||||
@@ -117,23 +116,13 @@ public class SeriesRepositoryTests
|
||||
|
||||
private async Task SetupSeriesData()
|
||||
{
|
||||
var library = new Library()
|
||||
{
|
||||
Name = "GetFullSeriesByAnyName Manga",
|
||||
Type = LibraryType.Manga,
|
||||
Folders = new List<FolderPath>()
|
||||
{
|
||||
new FolderPath() {Path = "C:/data/manga/"}
|
||||
},
|
||||
Series = new List<Series>()
|
||||
{
|
||||
new SeriesBuilder("The Idaten Deities Know Only Peace")
|
||||
.WithLocalizedName("Heion Sedai no Idaten-tachi")
|
||||
.WithFormat(MangaFormat.Archive)
|
||||
.Build()
|
||||
}
|
||||
|
||||
};
|
||||
var library = new LibraryBuilder("GetFullSeriesByAnyName Manga", LibraryType.Manga)
|
||||
.WithFolderPath(new FolderPathBuilder("C:/data/manga/").Build())
|
||||
.WithSeries(new SeriesBuilder("The Idaten Deities Know Only Peace")
|
||||
.WithLocalizedName("Heion Sedai no Idaten-tachi")
|
||||
.WithFormat(MangaFormat.Archive)
|
||||
.Build())
|
||||
.Build();
|
||||
|
||||
_unitOfWork.LibraryRepository.Add(library);
|
||||
await _unitOfWork.CommitAsync();
|
||||
|
||||
Reference in New Issue
Block a user