updateComment something is wrong with the test

tatic async updateComment(commentId, userEmail, text, date) {
try {
// TODO Ticket: Create/Update Comments
// Use the commentId and userEmail to select the proper comment, then
// update the “text” and “date” fields of the selected comment
const updateResponse = await comments.updateOne(

    { "_id": ObjectId(commentId), "email": userEmail },
    { $set: { "text": text, "date": date} },
  )

  return updateResponse
} catch (e) {
  console.error(`Unable to update comment: ${e}`)
  return { error: e }
}

}

tatic async updateComment(commentId, userEmail, text, date) {
try {
// TODO Ticket: Create/Update Comments
// Use the commentId and userEmail to select the proper comment, then
// update the “text” and “date” fields of the selected comment
const updateResponse = await comments.updateOne(

    { "_id": ObjectId(commentId), "email": userEmail },
    { $set: { "text": text, "date": date} },
  )

  return updateResponse
} catch (e) {
  console.error(`Unable to update comment: ${e}`)
  return { error: e }
}

}

jest --passWithNoTests “create-update-comments”

Determining test suites to run…Setup Mongo Connection
FAIL test/create-update-comments.test.js (9.22s)
Create/Update Comments
✓ Can post a comment (1300ms)
✕ Can update a comment (780ms)
✓ Can only update comment if user posted comment (564ms)

● Create/Update Comments › Can update a comment

expect(received).toBe(expected) // Object.is equality

Expected: 1
Received: 0

  68 |       date,
  69 |     )
> 70 |     expect(updateCommentResult.modifiedCount).toBe(1)
     |                                               ^
  71 | 
  72 |     const movieComments = (await MoviesDAO.getMovieByID(movieId)).comments
  73 | 

  at toBe (test/create-update-comments.test.js:70:47)
  at tryCatch (node_modules/regenerator-runtime/runtime.js:45:40)
  at Generator.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:271:22)
  at Generator.prototype.<computed> [as next] (node_modules/regenerator-runtime/runtime.js:97:21)
  at asyncGeneratorStep (node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
  at _next (node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)

Test Suites: 1 failed, 1 total
Tests: 1 failed, 2 passed, 3 total
Snapshots: 0 total
Time: 9.345s
Ran all test suites matching /create-update-comments/i.
Teardown Mongo Connection
npm ERR! Test failed. See above for more details.
➜ mflix-js

Hi @leotoprogram,

Please check the comments returned in the mongo doc by get_movie() are sorted in descending order by date .

Kanika