feat: /new_creative tg_bot

This commit is contained in:
Artem Tsyrulnikov
2025-12-01 13:20:08 +03:00
parent 3508a522ac
commit f7754b707d
21 changed files with 688 additions and 113 deletions

View File

@@ -0,0 +1,24 @@
"""Tests for creative text formatting helpers."""
from src.usecase.creative.text_formatting import prepare_creative_text_html
def test_placeholder_is_replaced_with_custom_tag() -> None:
source = 'Подписывайтесь: {link}!'
assert prepare_creative_text_html(source) == 'Подписывайтесь: <a class="tg-link"></a>!'
def test_label_placeholder_is_wrapped() -> None:
source = 'Жми [сюда]{link} скорее'
assert prepare_creative_text_html(source) == 'Жми <a class="tg-link">сюда</a> скорее'
def test_placeholder_replacement_is_case_insensitive() -> None:
source = 'Первый {LINK}, второй {Link}.'
expected = 'Первый <a class="tg-link"></a>, второй <a class="tg-link"></a>.'
assert prepare_creative_text_html(source) == expected
def test_plain_html_left_untouched() -> None:
source = '<b>Жми</b> и <i>делись</i>'
assert prepare_creative_text_html(source) == source