from app.agent.sanitize import TRUNCATION_SUFFIX, sanitize def test_sanitize_short_text_untouched(): assert sanitize("hallo", 20) == "hallo" def test_sanitize_truncates_with_suffix_and_respects_limit(): text = "A" * 50 result = sanitize(text, 20) assert len(result) <= 20 assert result.endswith(TRUNCATION_SUFFIX) def test_sanitize_tiny_limit_still_within_bound(): result = sanitize("A" * 50, 3) assert len(result) <= 3