- Replay models: StepType enum, ReplayStep, ReplayPage frozen dataclasses
- Checkpoint transformer: PostgresSaver JSONB -> structured timeline steps
- Replay API: GET /api/conversations (paginated), GET /api/replay/{thread_id}
- Analytics models: AgentUsage, InterruptStats, AnalyticsResult
- Analytics event recorder: Protocol + PostgresAnalyticsRecorder + NoOp
- Analytics queries: resolution_rate, agent_usage, escalation_rate, cost, interrupts
- Analytics API: GET /api/analytics?range=Xd with envelope response
- DB migration: analytics_events table + conversations column additions
- 74 new tests, 399 total passing, 92.87% coverage
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
"""Tests for app.main module."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
from app.main import AGENTS_YAML, FRONTEND_DIST, app
|
|
|
|
|
|
@pytest.mark.unit
|
|
class TestMainModule:
|
|
def test_app_title(self) -> None:
|
|
assert app.title == "Smart Support"
|
|
|
|
def test_app_version(self) -> None:
|
|
assert app.version == "0.4.0"
|
|
|
|
def test_agents_yaml_path_exists(self) -> None:
|
|
assert AGENTS_YAML.name == "agents.yaml"
|
|
|
|
def test_frontend_dist_path(self) -> None:
|
|
assert "frontend" in str(FRONTEND_DIST)
|
|
assert "dist" in str(FRONTEND_DIST)
|
|
|
|
def test_websocket_route_registered(self) -> None:
|
|
routes = [r.path for r in app.routes if hasattr(r, "path")]
|
|
assert "/ws" in routes
|
|
|
|
def test_replay_router_registered(self) -> None:
|
|
routes = [r.path for r in app.routes if hasattr(r, "path")]
|
|
assert any("replay" in p or "conversations" in p for p in routes)
|
|
|
|
def test_analytics_router_registered(self) -> None:
|
|
routes = [r.path for r in app.routes if hasattr(r, "path")]
|
|
assert any("analytics" in p for p in routes)
|