I’m performing multiple different calls – to get data from an external API.
const results = Promise.all([collectDataForA, collectDataForB, collectDataForC])
each of these promises: collectDataForA
, collectDataForB
, collectDataForC
calls nested function fetchData()
with different params. I have fetchDataSpy
object which is just an object to spy on fetchData()
function. Is there a way in Jest to check if the function was called with expected params?
I can not use just something like this:
expect(fetchDataSpy).toHaveBeenCalledWith(expectedParam)
because I have multiple calls of the same function, I’m using Promise.all and I never know what function call with what params will happen firstly.