Skip to content

Take-home: tests, bug fixes, and PATCH /tasks/:id/assign#30

Open
tanyyaaa33 wants to merge 2 commits into
rohit-ups:mainfrom
tanyyaaa33:main
Open

Take-home: tests, bug fixes, and PATCH /tasks/:id/assign#30
tanyyaaa33 wants to merge 2 commits into
rohit-ups:mainfrom
tanyyaaa33:main

Conversation

@tanyyaaa33
Copy link
Copy Markdown

Submission notes

Use this text in your PR description or email to the reviewer.

How to run

cd task-api
npm install
npm test
npm run coverage

Coverage

Last run from task-api (npm run coverage), above the 80% target:

-----------------|---------|----------|---------|---------|-------------------
File             | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
-----------------|---------|----------|---------|---------|-------------------
All files        |   94.23 |     86.2 |   93.33 |   93.66 |
 src             |   69.23 |       75 |       0 |   69.23 |
  app.js         |   69.23 |       75 |       0 |   69.23 | 10-11,17-18
 src/routes      |     100 |    91.66 |     100 |     100 |
  tasks.js       |     100 |    91.66 |     100 |     100 | 20-21
 src/services    |     100 |    94.73 |     100 |     100 |
  taskService.js |     100 |    94.73 |     100 |     100 | 22
 src/utils       |   82.75 |       80 |     100 |   82.75 |
  validators.js  |   82.75 |       80 |     100 |   82.75 | 9,12,25,28,31
-----------------|---------|----------|---------|---------|-------------------
Test Suites: 2 passed, 2 total
Tests:       32 passed, 32 total

What I would test next with more time

  • Invalid page / limit (zero, negative, non-numeric) and consistent error responses across list endpoints.
  • Concurrent requests against the in-memory store (race conditions are possible without a DB).
  • Contract tests for response JSON schema (e.g. with a small schema validator).
  • Load or soak tests if this were headed to production traffic.

What surprised me

  • The README status labels differ from ASSIGNMENT.md / code (todo, in_progress, done in code and validators).
  • Pagination is easy to get wrong with off-by-one page indexing; tests caught that quickly.

Questions before shipping to production

  • Persistence: where should tasks live (Postgres, etc.) and what migration strategy?
  • Auth: who can create, update, delete, or assign tasks?
  • Idempotency and audit: should assign/complete be logged; do we need ETag / versioning?
  • SLA and deployment: hosting, health checks, rate limits, and observability (metrics/traces).

- Unit tests for taskService and Supertest integration tests for routes
- Fix pagination offset and preserve priority on complete (see BUG_REPORT)
- PATCH /tasks/:id/assign with validation and tests
- Submission notes with coverage summary; PR helper docs

Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant