import pytest

from app_new.utils import bootstrap_color_to_hex, bootstrap_text_color


def test_bootstrap_color_to_hex_known_colors():
    assert bootstrap_color_to_hex('primary') == '#0d6efd'
    assert bootstrap_color_to_hex('danger') == '#dc3545'
    assert bootstrap_color_to_hex('success') == '#198754'


def test_bootstrap_color_to_hex_passthrough():
    assert bootstrap_color_to_hex('#ff0000') == '#ff0000'
    assert bootstrap_color_to_hex('#abc') == '#abc'


def test_bootstrap_text_color_contrast():
    # noir = texte blanc
    assert bootstrap_text_color('#000000') == 'white'
    # blanc = texte sombre (retourne une couleur hexa bootstrap)
    assert bootstrap_text_color('#ffffff') == '#212529'
