Hi there,
I’m not able to understand the requirement of the first exercise; Ticket 1: Projection - Driver Setup.
What is one to do?
I entered the following code in the node shell: npm test -t projection
However, it gave me this error:
Determining test suites to run...Setup Mongo Connection
FAIL test/projection.test.js (22.18s)
Projection
× Can perform a country search for one country (585ms)
× Can perform a country search for three countries (3210ms)
● Projection › Can perform a country search for one country
expect(received).toEqual(expected)
Expected value to equal:
2
Received:
1
9 | const kosovoList = ["Kosovo"]
10 | const movies = await MoviesDAO.getMoviesByCountry(kosovoList)
> 11 | expect(movies.length).toEqual(2)
| ^
12 | })
13 |
14 | test("Can perform a country search for three countries", async () => {
at toEqual (test/projection.test.js:11:27)
at tryCatch (node_modules/regenerator-runtime/runtime.js:62:40)
at Generator.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:296:22)
at Generator.prototype.(anonymous function) [as next] (node_modules/regenerator-runtime/runtime.js:114:21)
at step (node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
at node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13
● Projection › Can perform a country search for three countries
expect(received).toEqual(expected)
Expected value to equal:
2788
Received:
1
15 | const countriesList = ["Russia", "Japan", "Mexico"]
16 | const movies = await MoviesDAO.getMoviesByCountry(countriesList)
> 17 | expect(movies.length).toEqual(2788)
| ^
18 | movies.map(movie => {
19 | const movieKeys = Object.keys(movie).sort()
20 | const expectedKeys = ["_id", "title"]
at toEqual (test/projection.test.js:17:27)
at tryCatch (node_modules/regenerator-runtime/runtime.js:62:40)
at Generator.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:296:22)
at Generator.prototype.(anonymous function) [as next] (node_modules/regenerator-runtime/runtime.js:114:21)
at step (node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
at node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13
Test Suites: 1 failed, 1 total
Tests: 2 failed, 2 total
Snapshots: 0 total
Time: 26.391s
Ran all test suites matching /projection/i.
Teardown Mongo Connection
npm ERR! Test failed. See above for more details.
I’m not able to understand why the error is generating and what is a person supposed to do in this exercise to clear?
Thank you.