42авфаыв
Some checks failed
CI / Lint (ruff + mypy) (push) Failing after 32s
CI / Run tests (push) Has been skipped
CI / Docker build test (push) Successful in 11s

This commit is contained in:
2026-04-02 22:41:38 +07:00
parent fd45c1864e
commit 94afa86920
3 changed files with 115 additions and 6 deletions

View File

@@ -1,4 +1,5 @@
from session_bot.render import build_channel_text
from session_bot.html_entities import html_to_text_entities
def test_build_channel_text_includes_phrase() -> None:
@@ -111,3 +112,13 @@ def test_plain_links_are_converted_to_html() -> None:
text = build_channel_text(config, {"actors": {}})
assert '<a href="https://example.com">rules</a>' in text
def test_html_to_text_entities_supports_custom_emoji_and_links() -> None:
text, entities = html_to_text_entities(
'<tg-emoji emoji-id="123">🌟</tg-emoji> <a href="https://example.com">rules</a>'
)
assert text == "🌟 rules"
assert any(entity.type == "custom_emoji" and entity.custom_emoji_id == "123" for entity in entities)
assert any(entity.type == "text_link" and entity.url == "https://example.com" for entity in entities)