How to use the replace function from sinon
Find comprehensive JavaScript sinon.replace code examples handpicked from public code repositorys.
GitHub: will3/sinon
142 143 144 145 146 147 148 149 150 151
after(function () { sinon.restore(); }); it('makes a GET request for todo items', function () { sinon.replace(jQuery, 'ajax', sinon.fake()); getTodos(42, sinon.fake()); assert(jQuery.ajax.calledWithMatch({ url: '/todo/42/items' }));
810
0
2
+ 3 other calls in file
sinon.stub is the most popular function in sinon (5777 examples)