I am trying to partially match the object which are being passed to TitleRepo.find
. I am not able to understand what wrong I am doing.
expect(jest.fn()).toBeCalledWith(...expected)
Expected: ObjectContaining {"filter": {"limit": Any<Number>}}
Received: {"filter": {"title_ids.xxx.deleted_at": null, "title_ids.xxx.deleted_at": null, "title_ids.xxx.id": {"$exists": true, "$ne": null}}, "limit": 10, "sort": {"created_at": -1}}
Number of calls: 1
31 | });
32 |
> 33 | expect(TitleRepo.find).toBeCalledWith(
| ^
34 | expect.objectContaining({"filter": {"limit": expect.any(Number)}}),
35 | );
36 | })
at Object.<anonymous> (tests/query/TitleQuery.test.js:33:32)
Related lines from test is.
TitleRepo.find = jest.fn();
it('should able to set platform correctly', async () => {
const titles = await TitleQuery.find({
platform: 'chandu'
});
expect(TitleRepo.find).toBeCalledWith(
expect.objectContaining({"filter": {"limit": expect.any(Number)}}),
);
})
Aucun commentaire:
Enregistrer un commentaire