TheMidnightGirl
TheMidnightGirl2mo ago

@std:testing/mock assertSpyCall - checking args for a partially matching object.

In Jest, you can do partial object matching - like this:
expect(obj).toEqual(
expect.objectContaining({
id: '111'
})
);
expect(obj).toEqual(
expect.objectContaining({
id: '111'
})
);
And you can do that when asserting a stub has been called. Is there an equivalent way to do this in the standard library? Also, annoyingly, the function I'm stubbing has been "overloaded", and as a result, the checker wants the second version, when I'm actually calling the first. (I presume the library in question does something faintly clever with converting a NormalCallBack into a Promise for the first version and is lying in its prototype). TIA
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?