#include "json_html_serializer.hpp" #include #include #include namespace json_html_util { namespace { const std::string boilerplateStart = "\n" "\n" "Redfish API\n" "\n" "\n" "\n" "
\n" "\"redfish\"\n"; const std::string boilerplateEnd = "
\n" "\n" "\n"; TEST(JsonHtmlSerializer, dumpHtmlLink) { std::string out; nlohmann::json j; j["@odata.id"] = "/redfish/v1"; dumpHtml(out, j); EXPECT_EQ( out, boilerplateStart + "
\n" "{
"@odata.id": \"/redfish/v1\"
}
\n" + boilerplateEnd); } TEST(JsonHtmlSerializer, dumpint) { std::string out; nlohmann::json j = 42; dumpHtml(out, j); EXPECT_EQ(out, boilerplateStart + "
\n42
\n" + boilerplateEnd); } TEST(JsonHtmlSerializer, dumpstring) { std::string out; nlohmann::json j = "foobar"; dumpHtml(out, j); EXPECT_EQ(out, boilerplateStart + "
\n\"foobar\"
\n" + boilerplateEnd); } } // namespace } // namespace json_html_util