from juris_base.models import SearchResult, JurisDocument


def test_search_result_defaults():
    r = SearchResult(id="1", texto="texto", raw={})
    assert r.fecha is None
    assert r.tribunal is None
    assert r.voces == []
    assert r.url is None


def test_juris_document_defaults():
    d = JurisDocument(id="1", texto_completo="full text")
    assert d.magistrados == []
    assert d.normas == []
    assert d.metadata == {}


def test_search_result_as_dict():
    r = SearchResult(id="1", texto="t", raw={"x": 1})
    d = r.as_dict()
    assert d["id"] == "1"
    assert d["raw"] == {"x": 1}
