"""
TDD Tests: Zero-Maintenance String Compliance

These tests enforce that no hardcoded German/localized strings
exist in navigation-critical code paths. The bot must rely
exclusively on structural resource_id patterns, never on
localized UI text that changes with device language.
"""


# ══════════════════════════════════════════════════════════
# 2. TelepathicEngine Following Guard must be structural
# ══════════════════════════════════════════════════════════


class TestTelepathicEngineFollowingGuardIsStructural:
    """The 'already followed' guard must not rely on German strings."""

    def test_no_german_in_following_guard_source(self):
        """Scan telepathic_engine.py for any German follow-state strings."""
        import inspect

        from GramAddict.core.telepathic_engine import TelepathicEngine

        source = inspect.getsource(TelepathicEngine)
        german_terms = ["gefolgt", "angefragt", "abonniert", "abonnieren"]
        for term in german_terms:
            assert term not in source, f"TelepathicEngine source contains German string '{term}'!"


# ══════════════════════════════════════════════════════════
# 3. DarwinEngine comment detection must be structural
# ══════════════════════════════════════════════════════════


class TestDarwinEngineCommentDetectionIsStructural:
    """The _has_comments heuristic must not rely on German strings."""

    def test_no_german_in_has_comments_source(self):
        import inspect

        from GramAddict.core.darwin_engine import DarwinEngine

        source = inspect.getsource(DarwinEngine._has_comments)
        german_terms = ["kommentar", "ansehen"]
        for term in german_terms:
            assert term not in source, f"DarwinEngine._has_comments contains German string '{term}'!"


# ══════════════════════════════════════════════════════════
# 4. ResonanceEngine comment filtering must be structural
# ══════════════════════════════════════════════════════════


class TestResonanceEngineCommentFilteringIsStructural:
    """Comment extraction blocked_exact list must not contain German strings."""

    def test_no_german_in_resonance_source(self):
        import inspect

        from GramAddict.core.resonance_engine import ResonanceEngine

        source = inspect.getsource(ResonanceEngine.extract_and_learn_comments)
        german_terms = [
            "antworten",
            "gefällt mir",
            "antworten ansehen",
            "übersetzung anzeigen",
            "antworten verbergen",
            "alle kommentare ansehen",
            "absenden",
            "gehe zu",
            "tippe auf",
            "aktionen für diesen beitrag",
        ]
        for term in german_terms:
            assert term not in source, f"ResonanceEngine.extract_and_learn_comments contains German '{term}'!"
