-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
good first issueGood for newcomersGood for newcomers
Description
🧪 Add Unit Tests for useTodos Hook
📋 Overview
Create comprehensive unit tests for the useTodos custom hook to ensure all CRUD operations, error handling, and state management work correctly.
🎯 Acceptance Criteria
- Test file
hooks/use-todos.spec.tsis created - Tests cover all hook functions:
addTodo,updateTodo,toggleTodo,deleteTodo - Tests verify loading states and error handling
- API calls are properly mocked
- Tests ensure state updates correctly after operations
- All tests pass with
npm test
🔧 Technical Requirements
- Use Jest + React Testing Library
- Mock fetch API calls
- Test both success and error scenarios
- TypeScript support for test files
🚫 Out of Scope
- Integration tests with real API
- Component integration testing
- End-to-end testing scenarios
- Performance testing
- Testing Next.js specific features
📚 Resources
💡 Testing Tips
- Test one function at a time
- Always test both happy and unhappy cases
- Use descriptive test names
- Mock external dependencies
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomers