Files
smart-support/backend/tests/unit/test_main.py
Yaojia Wang f0699436c5 refactor: engineering improvements -- API versioning, structured logging, Alembic, error standardization, test coverage
- API versioning: all REST endpoints prefixed with /api/v1/
- Structured logging: replaced stdlib logging with structlog (console/JSON modes)
- Alembic migrations: versioned DB schema with initial migration
- Error standardization: global exception handlers for consistent envelope format
- Interrupt cleanup: asyncio background task for expired interrupt removal
- Integration tests: +30 tests (analytics, replay, openapi, error, session APIs)
- Frontend tests: +57 tests (all components, pages, useWebSocket hook)
- Backend: 557 tests, 89.75% coverage | Frontend: 80 tests, 16 test files
2026-04-06 23:19:29 +02:00

43 lines
1.3 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.6.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)
def test_health_route_registered(self) -> None:
routes = [r.path for r in app.routes if hasattr(r, "path")]
assert "/api/v1/health" in routes
def test_app_version_is_0_5_0(self) -> None:
assert app.version == "0.6.0"