Exercise Tracker not passing test but seems to work fine

Hello there, having issues trying to get my exercise tracker app to pass any tests. Seems to work ok though as far as I can tell. Any help would be really appreciated!

https://flame-shore-shop.glitch.me

Welcome, josscg.

I suggest you have a read over these to see if it solves your problem:

Hope this helps

Thanks to both of you for your input, however I am still completely confused as to why it does not pass any tests besides the first one!

I noticed in the boiler plate that there is a “shortid” module required. So is it necessary to use the shortid? Because all of my tests are failing and I guess all the json.response have a _id property. I think it’s a long shot since they example they provide does not seem to use it!

Also, has anyone had success passing all the tests with mongoose? I am using mongoose and maybe thinking I should try using the mongoDB client instead.

Cheers!

Hello again,

You do not appear to be using the correct routes:

/api/exercise/new-user

api/exercise/users

/api/exercise/add

/api/exercise/log

Those are the routes you should have configured, as per the README.md instructions.

Hope this helps

Hi Sky020, thanks again for your reply. I believe I have the correct routes in place, but I have scoped them in the server file. I suppose it’s possible that testing may not like that though, I will try putting everything back in the server file! Thanks so much for your input!

This is one of the routes I see in your file:

router.route("/new-user").

This is what it should be:

router.route("/api/exercise/new-user")...

Hope this clarifies.

I see what you mean but I have scoped it in the server file as follows…

app.use("/api/exercise", userRouter);

As far as I know, in theory that should return the same route, no? Maybe I’m missing something though!

I’m changing it all so that the routes are just in the server file as we speak, I will let you know how it goes!

Thank you again for your help!

Ah. Sorry, I did miss that.

Then, to get back to one of your earlier concerns: The use of Mongoose should not be a problem, whatsoever.

If changing the routes does nothing, then it might be helpful to take a look at the tests: https://github.com/freeCodeCamp/freeCodeCamp/blob/master/curriculum/challenges/english/05-apis-and-microservices/apis-and-microservices-projects/exercise-tracker.english.md

That is what I had to do.

No worries at all!

Yeah fair enough, maybe I’ll try to set up tests on my end that mirror their tests. It seems as though I’ve done something majorly wrong seeing as though the second test appears to literally just test for the existence of a username and an _id!

Thank you for your help I appreciate it!

I ended up starting from scratch again, and just using a local storage without a database connection. Passed all the tests, glad that one is over! Thanks for your help!