\n" \
+ " \n" \
+ "
\n" \
+ " No result. Would you like to
reset filter?\n" \
+ "
\n" \
+ " \n" \
+ "
\n" \
+ "
0 book(s)
\n" \
+ " \n"
+
+#define RAY_CHARLES_UNCTZ_DOWNLOAD \
+ "\n" \
+ "\n" \
+ "\n" \
+ "
\n" \
+ "
\n" \
+ "
\n" \
+ "
Download book\n" \
+ "\n" \
+ "\n" \
+ "\n" \
+ "
\n" \
+ " Download links for Ray (uncategorized) Charles\n" \
+ "
\n" \
+ "
\n" \
+ " Direct
\n" \
+ " \n" \
+ "
\n" \
+ " Sha256 hash
\n" \
+ " \n" \
+ "
\n" \
+ " Magnet link
\n" \
+ " \n" \
+ "
\n" \
+ " Torrent file
\n" \
+ " \n" \
+ "\n" \
+ ""
+
+TEST_F(LibraryServerTest, noJS) {
+ // no_js_default
+ auto r = zfs1_->GET("/ROOT%23%3F/nojs");
+ EXPECT_EQ(r->status, 200);
+ EXPECT_EQ(r->body,
+ HTML_PREAMBLE
+ FILTERS_HTML("")
+ HOME_BODY_TEXT("3")
+ CHARLES_RAY_BOOK_HTML
+ RAY_CHARLES_BOOK_HTML
+ RAY_CHARLES_UNCTZ_BOOK_HTML
+ FINAL_HTML_TEXT);
+
+ // no_js_eng_lang
+ r = zfs1_->GET("/ROOT%23%3F/nojs?lang=eng");
+ EXPECT_EQ(r->status, 200);
+ EXPECT_EQ(r->body,
+ HTML_PREAMBLE
+ FILTERS_HTML(" selected ")
+ HOME_BODY_TEXT("2")
+ RAY_CHARLES_UNCTZ_BOOK_HTML
+ RAY_CHARLES_BOOK_HTML
+ FINAL_HTML_TEXT);
+
+ // no_js_no_books
+ r = zfs1_->GET("/ROOT%23%3F/nojs?lang=fas");
+ EXPECT_EQ(r->status, 200);
+ EXPECT_EQ(r->body,
+ HTML_PREAMBLE
+ FILTERS_HTML("")
+ HOME_BODY_0_RESULTS
+ FINAL_HTML_TEXT);
+
+ // no_js_download
+ r = zfs1_->GET("/ROOT%23%3F/nojs/download/zimfile");
+ EXPECT_EQ(r->status, 200);
+ EXPECT_EQ(r->body, RAY_CHARLES_UNCTZ_DOWNLOAD);
+}
#undef EXPECT_SEARCH_RESULTS
diff --git a/test/server.cpp b/test/server.cpp
index 7f29e2644..c9cbe4f2a 100644
--- a/test/server.cpp
+++ b/test/server.cpp
@@ -97,6 +97,8 @@ const ResourceCollection resources200Compressible{
{ ZIM_CONTENT, "/ROOT%23%3F/raw/zimfile/content/A/index" },
{ ZIM_CONTENT, "/ROOT%23%3F/raw/zimfile/content/A/Ray_Charles" },
+
+ { DYNAMIC_CONTENT, "/ROOT%23%3F/nojs"},
};
const ResourceCollection resources200Uncompressible{
@@ -179,6 +181,8 @@ const ResourceCollection resources200Uncompressible{
{ DYNAMIC_CONTENT, "/ROOT%23%3F/suggest?content=zimfile" },
{ ZIM_CONTENT, "/ROOT%23%3F/raw/zimfile/meta/Creator" },
{ ZIM_CONTENT, "/ROOT%23%3F/raw/zimfile/meta/Title" },
+
+ { DYNAMIC_CONTENT, "/ROOT%23%3F/nojs/download/zimfile"},
};
ResourceCollection all200Resources()
@@ -395,6 +399,8 @@ const char* urls404[] = {
// zimfile has no Favicon nor Illustration_48x48@1 meta item
"/ROOT%23%3F/raw/zimfile/meta/Favicon",
"/ROOT%23%3F/raw/zimfile/meta/Illustration_48x48@1",
+
+ "/ROOT%23%3F/nojs/download/thiszimdoesntexist"
};
TEST_F(ServerTest, 404)