Can sinon stub withArgs match some but not all arguments

前端 未结 4 1476
慢半拍i
慢半拍i 2021-01-31 13:33

I have a function I am stubbing that gets called with multiple arguments. I want to check just the first argument. The rest are callback function, so I want to

4条回答
  •  有刺的猬
    2021-01-31 13:43

    If you just want to check the first argument you can use

    method.get.withArgs(25).calledOnce
    

    or

    method.get.calledWith(25)
    

提交回复
热议问题