Can sinon stub withArgs match some but not all arguments

前端 未结 4 1511
慢半拍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

    https://sinonjs.org/releases/latest/matchers/#sinonmatchany

    You can use sinon.match.any:

    method.get.withArgs(25, sinon.match.any, sinon.match.any); 
    

提交回复
热议问题