"""Shared helpers, constants, and Background steps for UKO Indexer behave tests. All steps prefixed with ``idx`` to avoid AmbiguousStep collisions with other feature files. """ from __future__ import annotations from typing import Any from behave import given # type: ignore[import-untyped] from cleveragents.domain.models.acms.analyzers import AnalyzerRegistry from cleveragents.domain.models.acms.index_stubs import ( InMemoryGraphIndexBackend, InMemoryTextIndexBackend, InMemoryVectorIndexBackend, ) from cleveragents.domain.models.core.resource import Resource from features.mocks.uko_indexer_mocks import InMemoryContentReader __all__: list[str] = [] ULID_1 = "01HQ8ZDRX50000000000000001" DEFAULT_PROJECT = "local/test" # --------------------------------------------------------------------------- # Test helpers # --------------------------------------------------------------------------- def _make_resource( resource_id: str, location: str | None = "src/main.py", resource_type_name: str = "git-checkout", ) -> Resource: """Create a minimal Resource for testing.""" return Resource( resource_id=resource_id, resource_type_name=resource_type_name, classification="physical", location=location, ) # --------------------------------------------------------------------------- # Background steps # --------------------------------------------------------------------------- @given("idx a clean analyzer registry") def step_clean_registry(context: Any) -> None: context.idx_registry = AnalyzerRegistry() context.idx_content_reader = InMemoryContentReader() @given("idx in-memory index backends") def step_in_memory_backends(context: Any) -> None: context.idx_text_backend = InMemoryTextIndexBackend() context.idx_vector_backend = InMemoryVectorIndexBackend() context.idx_graph_backend = InMemoryGraphIndexBackend()