Migration test problems

I am working on the migration.test.js ticket:

>  FAIL  test/migration.test.js
>   Migration
>     × migration (89ms)
> 
>   ● Migration › migration
> 
>     expect(received).not.toBeNull()
> 
>     Received: null
> 
>       12 |       lastupdated: { $type: "date" },
>       13 |     })
>     > 14 |     expect(movie).not.toBeNull()
>          |                       ^
>       15 |   })
>       16 | })
>       17 |
> 
>       at toBeNull (test/migration.test.js:14:23)
>       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.<computed> [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:       1 failed, 1 total
> Snapshots:   0 total
> Time:        2.218s
> Ran all test suites matching /migration/i.
> Teardown Mongo Connection
> npm ERR! Test failed.  See above for more details.

As you can see, my test fails!

I have been banging my head toward what could be wrong here, I did test command in mongoDB :

db.movies.find({ lastupdated: { $exists: true, $type: “string” }}).count()
gives me the same result as:
db.movies.find().count()
Which tells me something is wrong with my query

But when I run the migration:
Connected to DB…->
Found 0 documents to update
No documents to update
PS C:\Developer\mflix-js\src\migrations>

Any hints to get me towards the end ?

regards,

Please check your messages and we will figure it out!

Kanika

1 Like