Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jquery-mockjax

Package Overview
Dependencies
Maintainers
3
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jquery-mockjax - npm Package Compare versions

Comparing version 2.6.0 to 2.6.1

.github/ISSUE_TEMPLATE/bug_report.md

16

bower.json

@@ -5,13 +5,21 @@ {

"dependencies": {
"jquery": ">=1.5.0"
"jquery": ">=1.12.4"
},
"ignore": [
".editorconfig",
".github",
".gitignore",
".jshintrc",
"*.md",
".jshintrc",
"browserstack-config.js",
"browserstack.js",
"grunt-config-options.js",
"Gruntfile.js",
"lib",
"package.json",
"qunit-puppeteer.js",
"test",
"*.json",
"lib",
"test"
"*.md"
]
}
var config = require('./grunt-config-options');
config.onlyPaths = true;
var urls = require('./test/build-version-urls')(config, 'latestInBranch', 'all', 'logging');
var urls = require('./test/build-version-urls')(config, 'all', 'all', 'logging');

@@ -16,5 +16,4 @@ module.exports = {

"safari_latest",
"edge_latest",
"ie_11"
"edge_latest"
]
};

@@ -0,1 +1,9 @@

## 2024-02-17 v2.6.1
* Changed license from dual (MIT & GPL) to only be MIT
* Updated authorship to myself (creator of all v2 changes) and moved JD Sharp to contributor
* Massive (long needed) update to dev dependencies, and thus most of the test and build infrastructure
* NO source code changes, but the minified version will change due to dependency updates
* Remove support for IE 11 and requirejs
* Remove support for older versions of jQuery (supporting latest on each major branch)
## 2020-08-22 v2.6.0

@@ -2,0 +10,0 @@ * Removed support for IE 9 & 10

@@ -140,5 +140,4 @@ # Contributing to Mockjax #

This is the last step! First, be sure you're merging with the correct branch! Version
2.0 of Mockjax will be the `master` branch very soon (hopefully we remember to update
this message), but if you're submitting a bug fix, it should be submitted to the `v1.x`
branch as well as `master` (if the bug exists in both).
2.x of Mockjax is on the `master` branch, but if you're submitting a bug fix for v1.x,
make sure it is submitted to the `v1.x` branch as well as `master` (if the bug exists in both).

@@ -145,0 +144,0 @@ You should also write a good PR message with information on why this feature or fix is

@@ -6,7 +6,6 @@ /*! jQuery Mockjax

* Home: https://github.com/jakerella/jquery-mockjax
* Copyright (c) 2020 Jordan Kasper, formerly appendTo;
* Copyright (c) 2024 Jordan Kasper, formerly appendTo;
* NOTE: This repository was taken over by Jordan Kasper (@jakerella) October, 2014
*
* Dual licensed under the MIT or GPL licenses.
* http://opensource.org/licenses/MIT OR http://www.gnu.org/licenses/gpl-2.0.html
* Licensed under the MIT license: http://opensource.org/licenses/MIT
*/

