Improve realtime chat delivery and notification events
فشلت بعض الفحوصات
Deploy To Ghaymah / deploy (push) Has been cancelled

هذا الالتزام موجود في:
boutmoun123
2026-06-07 14:57:36 +03:00
الأصل 22550055d3
التزام c93296ba9d
11 ملفات معدلة مع 462 إضافات و38 حذوفات

عرض الملف

@@ -18,6 +18,7 @@ describe('NotificationsService', () => {
const notificationsRepository = {
create: jest.fn().mockResolvedValue({ toJSON: () => ({ _id: 'notification-1' }) }),
countUnread: jest.fn().mockResolvedValue(5),
countUnreadByFilter: jest.fn().mockResolvedValue(0),
};
const notificationsGateway = {
emitCreated: jest.fn(),
@@ -47,6 +48,7 @@ describe('NotificationsService', () => {
const notificationsRepository = {
markAllRead: jest.fn().mockResolvedValue(4),
countUnread: jest.fn().mockResolvedValue(2),
countUnreadByFilter: jest.fn().mockResolvedValue(0),
};
const notificationsGateway = {
emitUnreadCount: jest.fn(),
@@ -63,7 +65,15 @@ describe('NotificationsService', () => {
updatedCount: 4,
unreadCount: 2,
});
expect(notificationsGateway.emitUnreadCount).toHaveBeenCalledWith('user-1', 2);
expect(notificationsGateway.emitUnreadCount).toHaveBeenCalledWith(
'user-1',
2,
expect.objectContaining({
total: 2,
interactions: 0,
messages: 0,
}),
);
});
it('throws not found for invalid notification id in markRead', async () => {
@@ -330,6 +340,7 @@ describe('NotificationsService', () => {
const notificationsRepository = {
create: jest.fn().mockResolvedValue({ toJSON: () => ({ _id: 'notification-1' }) }),
countUnread: jest.fn().mockResolvedValue(1),
countUnreadByFilter: jest.fn().mockResolvedValue(0),
};
const notificationsGateway = {
emitCreated: jest.fn(),