0
比方说我们这是导出函数如何用Mocha,Chai和Sinon检查函数被调用的参数的数量?
function bar(x,y){
console.log(x,y);
}
服务foo和我们想要写一个单元测试,将测试这个函数被调用以2个参数。 我已经试过这
var args = sandboxSinon.spy(Foo, 'bar').getCalls()[0].args;
,这是返回
undefined is not an object (evaluating 'sandboxSinon.spy(Foo, 'bar').getCalls()[0].args
有人能搞清楚发生了什么或者我怎么能测试吗?