Unit testing for Project Team Members router#1915
Merged
trillium merged 3 commits intohackforla:developmentfrom Feb 3, 2026
Merged
Unit testing for Project Team Members router#1915trillium merged 3 commits intohackforla:developmentfrom
trillium merged 3 commits intohackforla:developmentfrom
Conversation
Member
|
@jng34 It appears there are some conflicts on this PR that need to be resolved. Can you please take a look at these when you have a moment? |
…roject/:id/:userId route
- .find() returns an array, not an object. Changed check from !teamMember.projectId to proper empty array check - Remove unused err parameter in catch block
trillium
approved these changes
Feb 3, 2026
Member
trillium
left a comment
There was a problem hiding this comment.
Review: Approve
Summary: Adds unit tests for Project Team Members router with good coverage of CRUD operations.
Changes Reviewed
- ✅
projectTeamMembers.router.test.js: 7 tests covering GET, POST, PATCH - ✅
projectTeamMembers.router.js: Bug fix + formatting
Bug Fixed
Fixed incorrect empty array check:
// Before (broken - arrays don't have .projectId)
if (\!teamMember.projectId)
// After (correct)
if (\!teamMember || teamMember.length === 0)Tests
All 7 tests pass ✅
Rebased onto upstream/development and fixed bug.
1a18090 to
f8ab8ef
Compare
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.
Fixes #1892
What changes did you make and why did you make them ?
projectTeamMembers.router/project/:id/:userIdinprojectTeamMembers.router.jsthat incorrectly threw the HTTP code400when it should have been200, which affected the unit test for that routeScreenshots of Passed Tests