import numpy as np
from unittest import mock
from unittest.mock import MagicMock
from app.core.vector_store.embedder.genai import GenAIEmbedder

def test_genai_embedder_returns_correct_shape():
    with mock.patch('requests.post') as mock_post:
        embedding_data = np.random.rand(768).tolist()
        mock_response = MagicMock()
        mock_response.raise_for_status.return_value = None
        mock_response.json.return_value = {"embedding": {"values": embedding_data}}
        mock_post.return_value = mock_response

        embedder = GenAIEmbedder("gemini-embedding-001", "fake_key", 768)
        result = embedder.embed_text("Hello world")

        assert result.shape == (1, 768)
        assert result.dtype == np.float32
