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:
parent
eec03d7e96
commit
385f61f9f0
105 changed files with 2257 additions and 2660 deletions
|
|
@ -7,6 +7,7 @@ using System.Threading.Tasks;
|
|||
using API.Entities;
|
||||
using API.Entities.Enums;
|
||||
using API.Helpers;
|
||||
using API.Helpers.Builders;
|
||||
using API.Services;
|
||||
using API.Services.Tasks.Metadata;
|
||||
using API.SignalR;
|
||||
|
|
@ -43,25 +44,26 @@ public class WordCountAnalysisTests : AbstractDbTest
|
|||
public async Task ReadingTimeShouldBeNonZero()
|
||||
{
|
||||
await ResetDb();
|
||||
var series = EntityFactory.CreateSeries("Test Series");
|
||||
series.Format = MangaFormat.Epub;
|
||||
var chapter = EntityFactory.CreateChapter("", false, new List<MangaFile>()
|
||||
{
|
||||
EntityFactory.CreateMangaFile(
|
||||
Path.Join(_testDirectory, "The Golden Harpoon; Or, Lost Among the Floes A Story of the Whaling Grounds.epub"),
|
||||
MangaFormat.Epub, 0)
|
||||
});
|
||||
var series = new SeriesBuilder("Test Series")
|
||||
.WithFormat(MangaFormat.Epub)
|
||||
.Build();
|
||||
|
||||
_context.Library.Add(new Library()
|
||||
{
|
||||
Name = "Test",
|
||||
Type = LibraryType.Book,
|
||||
Series = new List<Series>() {series}
|
||||
});
|
||||
var chapter = new ChapterBuilder("")
|
||||
.WithFile(new MangaFileBuilder(
|
||||
Path.Join(_testDirectory,
|
||||
"The Golden Harpoon; Or, Lost Among the Floes A Story of the Whaling Grounds.epub"),
|
||||
MangaFormat.Epub).Build())
|
||||
.Build();
|
||||
|
||||
_context.Library.Add(new LibraryBuilder("Test LIb", LibraryType.Book)
|
||||
.WithSeries(series)
|
||||
.Build());
|
||||
|
||||
series.Volumes = new List<Volume>()
|
||||
{
|
||||
EntityFactory.CreateVolume("0", new List<Chapter>() {chapter})
|
||||
new VolumeBuilder("0")
|
||||
.WithChapter(chapter)
|
||||
.Build(),
|
||||
};
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
|
|
@ -98,26 +100,23 @@ public class WordCountAnalysisTests : AbstractDbTest
|
|||
public async Task ReadingTimeShouldIncreaseWhenNewBookAdded()
|
||||
{
|
||||
await ResetDb();
|
||||
var series = EntityFactory.CreateSeries("Test Series");
|
||||
series.Format = MangaFormat.Epub;
|
||||
var chapter = EntityFactory.CreateChapter("", false, new List<MangaFile>()
|
||||
{
|
||||
EntityFactory.CreateMangaFile(
|
||||
Path.Join(_testDirectory, "The Golden Harpoon; Or, Lost Among the Floes A Story of the Whaling Grounds.epub"),
|
||||
MangaFormat.Epub, 0)
|
||||
});
|
||||
var chapter = new ChapterBuilder("")
|
||||
.WithFile(new MangaFileBuilder(
|
||||
Path.Join(_testDirectory,
|
||||
"The Golden Harpoon; Or, Lost Among the Floes A Story of the Whaling Grounds.epub"),
|
||||
MangaFormat.Epub).Build())
|
||||
.Build();
|
||||
var series = new SeriesBuilder("Test Series")
|
||||
.WithFormat(MangaFormat.Epub)
|
||||
.WithVolume(new VolumeBuilder("0")
|
||||
.WithChapter(chapter)
|
||||
.Build())
|
||||
.Build();
|
||||
|
||||
_context.Library.Add(new Library()
|
||||
{
|
||||
Name = "Test",
|
||||
Type = LibraryType.Book,
|
||||
Series = new List<Series>() {series}
|
||||
});
|
||||
_context.Library.Add(new LibraryBuilder("Test", LibraryType.Book)
|
||||
.WithSeries(series)
|
||||
.Build());
|
||||
|
||||
series.Volumes = new List<Volume>()
|
||||
{
|
||||
EntityFactory.CreateVolume("0", new List<Chapter>() {chapter})
|
||||
};
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
|
|
@ -125,18 +124,19 @@ public class WordCountAnalysisTests : AbstractDbTest
|
|||
var cacheService = new CacheHelper(new FileService());
|
||||
var service = new WordCountAnalyzerService(Substitute.For<ILogger<WordCountAnalyzerService>>(), _unitOfWork,
|
||||
Substitute.For<IEventHub>(), cacheService, _readerService);
|
||||
|
||||
|
||||
await service.ScanSeries(1, 1);
|
||||
|
||||
var chapter2 = EntityFactory.CreateChapter("2", false, new List<MangaFile>()
|
||||
{
|
||||
EntityFactory.CreateMangaFile(
|
||||
Path.Join(_testDirectory, "The Golden Harpoon; Or, Lost Among the Floes A Story of the Whaling Grounds.epub"),
|
||||
MangaFormat.Epub, 0)
|
||||
});
|
||||
var chapter2 = new ChapterBuilder("2")
|
||||
.WithFile(new MangaFileBuilder(
|
||||
Path.Join(_testDirectory,
|
||||
"The Golden Harpoon; Or, Lost Among the Floes A Story of the Whaling Grounds.epub"),
|
||||
MangaFormat.Epub).Build())
|
||||
.Build();
|
||||
|
||||
series.Volumes.Add(EntityFactory.CreateVolume("1", new List<Chapter>() {chapter2}));
|
||||
|
||||
series.Volumes.Add(new VolumeBuilder("1")
|
||||
.WithChapter(chapter2)
|
||||
.Build());
|
||||
|
||||
series.Volumes.First().Chapters.Add(chapter2);
|
||||
await _unitOfWork.CommitAsync();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue