"""Tests for code validation chain builder."""
from __future__ import annotations
from typing import Any
from unittest.mock import MagicMock, patch


class TestBuildCodeValidationChain:
    def test_builds_chain(self, groq_config: dict[str, Any]) -> None:
        from claim_validator.chains.code_validation import build_code_validation_chain
        with patch("claim_validator.chains.provider_factory.build_chat_model") as mock:
            mock.return_value = MagicMock()
            chain = build_code_validation_chain(groq_config)
            assert chain is not None

    def test_builds_chain_with_memory(self, groq_config: dict[str, Any]) -> None:
        from claim_validator.chains.code_validation import build_code_validation_chain
        from claim_validator.chains.memory.manager import MemoryManager
        with patch("claim_validator.chains.provider_factory.build_chat_model") as mock:
            mock.return_value = MagicMock()
            chain = build_code_validation_chain(groq_config, MemoryManager())
            assert chain is not None
