привет 🙂
Если написать:
expect({
"__v": 0,
"_id": "59d9c30d6ad38b63b80707d7",
"groups": [],
}).toMatchObject({ "__v": 0 });
то всё ОК.
Если написать:
expect(pseudoRes.json.mock.calls[0][0])
.toMatchObject({ "__v": 0 });
то тест проваливается:
● createPriceList
Unhandled "error" event. (Error: expect(received).toMatchObject(expected)
Expected value to match object:
{"__v": 0}
Received:
{"__v": 0, "_id": "59d9c5edb57ee563b85b3840", "groups": []}
Difference:
- Expected
+ Received
Object {
"__v": 0,
+ "_id": "59d9c5edb57ee563b85b3840",
+ "groups": Array [],
})
at Function.emit (events.js:185:19)
at node_modules/mongoose/lib/model.js:3824:13
at node_modules/mongoose/lib/services/model/applyHooks.js:162:20
at _combinedTickCallback (internal/process/next_tick.js:95:7)
at process._tickCallback (internal/process/next_tick.js:161:9)
проверил на repl, всё ок
Обсуждают сегодня