JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://sinonjs.org/releases/sinon-1.14.1.js"></script>
<script src="http://code.jquery.com/qunit/qunit-1.18.0.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.18.0.css">
<div id="qunit"></div>
<div id="qunit-fixture"></div>
JavaScript
var hooks = {
beforeEach: function(assert){
this.server = sinon.fakeServer.create();
},
afterEach: function(){
this.server.restore();
}
};
module('example', hooks);
test('example', function(assert){
this.server.respondWith('GET', '/foo=1$/', [200, { 'Content-Type': 'application/json' }, '{ "foo": 1 }']);
$.ajax({
url: '/echo/json?foo=1'
}).fail(function(){
assert.ok(false);
}).done(function(data){
assert.ok(true);
});
this.server.respond();
});