feat: wire frontend pages to live APIs and standardize response contracts (P1)
- Backend: Add COUNT query and paginated response shape to conversations endpoint
Returns { conversations: [...], total, page, per_page } instead of flat array
- Frontend: Replace mock data in DashboardPage with fetchAnalytics() API calls
- Frontend: Replace mock data in ReplayListPage with fetchConversations() API calls
- Frontend: Replace mock data in ReplayPage with fetchReplay() API calls
- Add proper loading, empty, and error states to all three pages
- Align ConversationSummary type with actual DB columns (created_at, status)
- Update unit and E2E tests for new paginated conversation response shape
- Add fetchone() to FakeCursor for COUNT query support in E2E tests
This commit is contained in:
@@ -44,6 +44,8 @@ class ReplayPool(FakePool):
|
||||
async def execute(self, query: str, params=None):
|
||||
from tests.e2e.conftest import FakeCursor
|
||||
|
||||
if "COUNT" in query and "conversations" in query:
|
||||
return FakeCursor([(len(self._convos),)])
|
||||
if "conversations" in query and "SELECT" in query:
|
||||
return FakeCursor(self._convos)
|
||||
if "checkpoints" in query:
|
||||
@@ -94,9 +96,11 @@ class TestFlow6ReplayConversation:
|
||||
assert resp.status_code == 200
|
||||
body = resp.json()
|
||||
assert body["success"] is True
|
||||
assert len(body["data"]) == 2
|
||||
assert body["data"][0]["thread_id"] == "conv-001"
|
||||
assert body["data"][1]["thread_id"] == "conv-002"
|
||||
data = body["data"]
|
||||
assert len(data["conversations"]) == 2
|
||||
assert data["conversations"][0]["thread_id"] == "conv-001"
|
||||
assert data["conversations"][1]["thread_id"] == "conv-002"
|
||||
assert data["total"] == 2
|
||||
|
||||
def test_list_conversations_pagination(self) -> None:
|
||||
conversations = [
|
||||
@@ -206,7 +210,8 @@ class TestFullUserJourney:
|
||||
body = resp.json()
|
||||
assert body["success"] is True
|
||||
assert any(
|
||||
c["thread_id"] == "e2e-journey-1" for c in body["data"]
|
||||
c["thread_id"] == "e2e-journey-1"
|
||||
for c in body["data"]["conversations"]
|
||||
)
|
||||
|
||||
# Step 3: Health check still works
|
||||
|
||||
Reference in New Issue
Block a user