Timeouts Ticket Cannot Pass

I cannot see how it is possible for this ticket to pass.

The unit test and integration test both fail, even when configuring src/index.js and test/config/mongoEnvironment.js exactly as prescribed in the detailed answer:

Determining test suites to run…Setup Mongo Connection
(node:32234) [MONGODB DRIVER] Warning: Top-level use of w, wtimeout, j, and fsync is deprecated. Use writeConcern instead.
(Use node --trace-warnings ... to show where the warning was created)
(node:32234) [MONGODB DRIVER] Warning: Current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
FAIL test/timeouts.test.js
✕ Timeout is set to 2500 milliseconds (141ms)

● Timeouts › Timeout is set to 2500 milliseconds

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

Expected: 2500
Received: undefined

   8 |   test("Timeout is set to 2500 milliseconds", async () => {
   9 |     const { wtimeout } = await MoviesDAO.getConfiguration()
> 10 |     expect(wtimeout).toBe(2500)
     |                      ^
  11 |   })
  12 | })
  13 |

  at toBe (test/timeouts.test.js:10:22)
  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)

Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 total
Snapshots: 0 total
Time: 3.007s, estimated 7s
Ran all test suites matching /timeouts/i.
Teardown Mongo Connection
npm ERR! Test failed. See above for more details.

1 Like
  • Happended with me too just now. Figured out,
  • The problem is in the function getConfiguration() from moviesDao.js .
  • line const { poolSize, wtimeout } = movies.s.db.serverConfig.s.options
  • Change the destructurred variable names to “poolsize” and “wTimeoutMS” as the s.options object have these fields.
  • Assign the values to the response object.
1 Like

Thank you.

“poolSize” is correct. No need to change that. Otherwise, yes. That works. So the full definition of getConfiguration should be:


  • Retrieves the connection pool size, write concern timeout and user roles on the
  • current client.
  • @returns {Promise} An object with configuration details.
    static async getConfiguration() {
    const roleInfo = await mflix.command({ connectionStatus: 1 })
    const authInfo = roleInfo.authInfo.authenticatedUserRoles[0]
    const { poolSize, wTimeoutMS } = movies.s.db.serverConfig.s.options
    const wtimeout = wTimeoutMS
    let response = {
    return response

This also provides a clue as to how changes should be applied to index.js and mongoEnvironment.js

Too late for me but, hopefully, this will be of help to others.

This part of the course needs to be updated to reflect the fact that top level use of “wtimeout” is deprecated.

Both “poolsize” and “poolSize” are there.