Files
doc-forge/tests/renderers/mcp/test_mcp_content.py
Vishesh 'ironeagle' Bangotra 5370a7faa2 feat(mcp): add MCP JSON renderer and CLI support, update tests accordingly
- Add MCPRenderer to generate MCP-native JSON bundles (index.json, nav.json, modules/*.json)
- Expose MCPRenderer via public API and CLI (`generate-mcp` command)
- Replace Markdown-based MCP output with structured JSON resources
- Update MCP renderer type stubs to match new JSON-based implementation
- Refactor MCP tests to validate JSON content, bundle structure, and navigation
- Fix MCP module coverage test to use explicit project_root for reliable discovery
2026-01-21 16:43:21 +05:30

22 lines
561 B
Python

import json
from pathlib import Path
from docforge import MCPRenderer
from docforge.models import Project, Module
def test_mcp_file_content(tmp_path: Path):
project = Project("testpkg")
project.add_module(Module("testpkg.mod"))
out_dir = tmp_path / "mcp"
renderer = MCPRenderer()
renderer.generate_sources(project, out_dir)
module_file = out_dir / "modules" / "testpkg.mod.json"
payload = json.loads(module_file.read_text())
assert payload["module"] == "testpkg.mod"
assert payload["content"]["path"] == "testpkg.mod"