Skip to content

Commit

Permalink
Add a small test on getBestTargetBookId and flavour.
Browse files Browse the repository at this point in the history
  • Loading branch information
mgautierfr committed Feb 15, 2024
1 parent 9e5bfa3 commit be18c03
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,22 @@ TEST_F(LibraryTest, GetBestTargetBookIdInvalidNewer)
ASSERT_EQ(lib->getBestTargetBookId(invalidBookmark, kiwix::ALLOW_DOWNGRADE), bookId+"_updated1yearlater");
}

TEST_F(LibraryTest, GetBestTargetBookIdFlavour)
{
auto bookId = std::string("0c45160e-f917-760a-9159-dfe3c53cdcdd_flavour");

auto book = lib->getBookById(bookId);
EXPECT_EQ(book.getDate(), "2018-10-08");

auto invalidBookmark = createBookmark(book);
invalidBookmark.setBookId("invalid-book-id");
invalidBookmark.setDate("2020-10-08");
lib->addBookmark(invalidBookmark);

ASSERT_EQ(lib->getBestTargetBookId(invalidBookmark, kiwix::UPGRADE_ONLY), "");
ASSERT_EQ(lib->getBestTargetBookId(invalidBookmark, kiwix::ALLOW_DOWNGRADE), "0c45160e-f917-760a-9159-dfe3c53cdcdd_updated1yearlater_flavour");
}

TEST_F(LibraryTest, GetBestTargetBookIdName)
{
ASSERT_EQ(lib->getBestTargetBookId("wikipedia_fr_tunisie"), "0c45160e-f917-760a-9159-dfe3c53cdcdd_updated1yearlater");
Expand Down

0 comments on commit be18c03

Please sign in to comment.