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 <noreply@anthropic.com>
This commit is contained in:
Nuwan 2026-01-27 12:42:09 +05:30
parent 7a05f6e453
commit 555adcf100
1 changed files with 89 additions and 0 deletions

View File

@ -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);
});
});
});