feat: /new_creative tg_bot
This commit is contained in:
24
tests/test_creative_text_formatting.py
Normal file
24
tests/test_creative_text_formatting.py
Normal 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
|
||||
Reference in New Issue
Block a user