Test correct behaviour, fix that behaviour
Change misleading comment
This commit is contained in:
parent
0d856d10e3
commit
4411d749b0
2 changed files with 13 additions and 2 deletions
|
|
@ -286,7 +286,7 @@ public class ScrobblingServiceTests : AbstractDbTest
|
||||||
await _readerService.MarkChaptersAsRead(user, 1, new List<Chapter>() {volume.Chapters[0]});
|
await _readerService.MarkChaptersAsRead(user, 1, new List<Chapter>() {volume.Chapters[0]});
|
||||||
await UnitOfWork.CommitAsync();
|
await UnitOfWork.CommitAsync();
|
||||||
|
|
||||||
// Call Scrobble without having any progress
|
// Call Scrobble while having some progress
|
||||||
await _service.ScrobbleReadingUpdate(user.Id, 1);
|
await _service.ScrobbleReadingUpdate(user.Id, 1);
|
||||||
var events = await UnitOfWork.ScrobbleRepository.GetAllEventsForSeries(1);
|
var events = await UnitOfWork.ScrobbleRepository.GetAllEventsForSeries(1);
|
||||||
Assert.Single(events);
|
Assert.Single(events);
|
||||||
|
|
@ -334,14 +334,24 @@ public class ScrobblingServiceTests : AbstractDbTest
|
||||||
var user = await UnitOfWork.UserRepository.GetUserByIdAsync(1);
|
var user = await UnitOfWork.UserRepository.GetUserByIdAsync(1);
|
||||||
Assert.NotNull(user);
|
Assert.NotNull(user);
|
||||||
|
|
||||||
|
var volume = await UnitOfWork.VolumeRepository.GetVolumeAsync(1, VolumeIncludes.Chapters);
|
||||||
|
Assert.NotNull(volume);
|
||||||
|
|
||||||
|
await _readerService.MarkChaptersAsRead(user, 1, new List<Chapter>() {volume.Chapters[0]});
|
||||||
|
await UnitOfWork.CommitAsync();
|
||||||
|
|
||||||
await _service.ScrobbleReadingUpdate(1, 1);
|
await _service.ScrobbleReadingUpdate(1, 1);
|
||||||
var events = await UnitOfWork.ScrobbleRepository.GetAllEventsForSeries(1);
|
var events = await UnitOfWork.ScrobbleRepository.GetAllEventsForSeries(1);
|
||||||
Assert.Empty(events);
|
Assert.Single(events);
|
||||||
|
|
||||||
|
var readEvent = events.First();
|
||||||
|
Assert.False(readEvent.IsProcessed);
|
||||||
|
|
||||||
await _hookedUpReaderService.MarkSeriesAsUnread(user, 1);
|
await _hookedUpReaderService.MarkSeriesAsUnread(user, 1);
|
||||||
await UnitOfWork.CommitAsync();
|
await UnitOfWork.CommitAsync();
|
||||||
|
|
||||||
// Existing event is deleted
|
// Existing event is deleted
|
||||||
|
await _service.ScrobbleReadingUpdate(1, 1);
|
||||||
events = await UnitOfWork.ScrobbleRepository.GetAllEventsForSeries(1);
|
events = await UnitOfWork.ScrobbleRepository.GetAllEventsForSeries(1);
|
||||||
Assert.Empty(events);
|
Assert.Empty(events);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -427,6 +427,7 @@ public class ScrobblingService : IScrobblingService
|
||||||
_unitOfWork.ScrobbleRepository.Remove(existingEvt);
|
_unitOfWork.ScrobbleRepository.Remove(existingEvt);
|
||||||
await _unitOfWork.CommitAsync();
|
await _unitOfWork.CommitAsync();
|
||||||
_logger.LogDebug("Removed scrobble event for {Series} as there is no reading progress", series.Name);
|
_logger.LogDebug("Removed scrobble event for {Series} as there is no reading progress", series.Name);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need to just update Volume/Chapter number
|
// We need to just update Volume/Chapter number
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue