Tell us what’s happening:
Hi,
I created the routes, the functional tests are passing but posting to /api/books/{_id} check is failing and I cannot see the reason as I tested that the requirements are met . How can I see what’s the reason to not to pass this check?
Your project link(s)
solution: https://replit.com/@dsantamaria18/fcc-qa-project-library
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36
.
Challenge: Personal Library
Link to the challenge:
Sky020
May 20, 2021, 10:22pm
2
Welcome there,
I vaguely recall a test not working well with .status()
responses. That is, could you try removing it in:
res.status(400).json('missing required field comment')
Hope this helps
Thank you for your answer, Sky020. Sadly, removing it has no effect and the test still fails without reason.
Thanks, for trying.
Although, I can see that the only test failing has this error:
Error: expected [ 'This book is fab!' ] to have a length of 2 but got 1
Also, to mention, it would be best to return
out of the callback, if there is an error in any of your CRUD:
if (error) console.log(":: ERROR: ", error)
EDIT: To add to why the test is not passing, here is a hint: Have a look at the options available for findOneAndUpdate
.
I’ll check that. Thank you so much, Sky020 !
Thank you so much! Finally, the error was that I was missing the “new: true” in params (Mongoose) for findOneAndUpdate method.
system
Closed
December 6, 2021, 8:25am
7
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.