Added support for bittorrent
This commit is contained in:
@@ -87,4 +87,39 @@ public class FileScannerServiceTests
|
||||
var act = () => FileScannerService.FindMatch(file, books);
|
||||
act.Should().NotThrow();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FindMatch_YearPrefixedFilename_StillMatchesTitle()
|
||||
{
|
||||
var books = new[] { BookFactory.Create(id: 1, title: "Project Hail Mary") };
|
||||
var file = new BookFile { Filename = "2021 - Project Hail Mary.epub", Path = "2021 - Project Hail Mary.epub" };
|
||||
|
||||
FileScannerService.FindMatch(file, books)!.Id.Should().Be(1);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FindMatch_AudiobookInSubfolder_MatchesByParentFolderName()
|
||||
{
|
||||
var books = new[] { BookFactory.Create(id: 2, title: "Project Hail Mary") };
|
||||
// m4b lives at "Andy Weir/2021 - Project Hail Mary/Project Hail Mary.m4b"
|
||||
var file = new BookFile
|
||||
{
|
||||
Filename = "Project Hail Mary.m4b",
|
||||
Path = "Andy Weir/2021 - Project Hail Mary/Project Hail Mary.m4b",
|
||||
};
|
||||
|
||||
FileScannerService.FindMatch(file, books)!.Id.Should().Be(2);
|
||||
}
|
||||
|
||||
// ── StripYearPrefix ───────────────────────────────────────────────────────
|
||||
|
||||
[Theory]
|
||||
[InlineData("2021 - project hail mary", "project hail mary")]
|
||||
[InlineData("2015 - artemis", "artemis")]
|
||||
[InlineData("project hail mary", "project hail mary")] // no prefix → unchanged
|
||||
[InlineData("diary of an asscan", "diary of an asscan")]
|
||||
public void StripYearPrefix_ReturnsExpected(string input, string expected)
|
||||
{
|
||||
FileScannerService.StripYearPrefix(input).Should().Be(expected);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user