From ea6fc57384ce9d3287f1f222305eb447dda322ac Mon Sep 17 00:00:00 2001 From: rubenmoya Date: Tue, 7 Nov 2017 14:40:05 +0100 Subject: [PATCH] Restore window.XMLHttpRequest when test finishes --- test/provider.json.js | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/test/provider.json.js b/test/provider.json.js index 41b6e5a..63c2108 100644 --- a/test/provider.json.js +++ b/test/provider.json.js @@ -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',