genreSearchQuery implementation work but not with the app

Hi everyone,
I’m facing strange issue, :mask: I’ve implement chapter 1 - ticket: “Text and Subfield Search” and it’s working fine & return data on my local mongo-shell, on my local Robo3T & on cloud.mongodb.com —> atlas but, it’s not working with the Mflix application, and when I run “npm test -t text-subfield” I get some errors:

 FAIL  test/text-subfield.test.js (5.805s)

Text and Subfield Search
✕ Can perform a text search (116ms)
✕ Can perform a genre search with one genre (7ms)
✕ Can perform a genre search with multiple genres (5ms)
✕ Can perform a cast search with one cast member (6ms)
✕ Can perform a cast search with multiple cast members (6ms)
✕ Can perform a search and return a non-default number of movies per page (6ms)

● Text and Subfield Search › Can perform a text search

TypeError: Cannot read property 'length' of undefined

  11 |       filters,
  12 |     })
> 13 |     expect(moviesList.length).toEqual(6)
     |                       ^
  14 |     expect(totalNumMovies).toEqual(6)
  15 |     const firstMovie = moviesList[0]
  16 |     expect(firstMovie["title"]).toEqual("Flash Gordon")

  at length (test/text-subfield.test.js:13:23)
  at tryCatch (node_modules/regenerator-runtime/runtime.js:63:40)
  at Generator.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:293:22)
  at Generator.next (node_modules/regenerator-runtime/runtime.js:118:21)
  at asyncGeneratorStep (node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
  at _next (node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)

All suggestions will be accepted with open arms :baby_symbol::

How do you come to this conclusion?

How do you execute the code from your implementation in your local shell or R3T?

This means your code does not return an object of the appropriate type. In the case the appropriate type would be an array.

1 Like