ajohnson10209 / CodeacademyBuildWebAPICapstone

Capstone project from the course Build Web APIs From Scratch. I completed this course on 3-25-2019
0 stars 0 forks source link

Suggestions - Tip to pass empty array test #2

Open cc-prj-review-alf opened 5 years ago

cc-prj-review-alf commented 5 years ago

Screen Shot 2019-03-26 at 10 53 19 PM

This one stumped me but I believe the issue is narrowed down to the timesheetMw.js file and menu-items-MW.js file. We are expecting empty arrays when employee '3' is fetch via GET /api/employees/:employeeId/timesheets but it returns an array with one object:

[ { id: 3,
    hours: 10,
    rate: 15.5,
    date: 1506100907823,
    employee_id: 2 } ]

I see that you have the SQL statement correct: select * from MenuItem where menu_id = $id

I checked your 'seed.js' file incase there was a user with this ID and timesheets passing through. Did not see this in the seed. This same behavior was shown with the menuItem test. In any case, maybe some logic is needed her that can check for and empty array or return an empty array if an employee is not employed at the org anymore? This one stumped me pretty hard too.

ajohnson10209 commented 5 years ago

Thanks for your suggestions here. This was actually passing before I added the 2nd route.param statement in timesheetRouter and menuItemRouter, but then the last test (I can't remember it now) was failing. Maybe that could be something you could look at.