import json from pathlib import Path REQUIRED_TOP_LEVEL_KEYS = { "id", "name", "description", "status", "portal_type", "world_category", "environment", "access_mode", "readiness_state", "telemetry_source", "owner", "destination", } REQUIRED_DESTINATION_KEYS = {"type", "action_label"} def test_portals_json_uses_expanded_registry_schema() -> None: portals = json.loads(Path("portals.json").read_text()) assert portals, "portals.json should define at least one portal" for portal in portals: assert REQUIRED_TOP_LEVEL_KEYS.issubset(portal.keys()) assert REQUIRED_DESTINATION_KEYS.issubset(portal["destination"].keys()) def test_gameportal_protocol_documents_new_metadata_fields_and_migration() -> None: protocol = Path("GAMEPORTAL_PROTOCOL.md").read_text() for term in [ "portal_type", "world_category", "environment", "access_mode", "readiness_state", "telemetry_source", "owner", "Migration from legacy portal definitions", ]: assert term in protocol