diff --git a/app/chats/service.py b/app/chats/service.py index 3733a86..b775404 100644 --- a/app/chats/service.py +++ b/app/chats/service.py @@ -11,6 +11,7 @@ from app.chats.schemas import ( ChatCreateRequest, ChatDeleteRequest, ChatDiscoverRead, + ChatMemberRead, ChatJoinByInviteRequest, ChatNotificationSettingsRead, ChatNotificationSettingsUpdate, diff --git a/docs/core-checklist-status.md b/docs/core-checklist-status.md index 9c21053..db5dd9d 100644 --- a/docs/core-checklist-status.md +++ b/docs/core-checklist-status.md @@ -11,7 +11,7 @@ Legend: 2. User Profile - `DONE` (username, name, avatar, bio, update) 3. User Status - `PARTIAL` (online/last seen/offline; web now formats `just now/today/yesterday/recently`, backend-side presence heuristics still limited) 4. Contacts - `PARTIAL` (list/search/add/remove/block/unblock; `add by email` flow covered by integration tests including `success/not found/blocked conflict`; web now surfaces specific add-by-email errors (`not found` vs `blocked`); UX moved to menu) -5. Chat List - `DONE` (all/pinned/archive/sort/unread; saved-messages delete behavior covered: clear history without deleting chat) +5. Chat List - `DONE` (all/pinned/archive/sort/unread; saved-messages delete behavior covered: clear history without deleting chat; regression test covers `GET /chats/{saved_id}` detail response) 6. Chat Types - `DONE` (private/group/channel) 7. Chat Creation - `DONE` (private/group/channel) 8. Messages (base) - `DONE` (send/read/edit/delete/delete for all; 7-day edit window enforced and covered by integration tests; group UI shows sender names over bubbles + sender avatars on incoming message clusters) diff --git a/tests/test_chat_message_flow.py b/tests/test_chat_message_flow.py index ae99fed..c09e094 100644 --- a/tests/test_chat_message_flow.py +++ b/tests/test_chat_message_flow.py @@ -135,6 +135,28 @@ async def test_delete_saved_messages_chat_clears_messages_but_keeps_chat(client, assert messages_after_delete.json() == [] +async def test_saved_messages_chat_detail_returns_200(client, db_session): + user = await _create_verified_user( + client, + db_session, + "saved_detail_user@example.com", + "saved_detail_user", + "strongpass123", + ) + auth = {"Authorization": f"Bearer {user['access_token']}"} + + saved_chat_response = await client.get("/api/v1/chats/saved", headers=auth) + assert saved_chat_response.status_code == 200 + saved_chat_id = saved_chat_response.json()["id"] + + detail_response = await client.get(f"/api/v1/chats/{saved_chat_id}", headers=auth) + assert detail_response.status_code == 200 + payload = detail_response.json() + assert payload["id"] == saved_chat_id + assert payload["is_saved"] is True + assert isinstance(payload["members"], list) + + async def test_chat_list_hides_duplicate_saved_chats_and_returns_single_saved_entry(client, db_session): user = await _create_verified_user( client,