Release Testing Time (#1785)

* Fixed a bug with getting continue point where there was a single volume unread and a later volume with chapters inside it, the chapters were being picked.

* Fixed a bug where resuming from jump key wasn't working (develop)

* Cleaned up the spacing
This commit is contained in:
Joe Milazzo 2023-02-12 13:14:13 -08:00 committed by GitHub
parent 0de927dee4
commit bdd2a0a26a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 136 additions and 34 deletions

View file

@ -2079,10 +2079,84 @@ public class ReaderServiceTests
_context.Series.Attach(series);
await _context.SaveChangesAsync();
// This tests that if you add a series later to a volume and a loose leaf chapter, we continue from that volume, rather than loose leaf
var nextChapter = await readerService.GetContinuePoint(1, 1);
Assert.Equal("14.9", nextChapter.Range);
}
[Fact]
public async Task GetContinuePoint_ShouldReturnUnreadSingleVolume_WhenThereAreSomeSingleVolumesBeforeLooseLeafChapters()
{
await ResetDb();
var readChapter1 = EntityFactory.CreateChapter("0", false, new List<MangaFile>(), 1);
var readChapter2 = EntityFactory.CreateChapter("0", false, new List<MangaFile>(), 1);
var volume = EntityFactory.CreateVolume("3", new List<Chapter>()
{
EntityFactory.CreateChapter("0", false, new List<MangaFile>(), 1),
});
_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("51", false, new List<MangaFile>(), 1),
EntityFactory.CreateChapter("52", false, new List<MangaFile>(), 1),
EntityFactory.CreateChapter("53", false, new List<MangaFile>(), 1),
}),
EntityFactory.CreateVolume("1", new List<Chapter>()
{
readChapter1
}),
EntityFactory.CreateVolume("2", new List<Chapter>()
{
readChapter2
}),
volume,
// 3, 4, and all loose leafs are unread should be unread
EntityFactory.CreateVolume("3", new List<Chapter>()
{
EntityFactory.CreateChapter("0", false, new List<MangaFile>(), 1),
}),
EntityFactory.CreateVolume("4", new List<Chapter>()
{
EntityFactory.CreateChapter("40", false, new List<MangaFile>(), 1),
EntityFactory.CreateChapter("41", false, new List<MangaFile>(), 1),
}),
}
});
_context.AppUser.Add(new AppUser()
{
UserName = "majora2007"
});
await _context.SaveChangesAsync();
var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
// Save progress on first volume chapters and 1st of second volume
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(1, AppUserIncludes.Progress);
await readerService.MarkChaptersAsRead(user, 1,
new List<Chapter>()
{
readChapter1, readChapter2
});
await _context.SaveChangesAsync();
var nextChapter = await readerService.GetContinuePoint(1, 1);
Assert.Equal(4, nextChapter.VolumeId);
}
#endregion
#region MarkChaptersUntilAsRead