MCPcopy
hub / github.com/wshobson/agents / test_curated_rules_validate

Method test_curated_rules_validate

tools/tests/test_adapters.py:514–524  ·  view source on GitHub ↗

Each emitted .mdc has only the three allowed frontmatter keys.

(self, synthetic_plugin: PluginSource, output_root: Path)

Source from the content-addressed store, hash-verified

512 assert manifest["author"] == {"name": "Jane Doe", "email": "jane@example.com"}
513
514 def test_curated_rules_validate(self, synthetic_plugin: PluginSource, output_root: Path):
515 """Each emitted .mdc has only the three allowed frontmatter keys."""
516 adapter = CursorAdapter(output_root=output_root)
517 adapter.emit_global([synthetic_plugin])
518 rules_dir = output_root / ".cursor" / "rules"
519 assert rules_dir.is_dir()
520 for mdc in rules_dir.glob("*.mdc"):
521 content = mdc.read_text()
522 fm, _ = parse_frontmatter(content)
523 invalid = set(fm.keys()) - {"description", "globs", "alwaysApply"}
524 assert not invalid, f"{mdc}: unexpected keys {invalid}"
525
526 def test_mdc_validator_handles_block_scalar(self, tmp_path: Path):
527 """A description: > block scalar with colons in body must NOT yield phantom keys."""

Callers

nothing calls this directly

Calls 3

emit_globalMethod · 0.95
CursorAdapterClass · 0.90
parse_frontmatterFunction · 0.90

Tested by

no test coverage detected