added current doc collection tests

This commit is contained in:
John Lancaster
2026-06-21 15:58:00 -05:00
parent 36032040ae
commit b98d8b782a
@@ -0,0 +1,50 @@
from __future__ import annotations
from pathlib import Path
import pytest
from personal_mcp.registry.ingest.document import MarkdownDocument
from personal_mcp.registry.ingest.prompt import PromptFilesBundle
from personal_mcp.registry.ingest.skill import SkillFilesBundle
from personal_mcp.registry.load import load_docs_registry
pytestmark = pytest.mark.unit
REPO_ROOT = Path(__file__).parents[3]
DOCS_ROOT = REPO_ROOT / "docs"
class TestCurrentDocsIngestion:
"""Covers ingestion of the repository's current docs tree."""
def test_loads_markdown_documents(self) -> None:
"""Ensures all current markdown documents can be loaded."""
docs = MarkdownDocument.from_root(DOCS_ROOT)
assert docs
def test_bundles_current_skills(self) -> None:
"""Ensures all current canonical skill documents can be bundled."""
docs = MarkdownDocument.from_root(DOCS_ROOT)
expected_slugs = {path.parent.name for path in DOCS_ROOT.glob("skills/*/SKILL.md")}
bundles = SkillFilesBundle.from_docs(docs.values())
assert {bundle.slug for bundle in bundles} == expected_slugs
def test_bundles_current_prompts(self) -> None:
"""Ensures all current canonical prompt documents can be bundled."""
docs = MarkdownDocument.from_root(DOCS_ROOT)
expected_slugs = {path.parent.name for path in DOCS_ROOT.glob("prompts/*/PROMPT.md")}
bundles = PromptFilesBundle.from_docs(docs.values())
assert {bundle.slug for bundle in bundles} == expected_slugs
def test_loads_current_registry(self) -> None:
"""Ensures the current docs registry loads without validation errors."""
registry = load_docs_registry(package_anchor="personal_mcp", docs_root="../../docs")
assert set(registry.skills_by_id) == {path.parent.name for path in DOCS_ROOT.glob("skills/*/SKILL.md")}
assert set(registry.prompts_by_id) == {path.parent.name for path in DOCS_ROOT.glob("prompts/*/PROMPT.md")}