from app.modules.rag.explain.intent_builder import ExplainIntentBuilder


def test_explain_intent_builder_extracts_route_symbol_and_file_hints() -> None:
    builder = ExplainIntentBuilder()

    intent = builder.build("Explain how /users/{user_id} reaches UserService.get_user in app/api/users.py")

    assert "/users/{user_id}" in intent.hints.endpoints
    assert "UserService.get_user" in intent.hints.symbols
    assert "app/api/users.py" in intent.hints.paths
    assert intent.expected_entry_types == ["http"]
    assert intent.include_tests is False
    assert intent.depth == "medium"


def test_explain_intent_builder_enables_tests_when_user_asks_for_them() -> None:
    builder = ExplainIntentBuilder()

    intent = builder.build("Покажи как это тестируется в pytest и какие tests покрывают UserService")

    assert intent.include_tests is True
