diff --git a/tests/episode_tests.cpp b/tests/episode_tests.cpp
index 4b791f0..d637167 100644
--- a/tests/episode_tests.cpp
+++ b/tests/episode_tests.cpp
@@ -9,166 +9,60 @@ namespace dropout_dl {
std::string (*test_function)(const std::string&) = episode::get_episode_name;
+
+ // window.Page = {"PROPERTIES":{"VIEW_TYPE":"video","VIDEO_ID":2429553,"COLLECTION_ID":784936,"COLLECTION_TITLE":"Season 5","PRODUCT_ID":28599,"VIDEO_TITLE":"Sam Says 2","CANONICAL_COLLECTION":{"id":784936,"name":"Season 5","href":"https://www.dropout.tv/season-5-7","parent":{"id":121093,"name":"Game Changer","type":"series"}}}}
+
std::string base_test_solution = "Base Test Title";
- std::string base_test = "
\n"
- " " + base_test_solution + "\n"
- "
";
+ std::string base_test = R"(window.Page = {"VIDEO_TITLE":")" + base_test_solution + "\"}";
+
out.emplace_back("Basic Episode Name Parsing", test_function, base_test, base_test_solution);
- std::string multiple_header_test_solution = "Multi Header Test Title";
- std::string multiple_header_test = "\n"
- "Header without class or strong\n"
- "
\n"
- "\n"
- "Header with incorrect classes"
- "
\n"
- "\n"
- "Header with strong"
- "
\n"
- "\n"
- " " + multiple_header_test_solution + "\n"
- "
\n"
- "\n"
- " Valid Header and Strong After Correct Title \n"
- "
";
+ std::string full_test_solution = "Full Test Title";
+ std::string full_test = R"(window.Page = {"PROPERTIES":{"VIEW_TYPE":"video","VIDEO_ID":12345,"COLLECTION_ID":12345,"COLLECTION_TITLE":"Season 0","PRODUCT_ID":12345,"VIDEO_TITLE":")" + full_test_solution + R"(","CANONICAL_COLLECTION":{"id":12345,"name":"Season 0","href":"https://www.dropout.tv/season-0-0","parent":{"id":12345,"name":"lorem","type":"series"}}}})";
+ out.emplace_back("Full Episode Name Parsing", test_function, full_test, full_test_solution);
- out.emplace_back("Multiple Header Episode Name Parsing", test_function, multiple_header_test, multiple_header_test_solution);
+ std::string no_valid_title_test_solution = "ERROR";
+ std::string no_valid_title_test = R"(window.Page = {"PROPERTIES":{"VIEW_TYPE":"video","VIDEO_ID":12345,"COLLECTION_ID":12345,"COLLECTION_TITLE":"Season 0","PRODUCT_ID":12345,"CANONICAL_COLLECTION":{"id":12345,"name":"Season 0","href":"https://www.dropout.tv/season-0-0","parent":{"id":12345,"name":"lorem","type":"series"}}}})";
- std::string no_valid_header_test_solution = "ERROR";
- std::string no_valid_header_test = "\n"
- "Header without class or Strong\n"
- "
\n"
- "\n"
- "Header with incorrect classes"
- "
\n"
- "\n"
- "Header with strong"
- "
\n";
-
- out.emplace_back("No Valid Header Episode Name Parsing", test_function, no_valid_header_test, no_valid_header_test_solution);
+ out.emplace_back("No Valid Title Episode Name Parsing", test_function, no_valid_title_test, no_valid_title_test_solution);
std::string html_character_test_solution = "'&;";
- std::string html_character_test = "\n"
- " '&;\n"
- "
";
+ std::string html_character_test = R"(window.Page = {"PROPERTIES":{"VIEW_TYPE":"video","VIDEO_ID":12345,"COLLECTION_ID":12345,"COLLECTION_TITLE":"Season 0","PRODUCT_ID":12345,"VIDEO_TITLE":"'&;","CANONICAL_COLLECTION":{"id":12345,"name":"Season 0","href":"https://www.dropout.tv/season-0-0","parent":{"id":12345,"name":"lorem","type":"series"}}}})";
out.emplace_back("Html Character Code Episode Name Parsing", test_function, html_character_test, html_character_test_solution);
-
return {"Episode Name Parsing", out};
}
- tests test_episode_number_parsing() {
- std::vector> out;
-
- std::string (*test_function)(const std::string&) = episode::get_episode_number;
-
- std::string base_test_solution = "1";
- std::string base_test = "\n"
- " Season 1, Episode 1\n"
- "";
-
- out.emplace_back("Basic Episode Number Parsing", test_function, base_test, base_test_solution);
-
-
- std::string multiple_link_test_solution = "1";
- std::string multiple_link_test = "\n"
- "asjdhgaorihg\n"
- "\n"
- "\n"
- " Season 1, Episode 1\n"
- "\n"
- "\n"
- " Season 1, Episode 2\n";
-
-
- out.emplace_back("Multiple Link Episode Number Parsing", test_function, multiple_link_test, multiple_link_test_solution);
-
- std::string no_valid_number_test_solution = "-1";
- std::string no_valid_number_test = "\n"
- "816\n"
- "\n"
- "\n"
- "157"
- "\n"
- "\n"
- "Episode"
- "\n";
-
- out.emplace_back("No Valid Episode Number Parsing", test_function, no_valid_number_test, no_valid_number_test_solution);
-
-
- std::string earlier_episode_text_test_solution = "15";
- std::string earlier_episode_text_test = " \n"
- " Episode Wrong\n"
- "
\n"
- "\n"
- " Season 1, Episode 15\n"
- "";
-
- out.emplace_back("Earlier Episode Text Number Parsing", test_function, earlier_episode_text_test, earlier_episode_text_test_solution);
-
- return {"Episode Number Parsing", out};
- }
-
tests test_episode_series_name_parsing() {
std::vector> out;
std::string (*test_function)(const std::string&) = episode::get_series_name;
+ // window.Page = {"PROPERTIES":{"VIEW_TYPE":"collection","PRODUCT_ID":28599,"COLLECTION_ID":121093,"COLLECTION_TITLE":"Game Changer"}}
+
std::string base_test_solution = "Base Test Title";
- std::string base_test = "";
+ std::string base_test = R"(window.Page = {"parent":{"name":")" + base_test_solution + R"("}})";
out.emplace_back("Basic Episode Series Name Parsing", test_function, base_test, base_test_solution);
- std::string multiple_header_test_solution = "Multi Header Test Title";
- std::string multiple_header_test = "\n"
- "Header without class or link\n"
- "
\n"
- "\n"
- "Header with incorrect classes"
- "
\n"
- "\n"
- "\n"
- "";
+ std::string full_test_solution = "Full Test Title";
+ std::string full_test = R"(window.Page = {"PROPERTIES":{"VIEW_TYPE":"video","VIDEO_ID":12345,"COLLECTION_ID":12345,"COLLECTION_TITLE":"Season 0","PRODUCT_ID":12345,"VIDEO_TITLE":"lorem","CANONICAL_COLLECTION":{"id":12345,"name":"Season 0","href":"https://www.dropout.tv/season-0-0","parent":{"id":12345,"name":")" + full_test_solution + R"(","type":"series"}}}})";
-
- out.emplace_back("Multiple Header Episode Series Name Parsing", test_function, multiple_header_test, multiple_header_test_solution);
+ out.emplace_back("Full Series Name Parsing", test_function, full_test, full_test_solution);
std::string no_valid_header_test_solution = "ERROR";
- std::string no_valid_header_test = "\n"
- "Header without class or link\n"
- "
\n"
- "\n"
- "Header with incorrect classes"
- "
\n"
- "\n";
-
+ std::string no_valid_header_test = R"(window.Page = {"PROPERTIES":{"VIEW_TYPE":"video","VIDEO_ID":12345,"COLLECTION_ID":12345,"COLLECTION_TITLE":"Season 0","PRODUCT_ID":12345,"VIDEO_TITLE":"lorem","CANONICAL_COLLECTION":{"id":12345,"name":"Season 0","href":"https://www.dropout.tv/season-0-0","parent":{"id":12345,"type":"series"}}}})";
out.emplace_back("No Valid Header Episode Series Name Parsing", test_function, no_valid_header_test, no_valid_header_test_solution);
std::string html_character_test_solution = "'&;";
- std::string html_character_test = "\n"
- " '&;\n"
- "
";
-
+ std::string html_character_test = R"(window.Page = {"PROPERTIES":{"VIEW_TYPE":"video","VIDEO_ID":12345,"COLLECTION_ID":12345,"COLLECTION_TITLE":"Season 0","PRODUCT_ID":12345,"VIDEO_TITLE":"lorem","CANONICAL_COLLECTION":{"id":12345,"name":"Season 0","href":"https://www.dropout.tv/season-0-0","parent":{"id":12345,"name":"'&;","type":"series"}}}})";
out.emplace_back("Html Character Code Episode Series Name Parsing", test_function, html_character_test, html_character_test_solution);
return {"Series Name Parsing", out};
@@ -292,9 +186,6 @@ std::vector test_episode() {
testss.push_back(dropout_dl::test_episode_name_parsing());
- testss.push_back(dropout_dl::test_episode_number_parsing());
-
-
testss.push_back(dropout_dl::test_episode_series_name_parsing());
@@ -305,4 +196,4 @@ std::vector test_episode() {
return testss;
-}
\ No newline at end of file
+}