Skip to content

AnkitDimri4/Take-Home-Assignment-The-Untested-API

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation


Take-Home Assignment — The Untested API

Candidate implementation:
My solution for this assignment is in the task-api directory:

A 2-day take-home assignment. You'll read unfamiliar code, write tests, track down bugs, and ship a small feature.

Read ASSIGNMENT.md for the full brief before you start.


A note on AI tools

You're welcome to use AI tools. What we're evaluating is your ability to read and reason about unfamiliar code — so your submission should reflect your own understanding, not just generated output.

Concretely:

  • For each bug you report: include where in the code it lives and why it happens
  • For the feature you implement: briefly explain the design decisions you made
  • If something surprised you or you had to make a tradeoff, say so

Getting Started

Prerequisites: Node.js 18+

cd task-api
npm install
npm start        # runs on http://localhost:3000

Tests:

npm test           # run test suite
npm run coverage   # run with coverage report

Project Structure

task-api/
  src/
    app.js                  # Express app setup
    routes/tasks.js         # Route handlers
    services/taskService.js # Business logic + in-memory data store
    utils/validators.js     # Input validation helpers
  tests/                    # Your tests go here
  package.json
  jest.config.js
ASSIGNMENT.md               # Full brief — read this first

The data store is in-memory. It resets every time the server restarts.


API Reference

Method Path Description
GET /tasks List all tasks. Supports ?status=, ?page=, ?limit=
POST /tasks Create a new task
PUT /tasks/:id Full update of a task
DELETE /tasks/:id Delete a task (returns 204)
PATCH /tasks/:id/complete Mark a task as complete
GET /tasks/stats Counts by status + overdue count
PATCH /tasks/:id/assign Assign a task to a user (to implement)

Task shape

{
  "id": "uuid",
  "title": "string",
  "description": "string",
  "status": "pending | in-progress | completed",
  "priority": "low | medium | high",
  "dueDate": "ISO 8601 or null",
  "completedAt": "ISO 8601 or null",
  "createdAt": "ISO 8601"
}

Sample requests

Create a task

curl -X POST http://localhost:3000/tasks \
  -H "Content-Type: application/json" \
  -d '{"title": "Write tests", "priority": "high"}'

List tasks with filter

curl "http://localhost:3000/tasks?status=pending&page=1&limit=10"

Mark complete

curl -X PATCH http://localhost:3000/tasks/<id>/complete

What to Submit

See ASSIGNMENT.md for full submission requirements. At minimum, include:

  • Test files — covering the endpoints and edge cases you identified
  • Bug report — what you found, where in the code, and why it's a bug (not just symptoms)
  • At least one fix — with a note on your approach
  • PATCH /tasks/:id/assign implementation — plus a short explanation of any design decisions (validation, edge cases, etc.)

About

Take-home assignment solution – Node.js/Express Task API with tests, bug fix, and assign endpoint.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%