Back to Sinon

JSON-P - Sinon.JS

docs/release-source/release/json-p.md

21.1.2288 B
Original Source

JSON-P

A JSON-P request creates a script element and inserts it into the document.

There is no sufficiently unobtrusive way to fake this automatically. The best option is to stub jQuery in this case:

javascript
sinon.stub(jQuery, "ajax");
sinon.assert.calledOnce(jQuery.ajax);