Filter detected sellers from conversations

This commit is contained in:
jjbrunton committed 2026-08-09 14:38:03 +01:00
1 parent d5ebdec076
commit 92c54feedc
14 files changed
+97 -7

No files matched your search

+22
View File
@@ -226,6 +226,28 @@ describe('conversations route', () => {
expect(await response.json()).toEqual([{ ...conversation, hasReceivedImages: true }]);
});
it('marks conversations with a durable seller detection', async () => {
const conversation = {
username: 'seller', roomName: 'seller', roomId: 'room-seller',
lastMessageTime: 1, lastMessageSnippet: 'my page', isFromUs: false, unread: true,
};
const context = {
logger: { error: vi.fn() },
services: {
chat: { getCachedConversations: vi.fn().mockResolvedValue([conversation]) },
conversationState: {
get: vi.fn(() => ({ sellerDetected: true })),
},
},
} as unknown as WebContext;
const app = express().use('/api', createConversationsRouter(context));
const response = await request(app, '/api/conversations');
expect(response.status).toBe(200);
expect(await response.json()).toEqual([{ ...conversation, sellerDetected: true }]);
});
it('serves conversation details without starting a delta sync', async () => {
const conversation = {
username: 'alice',