Tachiyomi Bugfix (#1119)
* Updated the dependencies for .NET 6.0.2 * Fixed a bad prev chapter logic where we would bleed into chapters from last volume instead of specials. * Fixed the get prev chapter code to properly walk the order according to documentation and updated some bad test cases
This commit is contained in:
parent
6f03af4fd7
commit
0f09137148
6 changed files with 86 additions and 30 deletions
|
|
@ -820,7 +820,7 @@ public class ReaderServiceTests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetPrevChapterIdAsync_ShouldMoveFromVolumeToSpecial()
|
||||
public async Task GetPrevChapterIdAsync_ShouldMoveFromSpecialToVolume()
|
||||
{
|
||||
await ResetDB();
|
||||
|
||||
|
|
@ -856,10 +856,10 @@ public class ReaderServiceTests
|
|||
var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());
|
||||
|
||||
|
||||
var prevChapter = await readerService.GetPrevChapterIdAsync(1, 1, 1, 1);
|
||||
Assert.NotEqual(-1, prevChapter);
|
||||
var prevChapter = await readerService.GetPrevChapterIdAsync(1, 2, 3, 1);
|
||||
Assert.Equal(2, prevChapter);
|
||||
var actualChapter = await _unitOfWork.ChapterRepository.GetChapterAsync(prevChapter);
|
||||
Assert.Equal("B.cbz", actualChapter.Range);
|
||||
Assert.Equal("2", actualChapter.Range);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -973,6 +973,60 @@ public class ReaderServiceTests
|
|||
Assert.Equal(-1, prevChapter);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetPrevChapterIdAsync_ShouldFindNoPrevChapterFromVolumeWithZeroChapterAndHasNormalChapters2()
|
||||
{
|
||||
await ResetDB();
|
||||
|
||||
_context.Series.Add(new Series()
|
||||
{
|
||||
Name = "Test",
|
||||
Library = new Library() {
|
||||
Name = "Test LIb",
|
||||
Type = LibraryType.Manga,
|
||||
},
|
||||
Volumes = new List<Volume>()
|
||||
{
|
||||
EntityFactory.CreateVolume("0", new List<Chapter>()
|
||||
{
|
||||
EntityFactory.CreateChapter("5", false, new List<MangaFile>()),
|
||||
EntityFactory.CreateChapter("6", false, new List<MangaFile>()),
|
||||
EntityFactory.CreateChapter("7", false, new List<MangaFile>()),
|
||||
|
||||
}),
|
||||
EntityFactory.CreateVolume("1", new List<Chapter>()
|
||||
{
|
||||
EntityFactory.CreateChapter("1", false, new List<MangaFile>()),
|
||||
EntityFactory.CreateChapter("2", false, new List<MangaFile>()),
|
||||
}),
|
||||
EntityFactory.CreateVolume("2", new List<Chapter>()
|
||||
{
|
||||
EntityFactory.CreateChapter("3", false, new List<MangaFile>()),
|
||||
EntityFactory.CreateChapter("4", false, new List<MangaFile>()),
|
||||
}),
|
||||
}
|
||||
});
|
||||
|
||||
_context.AppUser.Add(new AppUser()
|
||||
{
|
||||
UserName = "majora2007"
|
||||
});
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());
|
||||
|
||||
var prevChapter = await readerService.GetPrevChapterIdAsync(1, 2,5, 1);
|
||||
var chapterInfoDto = await _unitOfWork.ChapterRepository.GetChapterInfoDtoAsync(prevChapter);
|
||||
Assert.Equal(1, float.Parse(chapterInfoDto.ChapterNumber));
|
||||
|
||||
// This is first chapter of first volume
|
||||
prevChapter = await readerService.GetPrevChapterIdAsync(1, 2,4, 1);
|
||||
Assert.Equal(-1, prevChapter);
|
||||
//chapterInfoDto = await _unitOfWork.ChapterRepository.GetChapterInfoDtoAsync(prevChapter);
|
||||
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetPrevChapterIdAsync_ShouldFindNoPrevChapterFromChapter()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue