Ticker: User Preferences

-I think I am missing something simple. My tests with this code adjustment fails all tests and I cant figure out why. These are the only lines of code I changed in the ticket.

// parameter names were changed
static async updatePreferences(userEmail, userPreferences) {

const updateResponse = await users.updateOne(
{ email: userEmail },
{ $set: { preferences: userPreferences } },
{ upsert: true }

Please share the error when you run

npm test -t user-preferences


I looked closer into it after you asked what was the error and realized that preferences on line 167 in usersDAOis never actually defined. I just defined it with a let = and everything passed.

1 Like

Great @Andrew_74578. Good luck for the rest of the course!


Hi @Andrew_74578. Could you my friend give me a hint on where to be more careful in the source code? Since you solved it i could really use some help!(hints, advises)


From what I remember my query was correct but I must have done something strange with the code before the query as there was an undefined variable. All I did was initialize a variable (before a section of the code block) that was throwing the error and it was fixed.

I had some odd issues where my code technically worked but generated interface issues with the code given to us so I did not pass unit tests.