from __future__ import annotations

import importlib.util
from pathlib import Path


ROOT = Path(__file__).resolve().parents[1]
SCRIPT_PATH = ROOT / "scripts" / "check_transforms_sidebar_sync.py"


def _load_sync_module():
    spec = importlib.util.spec_from_file_location("check_transforms_sidebar_sync", SCRIPT_PATH)
    assert spec and spec.loader
    module = importlib.util.module_from_spec(spec)
    spec.loader.exec_module(module)
    return module


def test_sidebar_and_registry_ui_ids_are_in_sync():
    module = _load_sync_module()
    diff = module.compare_sidebar_and_registry()
    assert diff == {"sidebar_only": [], "registry_only": []}
