from unittest.mock import patch, MagicMock

def test_send_invokes_adapter_send() -> None:
 import src.ai_client as ai_client
 ai_client._gemini_cli_adapter = None
 with patch('src.gemini_cli_adapter.subprocess.Popen') as mock_popen:
  mock_process = MagicMock()
  mock_process.communicate.return_value = ('{"type": "message", "content": "Hello from mock adapter"}', '')
  mock_process.returncode = 0
  mock_popen.return_value = mock_process
  ai_client.set_provider("gemini_cli", "gemini-2.0-flash")
  res = ai_client.send("context", "msg")
  assert res == "Hello from mock adapter"
