from pathlib import Path from src.validators.types import parse_manifest def test_manifest_schema_parses_into_types(): """Ensure the .mindmodel/manifest.yaml parses via parse_manifest and yields a manifest-like object with a files list where each entry has a `path` key. The test relies on parse_manifest to use its PyYAML fallback when PyYAML is not available in the test environment. """ p = Path(".mindmodel/manifest.yaml") assert p.exists(), ".mindmodel/manifest.yaml must exist" manifest = parse_manifest(str(p)) # Accept either a plain mapping or the Manifest dataclass returned by # parse_manifest. Normalize to the files list for assertions. if isinstance(manifest, dict): files = manifest.get("files", []) else: # Manifest dataclass has .files attribute files = getattr(manifest, "files", []) assert isinstance(files, list), "manifest.files must be a list" assert files, "manifest must contain at least one file entry" for entry in files: assert isinstance(entry, dict), "each file entry should be a mapping" assert "path" in entry, f"file entry missing 'path': {entry}"