Co-authored-by: Robbie Davis <robbie@therobbiedavis.com>
Co-authored-by: Fesaa <77553571+Fesaa@users.noreply.github.com>
This commit is contained in:
Joe Milazzo 2025-02-20 19:29:05 -06:00 committed by GitHub
parent 158c119247
commit 83c63a7904
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 126 additions and 61 deletions

View file

@ -631,4 +631,50 @@ public class ScannerServiceTests : AbstractDbTest
Assert.Contains(postLib.Series, s => s.Name == "Plush");
}
[Fact]
public async Task ScanLibrary_DeleteSeriesInUI_ComeBack()
{
const string testcase = "Delete Series In UI - Manga.json";
// Setup: Generate test library
var infos = new Dictionary<string, ComicInfo>();
var library = await _scannerHelper.GenerateScannerData(testcase, infos);
var testDirectoryPath = Path.Combine(Directory.GetCurrentDirectory(),
"../../../Services/Test Data/ScannerService/ScanTests",
testcase.Replace(".json", string.Empty));
library.Folders =
[
new FolderPath() { Path = Path.Combine(testDirectoryPath, "Root 1") },
new FolderPath() { Path = Path.Combine(testDirectoryPath, "Root 2") }
];
_unitOfWork.LibraryRepository.Update(library);
await _unitOfWork.CommitAsync();
var scanner = _scannerHelper.CreateServices();
// First Scan: Everything should be added
await scanner.ScanLibrary(library.Id);
var postLib = await _unitOfWork.LibraryRepository.GetLibraryForIdAsync(library.Id, LibraryIncludes.Series);
Assert.NotNull(postLib);
Assert.Contains(postLib.Series, s => s.Name == "Accel");
Assert.Contains(postLib.Series, s => s.Name == "Plush");
// Second Scan: Delete the Series
library.Series = [];
await _unitOfWork.CommitAsync();
postLib = await _unitOfWork.LibraryRepository.GetLibraryForIdAsync(library.Id, LibraryIncludes.Series);
Assert.NotNull(postLib);
Assert.Empty(postLib.Series);
await scanner.ScanLibrary(library.Id);
postLib = await _unitOfWork.LibraryRepository.GetLibraryForIdAsync(library.Id, LibraryIncludes.Series);
Assert.Contains(postLib.Series, s => s.Name == "Accel"); // Ensure Accel is gone
Assert.Contains(postLib.Series, s => s.Name == "Plush");
}
}

View file

@ -0,0 +1,5 @@
[
"Root 1/Antarctic Press/Plush/Plush v01.cbz",
"Root 1/Antarctic Press/Plush/Plush v02.cbz",
"Root 2/Accel/Accel v01.cbz"
]