Add chat hiding mentions follow counts waveform and post fixes

This commit is contained in:
boutmoun123
2026-06-15 15:05:30 +03:00
parent 20fe06b5ed
commit 3d2a41b22a
28 changed files with 1352 additions and 75 deletions
+27
View File
@@ -27,6 +27,7 @@ describe('ChatService realtime message broadcasting', () => {
markMessageSeen: jest.fn().mockResolvedValue(undefined),
clearConversationUnreadForUser: jest.fn().mockResolvedValue(undefined),
markMessageDelivered: jest.fn().mockResolvedValue(undefined),
hideConversationForUser: jest.fn().mockResolvedValue(conversation),
};
notificationsService = {
createMessageNotification: jest.fn().mockResolvedValue(null),
@@ -163,4 +164,30 @@ describe('ChatService realtime message broadcasting', () => {
});
expect(result.seenAt).toEqual(expect.any(String));
});
it('hides a conversation for the current user only', async () => {
const result = await service.hideConversationForMe(senderId, conversationId);
expect(chatRepository.findConversationById).toHaveBeenCalledWith(conversationId);
expect(chatRepository.hideConversationForUser).toHaveBeenCalledWith(
conversationId,
senderId,
expect.any(Date),
);
expect(chatRepository.createMessage).not.toHaveBeenCalled();
expect(result).toEqual({
success: true,
conversationId,
deletedForMe: true,
});
});
it('does not hide a conversation for a non-participant', async () => {
const outsiderId = new Types.ObjectId().toString();
await expect(service.hideConversationForMe(outsiderId, conversationId)).rejects.toThrow(
'You are not a member of this conversation',
);
expect(chatRepository.hideConversationForUser).not.toHaveBeenCalled();
});
});