Ch2 Ticket: Paging - Unit test, 'paging by cast' fails but it looks to expect the wrong value

The Search by Cast, unit test checks the last title on the 3rd page (the 60th movie title), “The Da Vinci Code”.

Expected: "The Da Vinci Code"
Received: "Closer"

  61 |     const lastMovie = thirdPage.slice(-1).pop()
  62 |     expect(thirtyFirstMovie.title).toEqual("Goya's Ghosts")
> 63 |     expect(lastMovie.title).toEqual("The Da Vinci Code")

However, if you check the docs in the collection according to the test search conditions

  • filter: [“Tom Hanks”, “Natalie Portman”]
  • sort: {“tomatoes.viewer.numReviews”: -1}

‘The Da Vinci Code’ comes in the 57th place
and the last movie is actually “Toy Story That Time Forgot”.

Though unit test fails, it passes the corresponding ‘paging’ check on the mflix Status page.
Clarification will be appreciated.

1 Like

I got the same problem over here. They might forgot to update the sample data or the test.js. Correct me if I’m wrong.

Hey Gunho_Cho:

I saw another post about this issue. That person simply deleted the original data set and reloaded a new one. It worked for me, too. You should give it a try.

2 Likes

other than npm problems, you will only get 1 error depending on the code itself and that will be about write concern for a reason of a change in libraries and servers. otherwise, it is either your approach is wrong or the dataset is broken.

first, make sure you really have the correct code implemented. if you haven’t done so, take M001 and M121 courses to help you understand MongoDB better.

then, make sure, for all MDBU courses, you create a cluster only for that course, load the same sample dataset and try not to have manual delete/update/insert operations. also, a course might be asking to use Web IDE, a read-only database link, or special datasets, so keep an eye for these markers.

2 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.