import pytest


def test_registry_contains_exactly_five_standard_widgets():
    from app.core.workbench.registry import WIDGET_REGISTRY

    assert set(WIDGET_REGISTRY) == {"pending_reviews", "order_status", "product_stats", "datasource_health", "n8n_executions"}


def test_layout_rejects_unknown_widgets_and_sizes():
    from app.core.workbench.registry import validate_layout

    with pytest.raises(ValueError):
        validate_layout([{"id": "arbitrary_sql", "x": 0, "y": 0, "w": 2, "h": 2}])
    with pytest.raises(ValueError):
        validate_layout([{"id": "pending_reviews", "x": 0, "y": 0, "w": 99, "h": 2}])
