from session_bot.render import build_channel_text def test_build_channel_text_includes_phrase_and_status() -> None: config = { "template_text": "{{hidden_link}}\nheader\n\n{{actors}}", "hidden_link_url": "https://example.com/image.png", "actors": [ { "key": "astat", "display_name": "ASTAT", "display_html": "ASTAT", "link": "https://t.me/example", "pronouns": "he/him", "meta_html": " he/him ", "emoji": "🌟", "default_status": "backstage", "phrases": {"open": "ΠΏΡ€ΠΈΠ½ΠΈΠΌΠ°Π΅Ρ‚ Ρ‚Π΅ΠΉΠΊΠΈ"}, } ], "status_labels": {"open": "исполняСт Ρ€ΠΎΠ»ΡŒ", "backstage": "Π² Π·Π°ΠΊΡƒΠ»ΠΈΡΡŒΠ΅"}, } state = {"actors": {"astat": {"status": "open", "phrase": "Π³ΠΎΡ‚ΠΎΠ² ΠΊ ΠΈΠ³Ρ€Π΅"}}} text = build_channel_text(config, state) assert '' in text assert 'ASTAT' in text assert "исполняСт Ρ€ΠΎΠ»ΡŒ" in text assert "Π³ΠΎΡ‚ΠΎΠ² ΠΊ ΠΈΠ³Ρ€Π΅" in text def test_build_channel_text_supports_per_actor_placeholders() -> None: config = { "template_text": "HEAD\n\n{{actor:astat}}\n\nMID\n\n{{actor:mari}}\n\nTAIL", "actors": [ { "key": "astat", "display_name": "ASTAT", "display_html": "ASTAT", "link": "https://t.me/astat", "pronouns": "he/him", "meta_html": " he/him ", "emoji": "🌟", "default_status": "backstage", "phrases": {"backstage": "Π² Π·Π°ΠΊΡƒΠ»ΠΈΡΡŒΠ΅."}, }, { "key": "mari", "display_name": "MARI", "display_html": "MARI", "link": "https://t.me/mari", "pronouns": "she/her", "meta_html": " she/her ", "emoji": "🌟", "default_status": "open", "phrases": {"open": "исполняСт Ρ€ΠΎΠ»ΡŒ."}, }, ], } state = {"actors": {}} text = build_channel_text(config, state) assert text.count("ASTAT") == 1 assert text.count("MARI") == 1