Hello World
"; auto result = renderer_.render(html); EXPECT_FALSE(result.text.empty()); EXPECT_NE(result.text.find("Hello World"), std::string::npos); } TEST_F(HtmlRendererTest, ExtractLinks) { const std::string html = R"( Link 1 Link 2 )"; auto links = renderer_.extractLinks(html); EXPECT_EQ(links.size(), 2); } TEST_F(HtmlRendererTest, ResolveRelativeLinks) { const std::string html = R"( Link )"; auto links = renderer_.extractLinks(html, "https://example.com/dir/"); ASSERT_EQ(links.size(), 1); EXPECT_EQ(links[0].url, "https://example.com/page.html"); } TEST_F(HtmlRendererTest, SkipScriptAndStyle) { const std::string html = R"(Visible content
)"; auto result = renderer_.render(html); EXPECT_NE(result.text.find("Visible content"), std::string::npos); EXPECT_EQ(result.text.find("alert"), std::string::npos); EXPECT_EQ(result.text.find("color: red"), std::string::npos); } TEST_F(HtmlRendererTest, RenderHeadings) { const std::string html = R"(Paragraph
)"; auto result = renderer_.render(html); EXPECT_NE(result.text.find("Heading 1"), std::string::npos); EXPECT_NE(result.text.find("Heading 2"), std::string::npos); } TEST_F(HtmlRendererTest, RenderList) { const std::string html = R"(