Restore window.XMLHttpRequest when test finishes

This commit is contained in:
rubenmoya 2017-11-07 14:40:05 +01:00
parent b75688dcd9
commit ea6fc57384

View File

@ -1,17 +1,22 @@
var torque = require('../lib/torque');
var providers = torque.providers;
window.XMLHttpRequest = function () {
return {
open: function () { },
send: function () { },
readyState: 4,
responseText: {}
}
};
var json, url;
var json, url, _XMLHttpRequest;
QUnit.module('provider.json');
QUnit.moduleStart(function() {
_XMLHttpRequest = window.XMLHttpRequest;
window.XMLHttpRequest = function () {
return {
open: function () { },
send: function () { },
readyState: 4,
responseText: {}
}
};
});
QUnit.moduleDone(function() {
window.XMLHttpRequest = _XMLHttpRequest;
});
QUnit.testStart(function() {
json = new providers.json({
table: 'test',