Skip to content

Issue: Assignment Completion - All Tasks Done #15

Description

@Sankalp13353

Assignment Completion - All Tasks Done

Overview

This issue tracks completion of the Take-Home Assignment: "The Untested API"


✅ Day 1 - Tests & Coverage

  • Unit Tests (taskService.test.js) - 11 tests covering all service functions
  • Integration Tests (tasks.routes.test.js) - 6 tests covering all API endpoints with edge cases
  • Coverage Target - Achieved 91.07% (target was 80%+)
    • Statement: 91.07%
    • Branch: 77.14%
    • Functions: 93.54%

✅ Day 2 - Part A: Bug Report

  • 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

  • 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

  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions