Skip to content

Conversation

@jng34
Copy link
Member

@jng34 jng34 commented May 6, 2025

Fixes #1892

What changes did you make and why did you make them ?

  • wrote unit tests for projectTeamMembers.router
  • edited the logic in the GET API route /project/:id/:userId in projectTeamMembers.router.js that incorrectly threw the HTTP code 400 when it should have been 200, which affected the unit test for that route

Screenshots of Passed Tests

image

@JackHaeg JackHaeg requested a review from dannyprikaz May 15, 2025 22:44
@JackHaeg
Copy link
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?

jng34 and others added 2 commits February 2, 2026 17:44
- .find() returns an array, not an object. Changed check from
  !teamMember.projectId to proper empty array check
- Remove unused err parameter in catch block
Copy link
Member

@trillium trillium left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@trillium trillium force-pushed the unitTestingForProjectTeamMembers branch from 1a18090 to f8ab8ef Compare February 3, 2026 02:19
@trillium trillium merged commit 9ba8caf into hackforla:development Feb 3, 2026
3 of 5 checks passed
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.

Create New Unit Tests for ./backend/routers/projectTeamMembers.router.js

3 participants