from app.models.upstream.commit_analysis import CommitAnalysisDocument
from app.services.commit_embed_text import build_commit_embed_text


def test_build_commit_embed_text_includes_git_metadata():
    analysis = CommitAnalysisDocument(
        analysis_id="analysis_1",
        repo_id="ad/example-repo",
        commit_sha="abc123",
        summary="Refactor parser",
        author_name="Alice",
        author_email="alice@example.com",
        authored_at="2026-06-01T10:00:00+00:00",
        commit_message="Refactor parser\n\nDetails here.",
        changed_files=["internal/parser/commits.go"],
        impacted_symbols=["ProcessCommitsChanged"],
    )
    text = build_commit_embed_text(analysis)
    assert "Commit abc123" in text
    assert "Author: Alice <alice@example.com>" in text
    assert "Message:" in text
    assert "Details here." in text
    assert "Summary: Refactor parser" in text
    assert "internal/parser/commits.go" in text
    assert "ProcessCommitsChanged" in text
