from __future__ import annotations

from pathlib import Path

from eightmem.importers.parser import load_messages


def test_importer_parses_json(tmp_path: Path):
    path = tmp_path / "chat.json"
    path.write_text('[{"role":"user","content":"I am building a product."}]', encoding="utf-8")
    messages = load_messages(path)

    assert len(messages) == 1
    assert messages[0].role == "user"
    assert "building" in messages[0].text
