diff --git a/test/server.cpp b/test/server.cpp index eb65b79e2..5d9d08b66 100644 --- a/test/server.cpp +++ b/test/server.cpp @@ -322,6 +322,53 @@ TEST_F(ServerTest, 404) EXPECT_EQ(404, zfs1_->GET(url)->status) << "url: " << url; } +TEST_F(ServerTest, RandomOnNonExistentBook) +{ + const auto r = zfs1_->GET("/ROOT/random?content=non-existent-book"); + const char expectedResponse[] = R"EXPECTEDRESPONSE( + + + + Content not found + + + + + + + + + +
+
+
+ //EOLWHITESPACEMARKER + + +
+
+ + +
+ + //EOLWHITESPACEMARKER +
+
+
+
+ +

Not Found

+ //EOLWHITESPACEMARKER +

+ No such book: non-existent-book +

+ + +)EXPECTEDRESPONSE"; + + EXPECT_EQ(r->body, removeEOLWhitespaceMarkers(expectedResponse)); +} + TEST_F(ServerTest, RandomPageRedirectsToAnExistingArticle) { auto g = zfs1_->GET("/ROOT/random?content=zimfile");