"""VCR integration tests for CrossRefClient."""

from __future__ import annotations

from typing import Any

import pytest

from axm_bib.clients.crossref import CrossRefClient
from axm_bib.models import BibEntry


@pytest.mark.vcr
class TestCrossRefVCR:
    """Replay recorded CrossRef API responses (via habanero/requests)."""

    def test_doi_to_bibtex(self, vcr_cassette: Any) -> None:
        """DOI resolution returns a valid BibEntry."""
        client = CrossRefClient()
        entry = client.doi_to_bibtex("10.48550/arXiv.1706.03762")

        assert isinstance(entry, BibEntry)
        assert entry.raw  # non-empty BibTeX string
        assert entry.doi is not None
