How can I get the arguments called in jest mock function?

前端 未结 3 786
陌清茗
陌清茗 2021-02-02 04:50

How can I get the arguments called in jest mock function?

I want to inspect the object that is passed as argument.

3条回答
  •  伪装坚强ぢ
    2021-02-02 05:35

    Just use mockObject.calls. In my case I used:

    const call = mockUpload.mock.calls[0][0]
    

    Here's the documentation about the mock property

提交回复
热议问题