How to use the replace function from sinon

Find comprehensive JavaScript sinon.replace code examples handpicked from public code repositorys.

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' }));
fork icon810
star icon0
watch icon2

+ 3 other calls in file