"""
Unit tests for text content normalization.
"""


class TestProcessTextContent:
    """Verify newline and whitespace handling for text processing."""

    def test_collapses_single_newlines(self):
        from src.core.text_processor import process_text_content

        text = "Line 1\nLine 2"
        result = process_text_content(text)

        assert result == "Line 1 Line 2"

    def test_collapses_multiple_newlines(self):
        from src.core.text_processor import process_text_content

        text = "Line 1\n\n\nLine 2"
        result = process_text_content(text)

        assert result == "Line 1 Line 2"

    def test_normalizes_mixed_whitespace(self):
        from src.core.text_processor import process_text_content

        text = "Line 1\n  \t\nLine 2"
        result = process_text_content(text)

        assert "\n" not in result
        assert result == "Line 1 Line 2"

    def test_handles_empty_string(self):
        from src.core.text_processor import process_text_content

        result = process_text_content("")

        assert result == ""

    def test_preserves_text_without_newlines(self):
        from src.core.text_processor import process_text_content

        text = "Single line text"
        result = process_text_content(text)

        assert result == text
