feat: tested, fixed bugs and added new PATCH /tasks/:id/assign end point - #53
Open
redstonenight347-oss wants to merge 2 commits into
Open
feat: tested, fixed bugs and added new PATCH /tasks/:id/assign end point#53redstonenight347-oss wants to merge 2 commits into
redstonenight347-oss wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request: Comprehensive Test Suite, Bug Fixes &
PATCH /tasks/:id/assignFeature📌 Summary of Changes
This PR delivers a comprehensive test suite (108 tests with >96% coverage), resolves critical bug fixes across the core API, and implements the
PATCH /tasks/:id/assignendpoint with full validation and test coverage.🚀 Key Improvements
1. Test Suite & Coverage (Day 1 Requirements)
tests/taskService.test.js): 53 unit tests covering all functions intaskService.js.tests/tasks.test.js): 55 integration tests usingsupertestcovering all API routes, edge cases, status validations, and failure modes.src/routes/tasks.js: 100%src/services/taskService.js: 100% lines / 95% branchsrc/utils/validators.js: 96.77%2. Bug Fixes (Day 2 Part A & B)
getPaginatedoffset formula frompage * limitto(page - 1) * limit. Page 1 now correctly returns items starting from index 0. Added fallback guards for negative/invalidpage&limitvalues.t.status.includes(status)substring matching with exact equalityt.status === statusingetByStatus.priority: 'medium'overwrite insidecompleteTask, preserving the task's original priority (low/medium/high).id,createdAt,completedAt) inupdate()so client request bodies cannot alter system-managed identifiers or timestamps.validateGetTaskinvalidators.jsto return400 Bad Requestwhen filtering with an invalidstatusparameter (e.g.,?status=banana).3. New Feature:
PATCH /tasks/:id/assign(Day 2 Part C)Implemented task assignment capabilities:
PATCH /tasks/:id/assign{ "assignee": "string" }assigneeis a non-empty, non-whitespace string (returns400 Bad Requestotherwise).200 OK.404 Not Foundif the task ID does not exist.assignee: nullby default.🧪 Verification & Test Results
📝 Notes for Submission
assigneevalidation strictly checks for non-empty string types after trimming whitespace. Re-assignment is explicitly permitted.total,page,limit,totalPages).README.mddocumentation status values (pending,in-progress,completed) with the active code implementation (todo,in_progress,done).