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

前端 未结 3 789
陌清茗
陌清茗 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:21

    Here is a simple way to assert the parameter passed.

    expect(mockedFunction).toHaveBeenCalledWith("param1","param2");
    

提交回复
热议问题