## Assignment Completion - All Tasks Done ### Overview This issue tracks completion of the Take-Home Assignment: "The Untested API" --- ### ✅ Day 1 - Tests & Coverage - [x] **Unit Tests** (`taskService.test.js`) - 11 tests covering all service functions - [x] **Integration Tests** (`tasks.routes.test.js`) - 6 tests covering all API endpoints with edge cases - [x] **Coverage Target** - Achieved **91.07%** (target was 80%+) - Statement: 91.07% - Branch: 77.14% - Functions: 93.54% ### ✅ Day 2 - Part A: Bug Report - [x] **Bug Identified & Documented** in `BUG_REPORT.md` - Pagination off-by-one error in `getPaginated()` - Issue: Page calculations were 0-based instead of 1-based - Impact: `page=1` returned wrong data slice - Discovery: Caught by automated unit tests ### ✅ Day 2 - Part B: Bug Fix - [x] **Pagination Bug Fixed** in `src/services/taskService.js` - Changed: `offset = (page - 1) * limit` (1-based pagination) - Added safe defaults for page/limit normalization - All tests passing - Verified with unit tests ### ✅ Day 2 - Part C: New Feature - [x] **PATCH /tasks/:id/assign** endpoint implemented in `src/routes/tasks.js` - Accepts `assignee` string in request body - Validates non-empty assignee (returns 400 for empty) - Returns 404 if task not found - Returns 409 if already assigned (prevents reassignment) - Returns updated task object on success - Full integration test coverage included
Assignment Completion - All Tasks Done
Overview
This issue tracks completion of the Take-Home Assignment: "The Untested API"
✅ Day 1 - Tests & Coverage
taskService.test.js) - 11 tests covering all service functionstasks.routes.test.js) - 6 tests covering all API endpoints with edge cases✅ Day 2 - Part A: Bug Report
BUG_REPORT.mdgetPaginated()page=1returned wrong data slice✅ Day 2 - Part B: Bug Fix
src/services/taskService.jsoffset = (page - 1) * limit(1-based pagination)✅ Day 2 - Part C: New Feature
src/routes/tasks.jsassigneestring in request body