"""/api/analytics/health:E0-lite 冒烟。""" from __future__ import annotations from app.db.models import MsgDailyStats async def test_health_empty(make_client): async def seed(session): ... client = await make_client(seed) r = await client.get("/api/analytics/health") assert r.status_code == 200 body = r.json() assert body["data_as_of"] is None assert any(e["table"] == "message" for e in body["entities"]) async def test_health_with_stats(make_client): async def seed(session): session.add( MsgDailyStats( channel="wechat", owner_account_id="wx1", peer_kind="friend", peer_id="t1", day=20260904, send_cnt=1, recv_cnt=2, last_ts=1756900000000, last_is_send=False, ) ) await session.commit() client = await make_client(seed) r = await client.get("/api/analytics/health") assert r.status_code == 200 assert r.json()["data_as_of"] == 1756900000000