test(07-01): add failing tests for sessionChatSlice initial state
RED phase of TDD: - Write tests for all 12 initial state fields - Validates messagesByChannel, activeChannel, channelType - Validates unread tracking: unreadCounts, lastReadAt - Validates fetch state: fetchStatus, fetchError - Validates send state: sendStatus, sendError - Validates pagination: nextCursors - Validates UI state: isWindowOpen, windowPosition Tests fail as expected - slice doesn't exist yet. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
9610a371da
commit
fd44d1255f
|
|
@ -0,0 +1,81 @@
|
|||
import sessionChatReducer from '../sessionChatSlice';
|
||||
|
||||
describe('sessionChatSlice initial state', () => {
|
||||
test('has empty messagesByChannel object', () => {
|
||||
const state = sessionChatReducer(undefined, { type: 'unknown' });
|
||||
expect(state.messagesByChannel).toEqual({});
|
||||
});
|
||||
|
||||
test('has null activeChannel', () => {
|
||||
const state = sessionChatReducer(undefined, { type: 'unknown' });
|
||||
expect(state.activeChannel).toBeNull();
|
||||
});
|
||||
|
||||
test('has null channelType', () => {
|
||||
const state = sessionChatReducer(undefined, { type: 'unknown' });
|
||||
expect(state.channelType).toBeNull();
|
||||
});
|
||||
|
||||
test('has empty unreadCounts object', () => {
|
||||
const state = sessionChatReducer(undefined, { type: 'unknown' });
|
||||
expect(state.unreadCounts).toEqual({});
|
||||
});
|
||||
|
||||
test('has empty lastReadAt object', () => {
|
||||
const state = sessionChatReducer(undefined, { type: 'unknown' });
|
||||
expect(state.lastReadAt).toEqual({});
|
||||
});
|
||||
|
||||
test('has empty fetchStatus object', () => {
|
||||
const state = sessionChatReducer(undefined, { type: 'unknown' });
|
||||
expect(state.fetchStatus).toEqual({});
|
||||
});
|
||||
|
||||
test('has empty fetchError object', () => {
|
||||
const state = sessionChatReducer(undefined, { type: 'unknown' });
|
||||
expect(state.fetchError).toEqual({});
|
||||
});
|
||||
|
||||
test('has idle sendStatus', () => {
|
||||
const state = sessionChatReducer(undefined, { type: 'unknown' });
|
||||
expect(state.sendStatus).toBe('idle');
|
||||
});
|
||||
|
||||
test('has null sendError', () => {
|
||||
const state = sessionChatReducer(undefined, { type: 'unknown' });
|
||||
expect(state.sendError).toBeNull();
|
||||
});
|
||||
|
||||
test('has empty nextCursors object', () => {
|
||||
const state = sessionChatReducer(undefined, { type: 'unknown' });
|
||||
expect(state.nextCursors).toEqual({});
|
||||
});
|
||||
|
||||
test('has isWindowOpen set to false', () => {
|
||||
const state = sessionChatReducer(undefined, { type: 'unknown' });
|
||||
expect(state.isWindowOpen).toBe(false);
|
||||
});
|
||||
|
||||
test('has null windowPosition', () => {
|
||||
const state = sessionChatReducer(undefined, { type: 'unknown' });
|
||||
expect(state.windowPosition).toBeNull();
|
||||
});
|
||||
|
||||
test('complete initial state structure matches design', () => {
|
||||
const state = sessionChatReducer(undefined, { type: 'unknown' });
|
||||
expect(state).toEqual({
|
||||
messagesByChannel: {},
|
||||
activeChannel: null,
|
||||
channelType: null,
|
||||
unreadCounts: {},
|
||||
lastReadAt: {},
|
||||
fetchStatus: {},
|
||||
fetchError: {},
|
||||
sendStatus: 'idle',
|
||||
sendError: null,
|
||||
nextCursors: {},
|
||||
isWindowOpen: false,
|
||||
windowPosition: null
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
Reference in New Issue