@@ -13,0 +12,0 @@ (function(root, factory) {

@@ -1,1 +0,1 @@

!function(t,r){"use strict";if("function"==typeof define&&define.amd&&define.amd.jQuery)define(["jquery"],function(e){return r(e,t)});else{if("object"!=typeof exports)return r(t.jQuery||t.$,t);module.exports=r}}(this,function(g,i){"use strict";var d=g.ajax,x=[],m=[],h=[],u=/=\?(&|$)/,l=(new Date).getTime(),n=500;function y(t,r){k.debug(t,["Checking mock data against request data",t,r]);var n=!0;if(g.isFunction(t))return!!t(r);if("string"==typeof r){if(g.isFunction(t.test))return t.test(r);if("object"!=typeof t)return t===r;r=function(e){var t,r,n,o,s={},a=String(e).split(/&/);for(t=0,r=a.length;t<r;++t){n=a[t];try{n=(n=decodeURIComponent(n.replace(/\+/g," "))).split(/=/)}catch(e){continue}s[n[0]]?(s[n[0]].splice||(o=s[n[0]],s[n[0]]=[],s[n[0]].push(o)),s[n[0]].push(n[1])):s[n[0]]=n[1]}return k.debug(null,["Getting query params from string",e,s]),s}(r)}return g.each(t,function(e){return void 0===r[e]?n=!1:void(n="object"==typeof r[e]&&null!==r[e]?(n&&g.isArray(r[e])&&(n=g.isArray(t[e])&&r[e].length===t[e].length),n&&y(t[e],r[e])):t[e]&&g.isFunction(t[e].test)?n&&t[e].test(r[e]):n&&t[e]===r[e])}),n}function a(e,t){return e[t]===g.mockjaxSettings[t]}function o(e){return"number"==typeof e&&0<=e}function c(e){if(g.isArray(e)&&2===e.length){var t=e[0],r=e[1];if(o(t)&&o(r))return Math.floor(Math.random()*(r-t))+t}else if(o(e))return e;return n}function T(r,n,t){k.debug(r,["Sending fake XHR request",r,n,t]);var o,s=(o=this,function(){return function(){this.status=r.status,this.statusText=r.statusText,this.readyState=1;function e(){var e,t;this.readyState=4,"json"===n.dataType&&"object"==typeof r.responseText?this.responseText=JSON.stringify(r.responseText):"xml"===n.dataType?"string"==typeof r.responseXML?(this.responseXML=function(e){void 0===i.DOMParser&&i.ActiveXObject&&(i.DOMParser=function(){},DOMParser.prototype.parseFromString=function(e){var t=new ActiveXObject("Microsoft.XMLDOM");return t.async="false",t.loadXML(e),t});try{var t=(new DOMParser).parseFromString(e,"text/xml");if(!g.isXMLDoc(t))throw new Error("Unable to parse XML");if(1===g("parsererror",t).length)throw new Error("Error: "+g(t).text());return t}catch(e){var r=void 0===e.name?e:e.name+": "+e.message;return void g(document).trigger("xmlParseError",[r])}}(r.responseXML),this.responseText=r.responseXML):this.responseXML=r.responseXML:"object"==typeof r.responseText&&null!==r.responseText?(r.contentType="application/json",this.responseText=JSON.stringify(r.responseText)):this.responseText=r.responseText,g.isArray(r.status)?(t=Math.floor(Math.random()*r.status.length),this.status=r.status[t]):"number"!=typeof r.status&&"string"!=typeof r.status||(this.status=r.status),"string"==typeof r.statusText&&(this.statusText=r.statusText),e=this.onload||this.onreadystatechange,g.isFunction(e)?(r.isTimeout&&(this.status=-1),e.call(this,r.isTimeout?"timeout":void 0)):r.isTimeout&&(this.status=-1)}if(g.isFunction(r.response)){if(2===r.response.length)return void r.response(t,function(){e.call(o)});r.response(t)}e.call(o)}.apply(o)});r.proxy?(k.info(r,["Retrieving proxy file: "+r.proxy,r]),d({global:!1,url:r.proxy,type:r.proxyType,data:r.data,async:n.async,dataType:"script"===n.dataType?"text/plain":n.dataType,complete:function(e){r.responseXML=r.responseText=e.responseText,a(r,"status")&&(r.status=e.status),a(r,"statusText")&&(r.statusText=e.statusText),!1===n.async?s():this.responseTimer=setTimeout(s,c(r.responseTime))}})):!1===n.async?s():this.responseTimer=setTimeout(s,c(r.responseTime))}function j(e,t,r){var n;if("GET"===(n=e).type.toUpperCase()?u.test(n.url)||(n.url+=(/\?/.test(n.url)?"&":"?")+(n.jsonp||"callback")+"=?"):n.data&&u.test(n.data)||(n.data=(n.data?n.data+"&":"")+(n.jsonp||"callback")+"=?"),e.dataType="json",e.data&&u.test(e.data)||u.test(e.url)){!function(e,t,r){var n=r&&r.context||e,o="string"==typeof e.jsonpCallback&&e.jsonpCallback||"jsonp"+l++;e.data&&(e.data=(e.data+"").replace(u,"="+o+"$1"));e.url=e.url.replace(u,"="+o+"$1"),i[o]=i[o]||function(){f(e,n,t),v(e,n),i[o]=void 0;try{delete i[o]}catch(e){}},e.jsonpCallback=o}(e,t,r);var o=/^(\w+:)?\/\/([^\/?#]+)/.exec(e.url),s=o&&(o[1]&&o[1]!==location.protocol||o[2]!==location.host);if(e.dataType="script","GET"===e.type.toUpperCase()&&s){var a=function(t,r,e){k.debug(r,["Performing JSONP request",r,t,e]);var n=e&&e.context||t,o=g.Deferred?new g.Deferred:null;if(r.response&&g.isFunction(r.response))r.response(e);else if("object"==typeof r.responseText)g.globalEval("("+JSON.stringify(r.responseText)+")");else{if(r.proxy)return k.info(r,["Performing JSONP proxy request: "+r.proxy,r]),d({global:!1,url:r.proxy,type:r.proxyType,data:r.data,dataType:"script"===t.dataType?"text/plain":t.dataType,complete:function(e){g.globalEval("("+e.responseText+")"),p(t,r,n,o)}}),o;g.globalEval("("+("string"==typeof r.responseText?'"'+r.responseText+'"':r.responseText)+")")}return p(t,r,n,o),o}(e,t,r);return a||!0}}return null}function p(e,t,r,n){var o;setTimeout(function(){if(f(e,r,t),v(e,r),n){try{o=g.parseJSON(t.responseText)}catch(e){}n.resolveWith(r,[o||t.responseText]),k.log(t,["JSONP mock call complete",t,n])}},c(t.responseTime))}function f(e,t,r){e.success&&e.success.call(t,r.responseText||"","success",{}),e.global&&(e.context?g(e.context):g.event).trigger("ajaxSuccess",[{},e])}function v(e,t){e.complete&&e.complete.call(t,{statusText:"success",status:200},"success"),e.global&&(e.context?g(e.context):g.event).trigger("ajaxComplete",[{},e]),e.global&&!--g.active&&g.event.trigger("ajaxStop")}g.extend({ajax:function e(t,n){var r,o,s,a;k.debug(null,["Ajax call intercepted",t,n]),"object"==typeof t?(n=t,t=void 0):(n=n||{}).url=t||n.url,(o=g.ajaxSetup({},n)).type=o.method=o.method||o.type,a=function(e,t){var r=n[e.toLowerCase()];return function(){g.isFunction(r)&&r.apply(this,[].slice.call(arguments)),t["onAfter"+e]()}};for(var i=0;i<x.length;i++){var u=g.mockjaxSettings.matchInRegistrationOrder?i:x.length-1-i,l=x[u];if(l){if(s=function(e,r){if(g.isFunction(e))return e(r);var t,n=e.namespace||void 0===e.namespace&&g.mockjaxSettings.namespace;if(g.isFunction(e.url.test)){if(n&&(n=n.replace(/(\/+)$/,""),t=e.url.source.replace(/^(\^+)/,"").replace(/^/,"^("+n+")?/?"),e.url=new RegExp(t)),!e.url.test(r.url))return null}else{var o=e.url;n&&(o=[n.replace(/(\/+)$/,""),e.url.replace(/^(\/+)/,"")].join("/"));var s=o.indexOf("*");if(o!==r.url&&-1===s||!new RegExp(o.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".+")).test(r.url))return null}if(e.requestHeaders){if(void 0===r.headers)return null;var a=!1;if(g.each(e.requestHeaders,function(e,t){if(r.headers[e]!==t)return!(a=!0)}),a)return null}return!(!e.data||r.data&&y(e.data,r.data))||e&&e.type&&e.type.toLowerCase()!==r.type.toLowerCase()?null:e}(l,o)){if(g.mockjaxSettings.retainAjaxCalls&&m.push(o),k.info(s,["MOCK "+o.type.toUpperCase()+": "+o.url,g.ajaxSetup({},o)]),301!==s.status&&302!==s.status||"GET"!==o.type.toUpperCase()&&"HEAD"!==o.type.toUpperCase()||!s.headers.Location)return o.dataType&&"JSONP"===o.dataType.toUpperCase()&&(r=j(o,s,n))||(n.crossDomain=!1,s.cache=o.cache,s.timeout=o.timeout,s.global=o.global,s.isTimeout&&(1<s.responseTime?n.timeout=s.responseTime-1:(s.responseTime=2,n.timeout=1)),g.isFunction(s.onAfterSuccess)&&(n.success=a("Success",s)),g.isFunction(s.onAfterError)&&(n.error=a("Error",s)),g.isFunction(s.onAfterComplete)&&(n.complete=a("Complete",s)),function(e,t){if(e.url instanceof RegExp&&e.hasOwnProperty("urlParams")){var r=e.url.exec(t.url);if(1!==r.length){r.shift();for(var n=0,o=r.length,s=e.urlParams.length,a=Math.min(o,s),i={};n<a;n++){var u=e.urlParams[n];i[u]=r[n]}t.urlParams=i}}}(s,n),function(o,s,a,i){r=d.call(g,g.extend(!0,{},a,{xhr:function(){return t=o,r=s,e=a,n=i,k.debug(t,["Creating new mock XHR object",t,r,e,n]),void 0===(t=g.extend(!0,{},g.mockjaxSettings,t)).headers&&(t.headers={}),void 0===r.headers&&(r.headers={}),t.contentType&&(t.headers["content-type"]=t.contentType),{status:t.status,statusText:t.statusText,readyState:1,open:function(){},send:function(){n.fired=!0,T.call(this,t,r,e)},abort:function(){clearTimeout(this.responseTimer)},setRequestHeader:function(e,t){r.headers[e]=t},getResponseHeader:function(e){return t.headers&&t.headers[e]?t.headers[e]:"last-modified"===e.toLowerCase()?t.lastModified||(new Date).toString():"etag"===e.toLowerCase()?t.etag||"":"content-type"===e.toLowerCase()?t.contentType||"text/plain":void 0},getAllResponseHeaders:function(){var r="";return t.contentType&&(t.headers["content-type"]=t.contentType),g.each(t.headers,function(e,t){r+=e+": "+t+"\n"}),r}};var t,r,e,n}}))}(s,o,n,l)),r;k.debug("Doing mock redirect to",s.headers.Location,o.type);for(var c={},p=Object.keys(n),f=0;f<p.length;f++)c[p[f]]=n[p[f]];return c.url=s.headers.Location,c.headers={Referer:n.url},e(c)}k.debug(l,["Mock does not match request",t,o])}}if(k.log(null,["No mock matched to request",t,n]),g.mockjaxSettings.retainAjaxCalls&&h.push(n),!0===g.mockjaxSettings.throwUnmocked)throw new Error("AJAX not mocked: "+n.url);return k.log("Real ajax call to",n.url),d.apply(g,[n])}});var k={_log:function(e,t,r){var n=g.mockjaxSettings.logging;if(e&&void 0!==e.logging&&(n=e.logging),r=0===r?r:r||s.LOG,t=t.splice?t:[t],!(!1===n||n<r))return g.mockjaxSettings.log?g.mockjaxSettings.log(e,t[1]||t[0]):g.mockjaxSettings.logger&&g.mockjaxSettings.logger[g.mockjaxSettings.logLevelMethods[r]]?g.mockjaxSettings.logger[g.mockjaxSettings.logLevelMethods[r]].apply(g.mockjaxSettings.logger,t):void 0},debug:function(e,t){return k._log(e,t,s.DEBUG)},log:function(e,t){return k._log(e,t,s.LOG)},info:function(e,t){return k._log(e,t,s.INFO)},warn:function(e,t){return k._log(e,t,s.WARN)},error:function(e,t){return k._log(e,t,s.ERROR)}},s={DEBUG:4,LOG:3,INFO:2,WARN:1,ERROR:0};return g.mockjaxSettings={log:null,logger:i.console,logging:2,logLevelMethods:["error","warn","info","log","debug"],matchInRegistrationOrder:!0,namespace:null,status:200,statusText:"OK",responseTime:n,isTimeout:!1,throwUnmocked:!1,retainAjaxCalls:!0,contentType:"text/plain",response:"",responseText:"",responseXML:"",proxy:"",proxyType:"GET",lastModified:null,etag:"",headers:{etag:"IJF@H#@923uf8023hFO@I#H#","content-type":"text/plain"}},g.mockjax=function(e){if(g.isArray(e))return g.map(e,function(e){return g.mockjax(e)});var t=x.length;return x[t]=e,k.log(e,["Created new mock handler",e]),t},g.mockjax._logger=k,g.mockjax.clear=function(e){"string"==typeof e||e instanceof RegExp?x=function(t){for(var e,r=[],n=t instanceof RegExp?function(e){return t.test(e)}:function(e){return t===e},o=0,s=x.length;o<s;o++)n((e=x[o]).url)?k.log(e,["Clearing mock: "+(e&&e.url),e]):r.push(e);return r}(e):e||0===e?(k.log(x[e],["Clearing mock: "+(x[e]&&x[e].url),x[e]]),x[e]=null):(k.log(null,"Clearing all mocks"),x=[]),m=[],h=[]},g.mockjax.clearRetainedAjaxCalls=function(){m=[],h=[],k.debug(null,"Cleared retained ajax calls")},g.mockjax.handler=function(e){if(1===arguments.length)return x[e]},g.mockjax.handlers=function(){return x},g.mockjax.mockedAjaxCalls=function(){return m},g.mockjax.unfiredHandlers=function(){for(var e=[],t=0,r=x.length;t<r;t++){var n=x[t];null===n||n.fired||e.push(n)}return e},g.mockjax.unmockedAjaxCalls=function(){return h},g.mockjax});
!function(t,r){"use strict";"function"==typeof define&&define.amd&&define.amd.jQuery?define(["jquery"],function(e){return r(e,t)}):"object"==typeof exports?module.exports=r:r(t.jQuery||t.$,t)}(this,function(v,u){"use strict";var k=v.ajax,b=[],S=[],C=[],l=/=\?(&|$)/,c=(new Date).getTime(),n=500;function M(t,r){L.debug(t,["Checking mock data against request data",t,r]);var n=!0;if(v.isFunction(t))return!!t(r);if("string"==typeof r){if(v.isFunction(t.test))return t.test(r);if("object"!=typeof t)return t===r;r=function(e){var t,r,n,o,s={},a=String(e).split(/&/);for(t=0,r=a.length;t<r;++t){n=a[t];try{n=(n=decodeURIComponent(n.replace(/\+/g," "))).split(/=/)}catch(e){continue}s[n[0]]?(s[n[0]].splice||(o=s[n[0]],s[n[0]]=[],s[n[0]].push(o)),s[n[0]].push(n[1])):s[n[0]]=n[1]}return L.debug(null,["Getting query params from string",e,s]),s}(r)}return v.each(t,function(e){if(void 0===r[e])return n=!1;n="object"==typeof r[e]&&null!==r[e]?(n=n&&v.isArray(r[e])?v.isArray(t[e])&&r[e].length===t[e].length:n)&&M(t[e],r[e]):t[e]&&v.isFunction(t[e].test)?n&&t[e].test(r[e]):n&&t[e]===r[e]}),n}function a(e,t){return e[t]===v.mockjaxSettings[t]}function o(e){return"number"==typeof e&&0<=e}function i(e){if(v.isArray(e)&&2===e.length){var t=e[0],r=e[1];if(o(t)&&o(r))return Math.floor(Math.random()*(r-t))+t}else if(o(e))return e;return n}function O(t,r,n){L.debug(t,["Sending fake XHR request",t,r,n]);o=this;var o,s=function(){return function(){this.status=t.status,this.statusText=t.statusText,this.readyState=1;function e(){var e;this.readyState=4,"json"===r.dataType&&"object"==typeof t.responseText?this.responseText=JSON.stringify(t.responseText):"xml"===r.dataType?"string"==typeof t.responseXML?(this.responseXML=function(t){void 0===u.DOMParser&&u.ActiveXObject&&(u.DOMParser=function(){},DOMParser.prototype.parseFromString=function(e){var t=new ActiveXObject("Microsoft.XMLDOM");return t.async="false",t.loadXML(e),t});try{var e=(new DOMParser).parseFromString(t,"text/xml");if(!v.isXMLDoc(e))throw new Error("Unable to parse XML");if(1===v("parsererror",e).length)throw new Error("Error: "+v(e).text());return e}catch(e){t=void 0===e.name?e:e.name+": "+e.message;v(document).trigger("xmlParseError",[t])}}(t.responseXML),this.responseText=t.responseXML):this.responseXML=t.responseXML:"object"==typeof t.responseText&&null!==t.responseText?(t.contentType="application/json",this.responseText=JSON.stringify(t.responseText)):this.responseText=t.responseText,v.isArray(t.status)?(e=Math.floor(Math.random()*t.status.length),this.status=t.status[e]):"number"!=typeof t.status&&"string"!=typeof t.status||(this.status=t.status),"string"==typeof t.statusText&&(this.statusText=t.statusText),e=this.onload||this.onreadystatechange,v.isFunction(e)?(t.isTimeout&&(this.status=-1),e.call(this,t.isTimeout?"timeout":void 0)):t.isTimeout&&(this.status=-1)}if(v.isFunction(t.response)){if(2===t.response.length)return void t.response(n,function(){e.call(o)});t.response(n)}e.call(o)}.apply(o)};t.proxy?(L.info(t,["Retrieving proxy file: "+t.proxy,t]),k({global:!1,url:t.proxy,type:t.proxyType,data:t.data,async:r.async,dataType:"script"===r.dataType?"text/plain":r.dataType,complete:function(e){t.responseXML=t.responseText=e.responseText,a(t,"status")&&(t.status=e.status),a(t,"statusText")&&(t.statusText=e.statusText),!1===r.async?s():this.responseTimer=setTimeout(s,i(t.responseTime))}})):!1===r.async?s():this.responseTimer=setTimeout(s,i(t.responseTime))}function w(e,t,r){if("GET"===(s=e).type.toUpperCase()?l.test(s.url)||(s.url+=(/\?/.test(s.url)?"&":"?")+(s.jsonp||"callback")+"=?"):s.data&&l.test(s.data)||(s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?"),e.dataType="json",e.data&&l.test(e.data)||l.test(e.url)){var n=e,o=t,s=r,a=s&&s.context||n,i="string"==typeof n.jsonpCallback&&n.jsonpCallback||"jsonp"+c++,s=(n.data&&(n.data=(n.data+"").replace(l,"="+i+"$1")),n.url=n.url.replace(l,"="+i+"$1"),u[i]=u[i]||function(){f(n,a,o),g(n,a),u[i]=void 0;try{delete u[i]}catch(e){}},n.jsonpCallback=i,/^(\w+:)?\/\/([^\/?#]+)/.exec(e.url)),s=s&&(s[1]&&s[1]!==location.protocol||s[2]!==location.host);if(e.dataType="script","GET"===e.type.toUpperCase()&&s)return function(t,r,e){L.debug(r,["Performing JSONP request",r,t,e]);var n=e&&e.context||t,o=v.Deferred?new v.Deferred:null;if(r.response&&v.isFunction(r.response))r.response(e);else if("object"==typeof r.responseText)v.globalEval("("+JSON.stringify(r.responseText)+")");else{if(r.proxy)return L.info(r,["Performing JSONP proxy request: "+r.proxy,r]),k({global:!1,url:r.proxy,type:r.proxyType,data:r.data,dataType:"script"===t.dataType?"text/plain":t.dataType,complete:function(e){v.globalEval("("+e.responseText+")"),p(t,r,n,o)}}),o;v.globalEval("("+("string"==typeof r.responseText?'"'+r.responseText+'"':r.responseText)+")")}return p(t,r,n,o),o}(e,t,r)||!0}return null}function p(e,t,r,n){var o;setTimeout(function(){if(f(e,r,t),g(e,r),n){try{o=v.parseJSON(t.responseText)}catch(e){}n.resolveWith(r,[o||t.responseText]),L.log(t,["JSONP mock call complete",t,n])}},i(t.responseTime))}function f(e,t,r){e.success&&e.success.call(t,r.responseText||"","success",{}),e.global&&(e.context?v(e.context):v.event).trigger("ajaxSuccess",[{},e])}function g(e,t){e.complete&&e.complete.call(t,{statusText:"success",status:200},"success"),e.global&&(e.context?v(e.context):v.event).trigger("ajaxComplete",[{},e]),e.global&&!--v.active&&v.event.trigger("ajaxStop")}v.extend({ajax:function e(t,n){var r,o,s;L.debug(null,["Ajax call intercepted",t,n]),"object"==typeof t?(n=t,t=void 0):(n=n||{}).url=t||n.url,(o=v.ajaxSetup({},n)).type=o.method=o.method||o.type;for(var a=function(e,t){var r=n[e.toLowerCase()];return function(){v.isFunction(r)&&r.apply(this,[].slice.call(arguments)),t["onAfter"+e]()}},i=0;i<b.length;i++){var u=v.mockjaxSettings.matchInRegistrationOrder?i:b.length-1-i;if(u=b[u]){if(s=function(e,r){if(v.isFunction(e))return e(r);var t=e.namespace||void 0===e.namespace&&v.mockjaxSettings.namespace;if(v.isFunction(e.url.test)){if(t&&(t=t.replace(/(\/+)$/,""),n=e.url.source.replace(/^(\^+)/,"").replace(/^/,"^("+t+")?/?"),e.url=new RegExp(n)),!e.url.test(r.url))return null}else{var n=e.url,t=(n=t?[t.replace(/(\/+)$/,""),e.url.replace(/^(\/+)/,"")].join("/"):n).indexOf("*");if(n!==r.url&&-1===t||!new RegExp(n.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".+")).test(r.url))return null}if(e.requestHeaders){if(void 0===r.headers)return null;var o=!1;if(v.each(e.requestHeaders,function(e,t){if(r.headers[e]!==t)return!(o=!0)}),o)return null}return!(!e.data||r.data&&M(e.data,r.data))||e&&e.type&&e.type.toLowerCase()!==r.type.toLowerCase()?null:e}(u,o)){if(v.mockjaxSettings.retainAjaxCalls&&S.push(o),L.info(s,["MOCK "+o.type.toUpperCase()+": "+o.url,v.ajaxSetup({},o)]),(301===s.status||302===s.status)&&("GET"===o.type.toUpperCase()||"HEAD"===o.type.toUpperCase())&&s.headers.Location){L.debug("Doing mock redirect to",s.headers.Location,o.type);for(var l={},c=Object.keys(n),p=0;p<c.length;p++)l[c[p]]=n[c[p]];return l.url=s.headers.Location,l.headers={Referer:n.url},e(l)}if(!o.dataType||"JSONP"!==o.dataType.toUpperCase()||!(r=w(o,s,n))){n.crossDomain=!1,s.cache=o.cache,s.timeout=o.timeout,s.global=o.global,s.isTimeout&&(1<s.responseTime?n.timeout=s.responseTime-1:(s.responseTime=2,n.timeout=1)),v.isFunction(s.onAfterSuccess)&&(n.success=a("Success",s)),v.isFunction(s.onAfterError)&&(n.error=a("Error",s)),v.isFunction(s.onAfterComplete)&&(n.complete=a("Complete",s)),j=T=y=h=m=x=d=g=f=void 0;var f=s,g=n;if(f.url instanceof RegExp&&f.hasOwnProperty("urlParams")){var d=f.url.exec(g.url);if(1!==d.length){d.shift();for(var x=0,m=d.length,h=f.urlParams.length,y=Math.min(m,h),T={};x<y;x++){var j=f.urlParams[x];T[j]=d[x]}g.urlParams=T}}!function(o,s,a,i){r=k.call(v,v.extend(!0,{},a,{xhr:function(){return t=o,r=s,e=a,n=i,L.debug(t,["Creating new mock XHR object",t,r,e,n]),void 0===(t=v.extend(!0,{},v.mockjaxSettings,t)).headers&&(t.headers={}),void 0===r.headers&&(r.headers={}),t.contentType&&(t.headers["content-type"]=t.contentType),{status:t.status,statusText:t.statusText,readyState:1,open:function(){},send:function(){n.fired=!0,O.call(this,t,r,e)},abort:function(){clearTimeout(this.responseTimer)},setRequestHeader:function(e,t){r.headers[e]=t},getResponseHeader:function(e){return t.headers&&t.headers[e]?t.headers[e]:"last-modified"===e.toLowerCase()?t.lastModified||(new Date).toString():"etag"===e.toLowerCase()?t.etag||"":"content-type"===e.toLowerCase()?t.contentType||"text/plain":void 0},getAllResponseHeaders:function(){var r="";return t.contentType&&(t.headers["content-type"]=t.contentType),v.each(t.headers,function(e,t){r+=e+": "+t+"\n"}),r}};var t,r,e,n}}))}(s,o,n,u)}return r}L.debug(u,["Mock does not match request",t,o])}}if(L.log(null,["No mock matched to request",t,n]),v.mockjaxSettings.retainAjaxCalls&&C.push(n),!0===v.mockjaxSettings.throwUnmocked)throw new Error("AJAX not mocked: "+n.url);return L.log("Real ajax call to",n.url),k.apply(v,[n])}});var L={_log:function(e,t,r){var n=v.mockjaxSettings.logging;if(e&&void 0!==e.logging&&(n=e.logging),r=0===r?r:r||s.LOG,t=t.splice?t:[t],!(!1===n||n<r))return v.mockjaxSettings.log?v.mockjaxSettings.log(e,t[1]||t[0]):v.mockjaxSettings.logger&&v.mockjaxSettings.logger[v.mockjaxSettings.logLevelMethods[r]]?v.mockjaxSettings.logger[v.mockjaxSettings.logLevelMethods[r]].apply(v.mockjaxSettings.logger,t):void 0},debug:function(e,t){return L._log(e,t,s.DEBUG)},log:function(e,t){return L._log(e,t,s.LOG)},info:function(e,t){return L._log(e,t,s.INFO)},warn:function(e,t){return L._log(e,t,s.WARN)},error:function(e,t){return L._log(e,t,s.ERROR)}},s={DEBUG:4,LOG:3,INFO:2,WARN:1,ERROR:0};return v.mockjaxSettings={log:null,logger:u.console,logging:2,logLevelMethods:["error","warn","info","log","debug"],matchInRegistrationOrder:!0,namespace:null,status:200,statusText:"OK",responseTime:n,isTimeout:!1,throwUnmocked:!1,retainAjaxCalls:!0,contentType:"text/plain",response:"",responseText:"",responseXML:"",proxy:"",proxyType:"GET",lastModified:null,etag:"",headers:{etag:"IJF@H#@923uf8023hFO@I#H#","content-type":"text/plain"}},v.mockjax=function(e){var t;return v.isArray(e)?v.map(e,function(e){return v.mockjax(e)}):(t=b.length,b[t]=e,L.log(e,["Created new mock handler",e]),t)},v.mockjax._logger=L,v.mockjax.clear=function(e){"string"==typeof e||e instanceof RegExp?b=function(t){for(var e,r=[],n=t instanceof RegExp?function(e){return t.test(e)}:function(e){return t===e},o=0,s=b.length;o<s;o++)n((e=b[o]).url)?L.log(e,["Clearing mock: "+(e&&e.url),e]):r.push(e);return r}(e):e||0===e?(L.log(b[e],["Clearing mock: "+(b[e]&&b[e].url),b[e]]),b[e]=null):(L.log(null,"Clearing all mocks"),b=[]),S=[],C=[]},v.mockjax.clearRetainedAjaxCalls=function(){S=[],C=[],L.debug(null,"Cleared retained ajax calls")},v.mockjax.handler=function(e){if(1===arguments.length)return b[e]},v.mockjax.handlers=function(){return b},v.mockjax.mockedAjaxCalls=function(){return S},v.mockjax.unfiredHandlers=function(){for(var e=[],t=0,r=b.length;t<r;t++){var n=b[t];null===n||n.fired||e.push(n)}return e},v.mockjax.unmockedAjaxCalls=function(){return C},v.mockjax});

@@ -1,2 +0,2 @@

var PORT = 4000;
const PORT = 4000;

@@ -13,4 +13,3 @@ module.exports = {

' * ',
' * Dual licensed under the MIT or GPL licenses.',
' * http://opensource.org/licenses/MIT OR http://www.gnu.org/licenses/gpl-2.0.html',
' * Licensed under the MIT license: http://opensource.org/licenses/MIT',
' */\n'

@@ -46,4 +45,3 @@ ].join('\n'),

'Gruntfile.js',
'test/test.js',
'test/requirejs/*.js',
'test/**/test-*.js',
'test/nodejs/*.js',

@@ -69,46 +67,7 @@ 'test/browserify/main.js',

jQueryVersions: [
'1.5.2',
'1.6.4',
'1.7.2',
'1.8.3',
'1.9.1',
'1.10.2',
'1.11.3',
'1.12.4',
'2.0.3',
'2.1.4',
'2.2.4',
'3.0.0',
'3.1.1',
'3.2.1',
'3.3.1',
'3.4.1',
'3.5.1'
'3.7.1'
]
},
requirejs: {
jQueryVersions: [
'1.7.2',
'1.8.3',
'1.9.1',
'1.12.4',
'2.2.4',
'3.5.1'
]
},
latestInBranch: {
jQueryVersions: [
'1.12.4',
'2.2.4',
'3.5.1'
]
},
oldestAndLatest: {
jQueryVersions: [
'1.5.2',
'1.12.4',
'2.2.4',
'3.5.1'
]
},
edge: {

@@ -120,19 +79,5 @@ jQueryVersions: ['git']

jQueryVersions: [
'1.5.2',
'1.6.4',
'1.7.2',
'1.8.3',
'1.9.1',
'1.10.2',
'1.11.3',
'1.12.4',
'2.0.3',
'2.1.4',
'2.2.4',
'3.0.0',
'3.1.1',
'3.2.1',
'3.3.1',
'3.4.1',
'3.5.1'
'3.7.1'
]

@@ -162,5 +107,5 @@ },

files: './src/*.js',
tasks: ['jshint', 'test:latestInBranch']
tasks: ['jshint', 'test:all']
}
}
};
/* jshint ignore:start */
var testRunner = require('./qunit-puppeteer.js');
const testRunner = require('./lib/qunit-puppeteer.js');
/* jshint ignore:end */

@@ -11,7 +11,7 @@

/* This is used in an await statement, which apaprently JSHint doesn't like */
var PORT = 4000;
const PORT = 4000;
/* jshint ignore:end */
// Project configuration
var config = require('./grunt-config-options');
const config = require('./grunt-config-options');
config.pkg = grunt.file.readJSON('package.json');

@@ -23,3 +23,3 @@

grunt.registerTask('dev', ['jshint', 'test:all', 'test:requirejs', 'browserify', 'test:browserify', 'mochaTest']);
grunt.registerTask('dev', ['jshint', 'test:all', 'browserify', 'test:browserify', 'mochaTest']);
grunt.registerTask('build', ['dev', 'concat', 'uglify', 'test:dist']);

@@ -31,9 +31,7 @@ grunt.registerTask('default', ['dev']);

/* jshint ignore:end */
var done = this.async();
var i;
const done = this.async();
const versionUrls = require('./test/build-version-urls')(grunt.config, arguments[0], arguments[1], arguments[2]);
var versionUrls = require('./test/build-version-urls')(grunt.config, arguments[0], arguments[1], arguments[2]);
console.log(versionUrls);
for (i=0; i<versionUrls.length; ++i) {
for (let i=0; i<versionUrls.length; ++i) {
try {

@@ -40,0 +38,0 @@ console.log('LOADING', versionUrls[i]);

{
"name": "jquery-mockjax",
"title": "jQuery Mockjax",
"version": "2.6.0",
"version": "2.6.1",
"main": "./src/jquery.mockjax.js",

@@ -20,4 +20,4 @@ "description": "The jQuery Mockjax Plugin provides a simple and extremely flexible interface for mocking or simulating ajax requests and responses.",

"author": {
"name": "Jonathan Sharp",
"url": "http://jdsharp.com"
"name": "Jordan Kasper",
"url": "http://jordankasper.com"
},

@@ -32,3 +32,4 @@ "contributors": [

{
"name": "Jordan Kasper"
"name": "Jonathan Sharp",
"url": "http://jdsharp.com"
}

@@ -48,31 +49,26 @@ ],

"url": "http://opensource.org/licenses/MIT"
},
{
"type": "GPLv2",
"url": "http://www.gnu.org/licenses/gpl-2.0.html"
}
],
"dependencies": {
"jquery": ">=1.5.2"
},
"devDependencies": {
"browserify": "^16.5.2",
"browserstack-runner": "^0.9.3",
"grunt": "^1.3.0",
"grunt-browserify": "^5.3.0",
"grunt-contrib-concat": "^1.0.1",
"grunt-contrib-connect": "^3.0.0",
"grunt-contrib-jshint": "^2.1.0",
"grunt-contrib-qunit": "^4.0.0",
"grunt-contrib-uglify": "^5.0.0",
"browserify": "^17.0.0",
"browserstack-runner": "^0.9.4",
"grunt": "^1.6.1",
"grunt-browserify": "^6.0.0",
"grunt-contrib-concat": "^2.1.0",
"grunt-contrib-connect": "^4.0.0",
"grunt-contrib-jshint": "^3.2.0",
"grunt-contrib-qunit": "^8.0.1",
"grunt-contrib-uglify": "^5.2.2",
"grunt-contrib-watch": "^1.1.0",
"grunt-mocha-test": "^0.13.3",
"http-server": "^0.12.3",
"jsdom": "^16.4.0",
"http-server": "^14.1.1",
"jquery": "^3.7.1",
"jsdom": "^24.0.0",
"load-grunt-tasks": "^5.1.0",
"mocha": "^8.1.1",
"puppeteer": "^5.2.1",
"sinon": "^9.0.3",
"mocha": "^10.3.0",
"puppeteer": "^22.1.0",
"qunit": "^2.20.1",
"sinon": "^17.0.1",
"xmlhttprequest": "^1.8.0"
}
}
# jQuery Mockjax: Ajax request mocking #
[http://github.com/jakerella/jquery-mockjax/](http://github.com/jakerella/jquery-mockjax/)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/72d5f8c1c29ee60f6282d7d3fa9cb52c)](https://www.codacy.com/app/mikehostetler_1249/jquery-mockjax)
[![Travis CI Badge](https://travis-ci.com/jakerella/jquery-mockjax.svg?branch=master)](https://travis-ci.com/jakerella/jquery-mockjax)
[![BrowserStack Status](https://automate.browserstack.com/badge.svg?badge_key=VTdsNjQzSDZvSXA2ZDhsamFkaG5pWWVFTmUwWDdmRmltTkFoY2VVR01COD0tLWVrSXY0YTJwWXNiZ2tlbmxBNTBpUmc9PQ==--e3dabee1a4e801501ff510bef8292859e10cb008)](https://automate.browserstack.com/public-build/VTdsNjQzSDZvSXA2ZDhsamFkaG5pWWVFTmUwWDdmRmltTkFoY2VVR01COD0tLWVrSXY0YTJwWXNiZ2tlbmxBNTBpUmc9PQ==--e3dabee1a4e801501ff510bef8292859e10cb008)

@@ -42,3 +40,3 @@ There are some minor breaking changes in v2, so if you need an older version, please check the [v1.x](https://github.com/jakerella/jquery-mockjax/tree/v1.x) branch or the list of [releases](https://github.com/jakerella/jquery-mockjax/tags) in Github.

* [Browsers Tested](#browsers-tested)
* [Using Mockjax in Other Ways (Node, require, browserify, etc)](#using-mockjax-in-other-ways)
* [Using Mockjax in Other Ways (Node, browserify, etc)](#using-mockjax-in-other-ways)
* [Logging](#logging)

@@ -809,6 +807,6 @@ * [Release History](#release-history)

We strive to ensure that Mockjax is tested on the furthest patch version of all
minor (and major) versions of jQuery beginning with 1.5.2 going all the way
through 3.x. In other words, we don't test 1.6.1, but rather 1.6.4 (the furthest
patch version on the 1.6.x line). The QUnit tests in the `/test` directory include
links to each version of jQuery tested in the header.
minor versions of jQuery (1.x.y through 3.x.y). In other words, we don't test
1.12.1, but rather 1.12.4 (the furthest patch version on the 1.x line). The QUnit
tests in the `/test` directory include links to each version of jQuery tested in
the header.

@@ -826,3 +824,2 @@ ### Browsers Tested ###

* Safari
* Internet Explorer 11 (although it may work on IE 9 & 10)

@@ -835,3 +832,3 @@ Each PR will run these tests using TravisCI for continuous integration before

You can use Mockjax as a Node module, with require.js, or with Browserify... and
You can use Mockjax as a Node module or with Browserify... and
presumably in other ways as well. We have tests for each of the methods above.

@@ -932,9 +929,7 @@

Copyright (c) 2014 Jordan Kasper, formerly appendTo
Copyright (c) 2014-2024 Jordan Kasper, formerly appendTo
NOTE: This repository was taken over by Jordan Kasper (@jakerella) October, 2014
Dual licensed under the MIT or GPL licenses:
[http://opensource.org/licenses/MIT](http://opensource.org/licenses/MIT)
[http://www.gnu.org/licenses/gpl-2.0.html](http://www.gnu.org/licenses/gpl-2.0.html)
Licensed under the MIT license: [http://opensource.org/licenses/MIT](http://opensource.org/licenses/MIT)

@@ -941,0 +936,0 @@ ### Troubleshooting ###

@@ -5,25 +5,26 @@

var i, l,
parts = document.location.search.match( /testFiles=([^&]+)/ ),
ignore = document.location.search.match( /ignoreFiles=([^&]+)/ ),
testFiles = [
'core', // This will become: <script src='test-core.js'></script>
'data-match',
'data-types',
'header-match',
'url-match',
'match-order',
'headers',
'mock-clearing',
'retaining-ajax-calls',
'namespace',
'logging',
'connection',
'timeout',
'bugs'
];
const parts = document.location.search.match( /testFiles=([^&]+)/ ),
ignore = document.location.search.match( /ignoreFiles=([^&]+)/ );
let testFiles = [
// These will become something like: <script src='test-core.js'></script>
'core',
'data-match',
'data-types',
'header-match',
'url-match',
'match-order',
'headers',
'mock-clearing',
'retaining-ajax-calls',
'namespace',
'logging',
'connection',
'timeout',
'bugs'
];
if ( parts && parts[1] ) {
try {
var inputFiles = JSON.parse( decodeURIComponent(parts[ 1 ]) ) || null;
const inputFiles = JSON.parse( decodeURIComponent(parts[ 1 ]) ) || null;
if (inputFiles && inputFiles.length && inputFiles[0] !== 'all') {

@@ -40,3 +41,3 @@ testFiles = inputFiles;

try {
var ignoreFiles = JSON.parse( decodeURIComponent(ignore[ 1 ]) ) || null;
const ignoreFiles = JSON.parse( decodeURIComponent(ignore[ 1 ]) ) || null;
if (ignoreFiles && ignoreFiles.length) {

@@ -52,3 +53,3 @@ testFiles = testFiles.filter(function(file) {

for ( i=0, l = testFiles.length; i<l; i++ ) {
for (let i=0, l = testFiles.length; i<l; i++ ) {
document.write( '<script src="test-' + testFiles[ i ] + '.js"></script>' );

@@ -55,0 +56,0 @@ }

'use strict';
var jquery = require('../../lib/jquery-3.5.1.js');
var mockjax = require('../../src/jquery.mockjax')(jquery, window);
const jquery = require('jquery');
const mockjax = require('../../src/jquery.mockjax')(jquery, window);

@@ -25,3 +25,3 @@ mockjax({

// You would NOT need this in your own code.
window.jQuery = jquery;
window.jQuery = window.$ = jquery;
window.getResource = getResource;
var PORT = 4000;
const PORT = 4000;
module.exports = function buildVersionURLs(config, arg1, arg2, arg3, arg4) {
var gruntConfig = (config.get && config.get()) || config;
const gruntConfig = (config.get && config.get()) || config;
var i, l, url,
baseURL = 'http://localhost:' + PORT,
const baseURL = 'http://localhost:' + PORT,
versionUrls = [],
testFiles = arg2 || null,
ignoreFiles = arg3 || null,
source = arg1 || 'all',
versions = (gruntConfig.test[source] && gruntConfig.test[source].jQueryVersions) || [],
file = (gruntConfig.test[source] && gruntConfig.test[source].file) || 'index.html';
let testFiles = arg2 || null,
ignoreFiles = arg3 || null,
versions = (gruntConfig.test[source] && gruntConfig.test[source].jQueryVersions) || [];

@@ -30,12 +30,6 @@ if (arg1 === 'version' && arg2) {

for (i=0, l=versions.length; i<l; ++i) {
if (arg1 === 'requirejs') {
url = 'test/requirejs/' + file + '?jquery=' + versions[i] + '&testFiles=' + testFiles + '&ignoreFiles=' + ignoreFiles;
if (!config.onlyPaths) { url = baseURL + '/' + url; }
versionUrls.push( url );
} else {
url = 'test/' + file + '?jquery=' + versions[i] + '&testFiles=' + testFiles + '&ignoreFiles=' + ignoreFiles;
if (!config.onlyPaths) { url = baseURL + '/' + url; }
versionUrls.push( url );
}
for (let i=0, l=versions.length; i<l; ++i) {
let url = 'test/' + file + '?jquery=' + versions[i] + '&testFiles=' + testFiles + '&ignoreFiles=' + ignoreFiles;
if (!config.onlyPaths) { url = baseURL + '/' + url; }
versionUrls.push( url );
}

@@ -42,0 +36,0 @@

/* globals describe,beforeEach,afterEach,it */
var jsDomEnv = require('jsdom').env,
assert = require('assert');
const jsdom = require('jsdom');
const { JSDOM } = jsdom;
const assert = require('assert');

@@ -9,21 +10,15 @@ describe('Node module setup', function() {

var $, xhr, win;
let $, xhr, win;
beforeEach(function(done) {
jsDomEnv('<html></html>', function (error, window) {
if (error) {
assert(false);
} else {
win = window;
$ = require('jquery')(window);
xhr = require('xmlhttprequest').XMLHttpRequest;
$.support.cors = true;
$.ajaxSettings.xhr = function () {
/*jshint newcap:false*/
return new xhr();
/*jshint newcap:true*/
};
}
done();
});
win = (new JSDOM('<html></html>')).window;
$ = require('jquery')(win);
xhr = require('xmlhttprequest').XMLHttpRequest;
$.support.cors = true;
$.ajaxSettings.xhr = function () {
/*jshint newcap:false*/
return new xhr();
/*jshint newcap:true*/
};
done();
});

@@ -41,3 +36,3 @@

it('should be loaded when required', function() {
var mockjax = require('../../src/jquery.mockjax')($, win);
const mockjax = require('../../src/jquery.mockjax')($, win);
assert.equal(typeof mockjax, 'function');

@@ -48,3 +43,3 @@ assert.equal(typeof $.mockjax, 'function');

it('should mock a simple request using returned module', function(done) {
var mockjax = require('../../src/jquery.mockjax')($, win);
const mockjax = require('../../src/jquery.mockjax')($, win);

@@ -51,0 +46,0 @@ mockjax({

@@ -1,1 +0,1 @@

TEST_SCRIPT_VAR = 1;
var TEST_SCRIPT_VAR = 1;

@@ -352,3 +352,6 @@ (function(qunit, $) {

assert.equal(actualCalls.length, 1, 'Mockjax call made');
assert.ok(actualCalls[0] && actualCalls[0].url.match(/\/api\/jsonp\?callback\=jsonp[0-9]+/), 'mockjax call has expected jsonp url');
assert.ok(
actualCalls[0] && actualCalls[0].url.match(/\/api\/jsonp\?callback\=jsonp[0-9]+/),
'mockjax call has expected jsonp url'
);
done();

@@ -379,3 +382,6 @@ }

assert.equal(actualCalls.length, 1, 'Mockjax call made');
assert.ok(actualCalls[0] && actualCalls[0].url.match(/\/api\/jsonp\?callback\=jsonp[0-9]+/), 'mockjax call has expected jsonp url');
assert.ok(
actualCalls[0] && actualCalls[0].url.match(/\/api\/jsonp\?callback\=jsonp[0-9]+/),
'mockjax call has expected jsonp url'
);
done();

@@ -406,3 +412,6 @@ }

assert.equal(actualCalls.length, 1, 'Mockjax call made');
assert.ok(actualCalls[0] && actualCalls[0].url.match(/\/api\/jsonp\?callback\=jsonp[0-9]+/), 'mockjax call has expected jsonp url');
assert.ok(
actualCalls[0] && actualCalls[0].url.match(/\/api\/jsonp\?callback\=jsonp[0-9]+/),
'mockjax call has expected jsonp url'
);
done();

@@ -409,0 +418,0 @@ }

@@ -278,3 +278,7 @@ (function(qunit, $) {

if (numLoopsComplete >= maxNumLoops) {
assert.equal(returnedStatuses.length, possibleStatuses.length, "Did not randomly return all possible statuses (only returned: " + returnedStatuses.toString() + ")");
assert.equal(
returnedStatuses.length,
possibleStatuses.length,
'Did not randomly return all possible statuses (only returned: ' + returnedStatuses.toString() + ')'
);

@@ -288,3 +292,3 @@ done();

}
}
};

@@ -597,3 +601,3 @@ do {

assert.equal(handlers.length, 2, 'Not enough mocks')
assert.equal(handlers.length, 2, 'Not enough mocks');

@@ -625,3 +629,3 @@ var callCount = 2;

assert.equal(handlers.length, 0)
assert.equal(handlers.length, 0);

@@ -640,3 +644,3 @@ $.ajax({

assert.equal(handlers.length, 1)
assert.equal(handlers.length, 1);

@@ -643,0 +647,0 @@ $.ajax({

@@ -114,3 +114,3 @@ (function(qunit, $) {

'2'
)
);

@@ -127,3 +127,3 @@ testMatchOrder(

'3'
)
);

@@ -140,4 +140,4 @@ testMatchOrder(

'3'
)
);
})(window.QUnit, window.jQuery);

@@ -158,3 +158,3 @@ (function(qunit, $) {

assert.equal(numberOfMockedCalls, 0, 'Mocked calls count did not increase');
done()
done();
}

@@ -200,3 +200,3 @@ });

assert.equal(numberOfUnmockedCalls, 0, 'Unmocked calls count did not increase');
done()
done();
}

@@ -228,6 +228,6 @@ });

var numberOfMockedCalls = $.mockjax.mockedAjaxCalls().length;
numberOfMockedCalls = $.mockjax.mockedAjaxCalls().length;
assert.equal(numberOfMockedCalls, 0, 'Mocked calls count was reset to zero');
done()
done();
}

@@ -260,6 +260,6 @@ });

var numberOfUnmockedCalls = $.mockjax.unmockedAjaxCalls().length;
numberOfUnmockedCalls = $.mockjax.unmockedAjaxCalls().length;
assert.equal(numberOfUnmockedCalls, 0, 'Unmocked calls count was reset to zero');
done()
done();
}

@@ -291,6 +291,6 @@ });

var numberOfMockedCalls = $.mockjax.mockedAjaxCalls().length;
numberOfMockedCalls = $.mockjax.mockedAjaxCalls().length;
assert.equal(numberOfMockedCalls, 0, 'Mocked calls count was reset to zero');
done()
done();
}

@@ -323,6 +323,6 @@ });

var numberOfUnmockedCalls = $.mockjax.unmockedAjaxCalls().length;
numberOfUnmockedCalls = $.mockjax.unmockedAjaxCalls().length;
assert.equal(numberOfUnmockedCalls, 0, 'Unmocked calls count was reset to zero');
done()
done();
}

@@ -329,0 +329,0 @@ });

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc