many updates

This commit is contained in:
2026-01-11 06:06:43 -08:00
parent 67357b5038
commit 4bb86b603e
73 changed files with 2881 additions and 59 deletions

View File

@@ -0,0 +1,31 @@
from fastapi.testclient import TestClient
from main import app
from unittest.mock import MagicMock, patch
client = TestClient(app)
def test_discovery_endpoint():
# Mock the service to avoid DB calls
with patch('src.api.discovery.SegmentDiscoveryService') as MockService:
instance = MockService.return_value
instance.discover_segments.return_value = ([], []) # Empty candidates, empty debug paths
response = client.post("/api/discovery/segments", json={
"activity_type": "cycling",
"start_date": "2025-01-01T00:00:00"
})
assert response.status_code == 200
data = response.json()
assert "candidates" in data
assert isinstance(data["candidates"], list)
assert "debug_paths" in data
assert isinstance(data["debug_paths"], list)
def test_discovery_page_render():
response = client.get("/discovery")
assert response.status_code == 200
assert "Segment Discovery" in response.text