import sys from pathlib import Path ROOT = Path(__file__).resolve().parents[2] if str(ROOT) not in sys.path: sys.path.insert(0, str(ROOT)) from ingestion.chunkers.resume_chunker import chunk_resume CV = """Darshan Chheda Software Engineer EXPERIENCE Founding Engineer, Alfrd | London, UK | Sep 2026 – Present - Built the product as its main engineer. Quality Assurance Tester Intern, Xsilica Software Solutions | Hyderabad, India | Apr 2023 – Oct 2023 - Caught 30+ defects before release. PROJECTS Cortex | Rust, SQLite, MCP | github.com/1337XCode/Cortex | May 2026 - Built an MCP server in Rust. """ def test_each_role_and_project_is_a_passage_named_for_it() -> None: chunks = chunk_resume(CV, doc_id="cv", title="Darshan Chheda's CV", source_url="https://x/cv.pdf", source_type="resume") sections = [chunk["metadata"]["section"] for chunk in chunks] assert "Experience: Founding Engineer, Alfrd" in sections assert "Experience: Quality Assurance Tester Intern, Xsilica Software Solutions" in sections assert "Projects: Cortex" in sections alfrd = next(chunk for chunk in chunks if chunk["metadata"]["section"] == "Experience: Founding Engineer, Alfrd") assert alfrd["text"].startswith("Darshan Chheda's CV — Experience: Founding Engineer, Alfrd:")