Skip to content

Instantly share code, notes, and snippets.

@glyons
glyons / FakeGETTestusingSinonJS.js
Created September 6, 2017 09:21
Javascript QUnit - Fake GET Test using SinonJS
QUnit.test("Javascript QUnit - Fake GET Test using SinonJS", function (assert) {
var url = "http://someurltofake";
var xhr = sinon.useFakeXMLHttpRequest();
var requests = sinon.requests = [];
xhr.onCreate = function (request) {
requests.push(request);
};