From 7a0ab3a429c5c239cd633845b47f44cf82aecea9 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Wed, 7 Feb 2024 17:28:55 +0100 Subject: [PATCH] Update tests to check book's title with double quotes (") On top of modifying the existing test, the commit also make `MigrateBookmark` test fails as `migrateBookmarks` now migrates from `wrong-book-id-noname` to `Dummy id`. Fix will be provided in next commit. --- test/library.cpp | 45 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/test/library.cpp b/test/library.cpp index d63a44865..6aa2b00a6 100644 --- a/test/library.cpp +++ b/test/library.cpp @@ -196,7 +196,7 @@ const char * sampleOpdsStream = R"( - TED talks - Business + TED"talks" - Business urn:uuid:0189d9be-2fd0-b4b6-7300-20fab0b5cdc8 ted_en_business nodet @@ -212,6 +212,23 @@ const char * sampleOpdsStream = R"( + + Business talks about TED + Dummy id + speak_business + nodet + /meta?name=favicon&content=ted_en_business_2018-07 + 2018-08-23T00:00::00:Z + eng + Ideas worth spreading + + + + TED + + + + Mythology & Folklore Stack Exchange urn:uuid:028055ac-4acc-1d54-65e0-a96de45e1b22 @@ -302,7 +319,7 @@ TEST(LibraryOpdsImportTest, allInOne) kiwix::Manager manager(lib); manager.readOpds(sampleOpdsStream, "library-opds-import.unittests.dev"); - EXPECT_EQ(13U, lib->getBookCount(true, true)); + EXPECT_EQ(14U, lib->getBookCount(true, true)); { const kiwix::Book& book1 = lib->getBookById("0c45160e-f917-760a-9159-dfe3c53cdcdd"); @@ -332,7 +349,7 @@ TEST(LibraryOpdsImportTest, allInOne) { const kiwix::Book& book2 = lib->getBookById("0189d9be-2fd0-b4b6-7300-20fab0b5cdc8"); - EXPECT_EQ(book2.getTitle(), "TED talks - Business"); + EXPECT_EQ(book2.getTitle(), "TED\"talks\" - Business"); EXPECT_EQ(book2.getName(), "ted_en_business"); EXPECT_EQ(book2.getFlavour(), "nodet"); EXPECT_EQ(book2.getLanguages(), Langs{ "eng" }); @@ -637,7 +654,7 @@ TEST_F(LibraryTest, MigrateBookmarkOlder) TEST_F(LibraryTest, sanityCheck) { - EXPECT_EQ(lib->getBookCount(true, true), 15U); + EXPECT_EQ(lib->getBookCount(true, true), 16U); EXPECT_EQ(lib->getBooksLanguages(), std::vector({"deu", "eng", "fra", "ita", "spa"}) ); @@ -689,6 +706,7 @@ TEST_F(LibraryTest, filterLocal) ); EXPECT_FILTER_RESULTS(kiwix::Filter().local(false), + "Business talks about TED", "Encyclopédie de la Tunisie", "Encyclopédie de la Tunisie", "Encyclopédie de la Tunisie", @@ -699,7 +717,7 @@ TEST_F(LibraryTest, filterLocal) "Mathématiques", "Movies & TV Stack Exchange", "Mythology & Folklore Stack Exchange", - "TED talks - Business", + "TED\"talks\" - Business", "Tania Louis", "Wikiquote" ); @@ -708,6 +726,7 @@ TEST_F(LibraryTest, filterLocal) TEST_F(LibraryTest, filterRemote) { EXPECT_FILTER_RESULTS(kiwix::Filter().remote(true), + "Business talks about TED", "Encyclopédie de la Tunisie", "Encyclopédie de la Tunisie", "Encyclopédie de la Tunisie", @@ -719,7 +738,7 @@ TEST_F(LibraryTest, filterRemote) "Movies & TV Stack Exchange", "Mythology & Folklore Stack Exchange", "Ray Charles", - "TED talks - Business", + "TED\"talks\" - Business", "Tania Louis", "Wikiquote" ); @@ -732,21 +751,23 @@ TEST_F(LibraryTest, filterRemote) TEST_F(LibraryTest, filterByLanguage) { EXPECT_FILTER_RESULTS(kiwix::Filter().lang("eng"), + "Business talks about TED", "Granblue Fantasy Wiki", "Islam Stack Exchange", "Movies & TV Stack Exchange", "Mythology & Folklore Stack Exchange", "Ray Charles", - "TED talks - Business" + "TED\"talks\" - Business" ); EXPECT_FILTER_RESULTS(kiwix::Filter().query("lang:eng"), + "Business talks about TED", "Granblue Fantasy Wiki", "Islam Stack Exchange", "Movies & TV Stack Exchange", "Mythology & Folklore Stack Exchange", "Ray Charles", - "TED talks - Business" + "TED\"talks\" - Business" ); EXPECT_FILTER_RESULTS(kiwix::Filter().query("eng"), @@ -893,6 +914,7 @@ TEST_F(LibraryTest, filteringByEmptyQueryReturnsAllEntries) { EXPECT_FILTER_RESULTS(kiwix::Filter().query(""), "An example ZIM archive", + "Business talks about TED", "Encyclopédie de la Tunisie", "Encyclopédie de la Tunisie", "Encyclopédie de la Tunisie", @@ -904,7 +926,7 @@ TEST_F(LibraryTest, filteringByEmptyQueryReturnsAllEntries) "Movies & TV Stack Exchange", "Mythology & Folklore Stack Exchange", "Ray Charles", - "TED talks - Business", + "TED\"talks\" - Business", "Tania Louis", "Wikiquote" ); @@ -1145,6 +1167,7 @@ TEST_F(LibraryTest, removeBooksNotUpdatedSince) { EXPECT_FILTER_RESULTS(kiwix::Filter(), "An example ZIM archive", + "Business talks about TED", "Encyclopédie de la Tunisie", "Encyclopédie de la Tunisie", "Encyclopédie de la Tunisie", @@ -1156,7 +1179,7 @@ TEST_F(LibraryTest, removeBooksNotUpdatedSince) "Movies & TV Stack Exchange", "Mythology & Folklore Stack Exchange", "Ray Charles", - "TED talks - Business", + "TED\"talks\" - Business", "Tania Louis", "Wikiquote" ); @@ -1170,7 +1193,7 @@ TEST_F(LibraryTest, removeBooksNotUpdatedSince) const uint64_t rev2 = lib->getRevision(); - EXPECT_EQ(12u, lib->removeBooksNotUpdatedSince(rev)); + EXPECT_EQ(13u, lib->removeBooksNotUpdatedSince(rev)); EXPECT_GT(lib->getRevision(), rev2);