Summary
The JavaScript codebase lacks unit test coverage for critical state management code. Adding tests will prevent regressions and enable confident refactoring.
Scope
Priority 1: Redux Reducers (src/react/reducers/)
apiReducer - Entry CRUD operations, polling state, error handling
userReducer - Author selection, config loading
- Test state shape, immutability, edge cases
Priority 2: Redux-Observable Epics (src/react/epics/)
getEntriesEpic - Pagination, error handling
pollingEpic - Start/stop, interval handling
crudEpic - Create/update/delete operations
- Use RxJS marble testing for async flows
Priority 3: React Components
AuthorSelectOption - Keyboard navigation, focus states
EntryContainer - Edit mode, delete confirmation
- Use React Testing Library
Technical Approach
# Dependencies already available
npm test -- --coverage
// Example reducer test
describe('apiReducer', () => {
it('handles GET_ENTRIES_SUCCESS', () => {
const action = { type: 'GET_ENTRIES_SUCCESS', payload: [entry1] };
const state = apiReducer(initialState, action);
expect(state.entries).toHaveLength(1);
expect(state.loading).toBe(false);
});
});
Acceptance Criteria
References
Summary
The JavaScript codebase lacks unit test coverage for critical state management code. Adding tests will prevent regressions and enable confident refactoring.
Scope
Priority 1: Redux Reducers (
src/react/reducers/)apiReducer- Entry CRUD operations, polling state, error handlinguserReducer- Author selection, config loadingPriority 2: Redux-Observable Epics (
src/react/epics/)getEntriesEpic- Pagination, error handlingpollingEpic- Start/stop, interval handlingcrudEpic- Create/update/delete operationsPriority 3: React Components
AuthorSelectOption- Keyboard navigation, focus statesEntryContainer- Edit mode, delete confirmationTechnical Approach
Acceptance Criteria
References