import pytest
from modules.message_studio.unicode_styler import UnicodeStyler, TextStyle, UNICODE_SYMBOLS


def test_small_caps_transformation():
    text = "Premium Menu"
    result = UnicodeStyler.to_small_caps(text)
    assert result == "ᴘʀᴇᴍɪᴜᴍ ᴍᴇɴᴜ"

    text2 = "Payment Invoice"
    result2 = UnicodeStyler.to_small_caps(text2)
    assert result2 == "ᴘᴀʏᴍᴇɴᴛ ɪɴᴠᴏɪᴄᴇ"


def test_tag_and_variable_preservation():
    text = "<b>Premium Menu</b> for {first_name}: {amount}"
    result = UnicodeStyler.to_small_caps(text, preserve_tags=True, preserve_variables=True)
    assert result == "<b>ᴘʀᴇᴍɪᴜᴍ ᴍᴇɴᴜ</b> ғᴏʀ {first_name}: {amount}"
    assert "<b>" in result
    assert "</b>" in result
    assert "{first_name}" in result
    assert "{amount}" in result


def test_other_unicode_styles():
    text = "Hello 123"

    sans_bold = UnicodeStyler.style_text(text, TextStyle.SANS_BOLD)
    assert sans_bold == "𝗛𝗲𝗹𝗹𝗼 𝟭𝟮𝟯"

    serif_bold = UnicodeStyler.style_text(text, TextStyle.SERIF_BOLD)
    assert serif_bold == "𝐇𝐞𝐥𝐥𝐨 𝟏𝟐𝟑"

    monospace = UnicodeStyler.style_text(text, TextStyle.MONOSPACE)
    assert monospace == "𝙷𝚎𝚕𝚕𝚘 𝟷𝟸𝟹"


def test_symbol_catalog_contents():
    catalog = UnicodeStyler.get_symbol_catalog()
    assert "stars" in catalog
    assert "bullets" in catalog
    assert "bars" in catalog
    assert "✫" in catalog["stars"]
    assert "❍" in catalog["bullets"]
    assert "▰" in catalog["bars"]
    assert "▱" in catalog["bars"]
    assert "💎" in catalog["commerce"]
