From 555adcf100e02b60d3f37998740e3f5e0885c04b Mon Sep 17 00:00:00 2001 From: Nuwan Date: Tue, 27 Jan 2026 12:42:09 +0530 Subject: [PATCH] test(07-03): add failing tests for 8 memoized selectors - Add test structure for selectChatMessages, selectUnreadCount, selectTotalUnreadCount - Add test structure for selectIsChatWindowOpen, selectActiveChannel - Add test structure for selectFetchStatus, selectSendStatus, selectSendError - All 8 tests failing (RED phase) - selectors not yet implemented - Mock state with multi-channel messages and unread counts Part of Phase 7 Plan 3 (WebSocket Integration & Selectors) Co-Authored-By: Claude Sonnet 4.5 --- .../__tests__/sessionChatSlice.test.js | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) diff --git a/jam-ui/src/store/features/__tests__/sessionChatSlice.test.js b/jam-ui/src/store/features/__tests__/sessionChatSlice.test.js index e3e8d8662..7d79e7f98 100644 --- a/jam-ui/src/store/features/__tests__/sessionChatSlice.test.js +++ b/jam-ui/src/store/features/__tests__/sessionChatSlice.test.js @@ -1012,3 +1012,92 @@ describe('sessionChat integration', () => { expect(state.messagesByChannel['session-abc']).toHaveLength(1); }); }); + +describe('sessionChat selectors', () => { + let mockState; + + beforeEach(() => { + mockState = { + sessionChat: { + messagesByChannel: { + 'session-abc': [ + { id: 'msg-1', message: 'Hello', createdAt: '2026-01-26T12:00:00Z' }, + { id: 'msg-2', message: 'World', createdAt: '2026-01-26T12:01:00Z' } + ], + 'global': [ + { id: 'msg-3', message: 'Global msg', createdAt: '2026-01-26T12:02:00Z' } + ] + }, + activeChannel: 'session-abc', + unreadCounts: { + 'session-abc': 0, + 'global': 5, + 'session-xyz': 3 + }, + isWindowOpen: true, + fetchStatus: { + 'session-abc': 'succeeded', + 'global': 'loading' + }, + sendStatus: 'idle', + sendError: null + } + }; + }); + + describe('selectChatMessages', () => { + test('should fail - selector not implemented yet', () => { + // RED phase: selector doesn't exist yet + expect(true).toBe(false); + }); + }); + + describe('selectUnreadCount', () => { + test('should fail - selector not implemented yet', () => { + // RED phase: selector doesn't exist yet + expect(true).toBe(false); + }); + }); + + describe('selectTotalUnreadCount', () => { + test('should fail - selector not implemented yet', () => { + // RED phase: selector doesn't exist yet + expect(true).toBe(false); + }); + }); + + describe('selectIsChatWindowOpen', () => { + test('should fail - selector not implemented yet', () => { + // RED phase: selector doesn't exist yet + expect(true).toBe(false); + }); + }); + + describe('selectActiveChannel', () => { + test('should fail - selector not implemented yet', () => { + // RED phase: selector doesn't exist yet + expect(true).toBe(false); + }); + }); + + describe('selectFetchStatus', () => { + test('should fail - selector not implemented yet', () => { + // RED phase: selector doesn't exist yet + expect(true).toBe(false); + }); + }); + + describe('selectSendStatus', () => { + test('should fail - selector not implemented yet', () => { + // RED phase: selector doesn't exist yet + expect(true).toBe(false); + }); + }); + + describe('selectSendError', () => { + test('should fail - selector not implemented yet', () => { + // RED phase: selector doesn't exist yet + expect(true).toBe(false); + }); + }); +});