"""Tests para preprocess_text."""
import sys
import os

sys.path.insert(0, os.path.dirname(__file__))
from core import preprocess_text


def test_texto_con_saltos_de_linea_windows_crlf():
    text = "hello\r\nworld\r\nend"
    result = preprocess_text(text)
    assert result == "hello\nworld\nend"


def test_texto_con_multiples_newlines_consecutivos():
    text = "first\n\n\n\n\nsecond"
    result = preprocess_text(text)
    assert result == "first\n\nsecond"


def test_texto_con_espacios_leading_y_trailing_en_cada_linea():
    text = "  hello  \n  world  \n  end  "
    result = preprocess_text(text)
    assert result == "hello\nworld\nend"
