"""Smoke test — verifies the test scaffolding itself works.

If this passes, `uv run pytest` is wired up, the `tmp_conn` fixture builds a
DB from `openrun.db.SCHEMA`, and the schema covers every table that loaders
in `openrun.model` reference.
"""

from __future__ import annotations


EXPECTED_TABLES = frozenset({
    "activities",
    "activity_splits",
    "activity_fit_files",
    "activity_time_in_zone",
    "daily_steps",
    "daily_sleep",
    "daily_stress",
    "daily_hrv",
    "daily_body_battery",
    "daily_intensity_minutes",
    "daily_resting_hr",
    "manual_activities",
    "race_plan",
    "sync_state",
})


def test_tmp_conn_applies_full_schema(tmp_conn) -> None:
    tables = {
        row[0]
        for row in tmp_conn.execute(
            "SELECT name FROM sqlite_master WHERE type='table'"
        )
    }
    missing = EXPECTED_TABLES - tables
    assert not missing, f"schema is missing expected tables: {sorted(missing)}"
