"""Tests for post_process utility functions.""" from app.post_process import ( append_signup_modal_to_links, convert_polymarket_links, minify_html, ) class TestConvertPolymarketLinks: def test_no_api_key_returns_unchanged(self): html = 'Link' result = convert_polymarket_links(html, api_key=None) assert result == html def test_empty_api_key_returns_unchanged(self): html = 'Link' result = convert_polymarket_links(html, api_key="") assert result == html def test_no_polymarket_links_returns_unchanged(self): html = 'Link' result = convert_polymarket_links(html, api_key="test-key") assert result == html class TestAppendSignupModal: def test_appends_modal_params(self): html = 'Link' result = append_signup_modal_to_links(html) assert "modal=signup" in result assert "td=9" in result def test_no_polymarket_links_unchanged(self): html = 'Link' result = append_signup_modal_to_links(html) assert result == html def test_preserves_existing_query_params(self): html = 'Link' result = append_signup_modal_to_links(html) assert "bar=1" in result assert "modal=signup" in result class TestMinifyHtml: def test_removes_font_face_styles(self): html = """

Hello

""" result = minify_html(html) assert "@font-face" not in result assert "Hello" in result def test_preserves_content(self): html = "

Important content

" result = minify_html(html) assert "Important content" in result def test_output_is_smaller_or_equal(self): html = """

Some content

""" result = minify_html(html) assert len(result) <= len(html)