Made some small optims when checking if files are removed

This commit is contained in:
emeric
2025-07-01 21:15:04 +02:00
parent e6f0f55b95
commit 5bed2320bc
20 changed files with 237 additions and 42 deletions
+25
View File
@@ -208,4 +208,29 @@ namespace lms::db::tests
ASSERT_TRUE(visited);
}
}
TEST_F(DatabaseFixture, ArtistInfo_findAbsoluteFilePath)
{
ScopedArtistInfo artistInfo{ session };
const std::filesystem::path absoluteFilePath{ "/path/to/artist.nfo" };
{
auto transaction{ session.createWriteTransaction() };
artistInfo.get().modify()->setAbsoluteFilePath(absoluteFilePath);
}
{
auto transaction{ session.createReadTransaction() };
ArtistInfoId lastRetrievedId;
std::filesystem::path retrievedFilePath;
ArtistInfo::findAbsoluteFilePath(session, lastRetrievedId, 1, [&](ArtistInfoId artistInfoId, const std::filesystem::path& filePath) {
EXPECT_EQ(artistInfoId, artistInfo.getId());
retrievedFilePath = filePath;
});
EXPECT_EQ(retrievedFilePath, absoluteFilePath);
}
}
} // namespace lms::db::tests