-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmock.min.js
More file actions
4 lines (4 loc) · 1.12 KB
/
mock.min.js
File metadata and controls
4 lines (4 loc) · 1.12 KB
1
2
3
4
var mock;
(function(){mock=function(){function a(){var a=new Date,b=new Date;for(d.push({callDate:a,args:arguments,that:this,before:function(a){return this.callDate<a.callDate},after:function(a){return this.callDate>a.callDate},calledWith:function(){var a;for(a=0;a<arguments.length;a+=1)if(arguments[a]!==this.args[a])return!1;return!0}});b-a<1;)b=new Date;return(g=f[d.length-1]||f[f.length-1])&&g.apply(this,arguments)}function e(a,b){var d=1,e;a!==void 0&&(d=a);for(e=0;e<d;e+=1)f.push(b)}var f=[],d=[],g;a.returnValue=
function(c,b){e(b,function(){return c});return a};a.throwError=function(c,b){e(b,function(){throw c;});return a};a.invoke=function(c,b){e(b,function(){return c.apply(this,arguments)});return a};a.calls=d;a.called=function(){return d.length};a.before=function(a){return this.calls[0].before(a.calls[0])};a.after=function(a){return this.calls[0].after(a.calls[0])};a.calledWith=function(){var c;a.calledWith.index=a.calledWith.index||0;if(a.calledWith.index>=this.calls.length)return!1;c=this.calls[a.calledWith.index].calledWith.apply(this.calls[a.calledWith.index],
arguments);a.calledWith.index+=1;return c};return a}})();