Comparing version 1.7.0 to 1.8.0
@@ -0,1 +1,6 @@ | ||
v1.8.0 / 2017-07-21 | ||
=================== | ||
* add Times.atLeast(n: number) and Times.atMost(n: number) #68 | ||
v1.7.0 / 2017-05-29 | ||
@@ -2,0 +7,0 @@ =================== |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("lodash"),require("circular-json")):"function"==typeof define&&define.amd?define(["exports","lodash","circular-json"],e):e(t.TypeMoq=t.TypeMoq||{},t._,t.CircularJSON)}(this,function(t,e,n){!function(t){t[t.Loose=0]="Loose",t[t.Strict=1]="Strict"}(t.MockBehavior||(t.MockBehavior={})),function(t){t[t.InAnyOrder=0]="InAnyOrder",t[t.InSequence=1]="InSequence"}(t.ExpectedCallType||(t.ExpectedCallType={}));var r,o=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),i=function(t){function e(n,r){var o=t.call(this,r)||this;return o.name=n,Object.setPrototypeOf(o,e.prototype),o}return o(e,t),e.prototype.toString=function(){var t=this.message?this.name+" - "+this.message:this.name;return t},e}(Error),c=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();!function(t){t[t.NoSetup="no setup expression found for"]="NoSetup",t[t.MoreThanOneSetup="more than one setup expression found for"]="MoreThanOneSetup",t[t.InvalidArg="invalid argument"]="InvalidArg",t[t.InvalidSetup="invalid setup expression"]="InvalidSetup",t[t.InvalidMatcher="invalid matching expression"]="InvalidMatcher",t[t.UnknownGlobalType="unknown global type"]="UnknownGlobalType",t[t.CallCountVerificationFailed="invocation count verification failed"]="CallCountVerificationFailed",t[t.CallOrderVerificationFailed="invocation order verification failed"]="CallOrderVerificationFailed",t[t.InvalidDynamicProxyRuntime="invalid dynamic proxy runtime"]="InvalidDynamicProxyRuntime"}(r||(r={}));var u=function(t){function e(n,r,o){void 0===o&&(o=void 0);var i=t.call(this,"MockException",o)||this;return i.reason=n,i.ctx=r,i.message=o,Object.setPrototypeOf(i,e.prototype),i}return c(e,t),e.prototype.toString=function(){var t=this.name+" - "+this.reason;return this.message&&(t=t+" ("+this.message+")"),t},e}(i),a=function(){function t(t,n,r,o){this._condition=t,this.min=n,this.max=r,this._failMessage=e.template(o)}return t.prototype.failMessage=function(t){return this._failMessage({i:t,n:this.min,m:this._lastCallCount})},t.prototype.verify=function(t){return this._lastCallCount=t,this._condition(t)},t.exactly=function(e){if(0>e)throw new u(r.InvalidArg,void 0,"'Times.exactly' argument cannot be a negative number");return new t(function(t){return t===e},e,e,t.NO_MATCHING_CALLS_EXACTLY_N_TIMES)},t.never=function(){return t.exactly(0)},t.once=function(){return t.exactly(1)},t.atLeastOnce=function(){return new t(function(t){return t>=1},1,255,t.NO_MATCHING_CALLS_AT_LEAST_ONCE)},t.atMostOnce=function(){return new t(function(t){return t>=0&&1>=t},0,1,t.NO_MATCHING_CALLS_AT_MOST_ONCE)},t.prototype.toString=function(){var t="";return this.min===this.max?t=0===this.min?"never":1===this.min?"once":this.min+" times":this.min>=0&&this.max<=1?t="at most once":this.min>=1&&(t="at least once"),t},t}();a.NO_MATCHING_CALLS_EXACTLY_N_TIMES="expected invocation of <%= i %> <%= n %> times, invoked <%= m %> times",a.NO_MATCHING_CALLS_AT_LEAST_ONCE="expected invocation of <%= i %> at least once, invoked <%= m %> times",a.NO_MATCHING_CALLS_AT_MOST_ONCE="expected invocation of <%= i %> at most once, invoked <%= m %> times";var s=function(){function t(){}return t.getOwnEnumerables=function(t){return this._getPropertyNames(t,!0,!1,this._enumerable)},t.getOwnNonenumerables=function(t){return this._getPropertyNames(t,!0,!1,this._notEnumerable)},t.getOwnEnumerablesAndNonenumerables=function(t){return this._getPropertyNames(t,!0,!1,this._enumerableAndNotEnumerable)},t.getPrototypeEnumerables=function(t){return this._getPropertyNames(t,!1,!0,this._enumerable)},t.getPrototypeNonenumerables=function(t){return this._getPropertyNames(t,!1,!0,this._notEnumerable)},t.getPrototypeEnumerablesAndNonenumerables=function(t){return this._getPropertyNames(t,!1,!0,this._enumerableAndNotEnumerable)},t.getOwnAndPrototypeEnumerables=function(t){return this._getPropertyNames(t,!0,!0,this._enumerable)},t.getOwnAndPrototypeNonenumerables=function(t){return this._getPropertyNames(t,!0,!0,this._notEnumerable)},t.getOwnAndPrototypeEnumerablesAndNonenumerables=function(t){return this._getPropertyNames(t,!0,!0,this._enumerableAndNotEnumerable)},t._enumerable=function(t,e){return t.propertyIsEnumerable(e)},t._notEnumerable=function(t,e){return!t.propertyIsEnumerable(e)},t._enumerableAndNotEnumerable=function(t,e){return!0},t._getPropertyNames=function(t,n,r,o){var i=[];do{if(n)for(var c=Object.getOwnPropertyNames(t),u=function(n){var r=e.find(i,function(t){return t.name===n});if(!r&&o(t,n)){var c=Object.getOwnPropertyDescriptor(t,n);i.push({name:n,desc:c})}},a=0,s=c;a<s.length;a++){var p=s[a];u(p)}if(!r)break;n=!0}while(t=Object.getPrototypeOf(t));return i},t}(),p=function(){function t(){}return t}();p.IMATCH_ID_VALUE="438A51D3-6864-49D7-A655-CA1153B86965",p.IMATCH_ID_NAME="___id",p.IMATCH_MATCHES_NAME="___matches",p.IPROXY_ID_VALUE="BCDF5CE5-F0DF-40B7-8BA0-69DF395033C8",p.IPROXY_ID_NAME="___id";var l,f=function(){function t(){}return t.isMatcher=function(t){return!e.isNil(t)&&!e.isUndefined(t[p.IMATCH_MATCHES_NAME])&&!e.isUndefined(t[p.IMATCH_ID_NAME])&&t[p.IMATCH_ID_NAME]===p.IMATCH_ID_VALUE},t}(),h=function(){function t(){}return t.functionName=function(t){var e;if(t.name)e=t.name;else{var n=t.toString();n=n.substr("function ".length),e=n.substr(0,n.indexOf("("))}return e},t.objectName=function(e){var n=t.functionName(e.constructor);return n},t.argsName=function(t){var r=Array.prototype.slice.call(t),o=r.map(function(t){var e="";return e=f.isMatcher(t)?t.toString():n.stringify(t)}),i=e.join(o);return i},t.conthunktor=function(t,e){var n=new(t.bind.apply(t,[void 0].concat(e)));return n},t.clone=function(t,e){for(var n=s.getOwnAndPrototypeEnumerablesAndNonenumerables(e),r=0,o=n;r<o.length;r++){var i=o[r];Object.defineProperty(t,i.name,i.desc)}},t}(),y=function(){function t(t){this._ctor=t,this.___id=p.IMATCH_ID_VALUE}return t.prototype.___matches=function(t){var e=!1;return t&&t.constructor.prototype==this._ctor.prototype&&(e=!0),e},t.prototype.toString=function(){var t="It.isAnyObject("+h.functionName(this._ctor)+")";return t},t}(),_=function(){function t(){this.___id=p.IMATCH_ID_VALUE}return t.prototype.___matches=function(t){var e=!0;return e},t.prototype.toString=function(){return"It.isAny()"},t}(),v=function(){function t(){this.___id=p.IMATCH_ID_VALUE}return t.prototype.___matches=function(t){var n=!1;return e.isString(t)&&(n=!0),n},t.prototype.toString=function(){return"It.isAnyString()"},t}(),d=function(){function t(){this.___id=p.IMATCH_ID_VALUE}return t.prototype.___matches=function(t){var n=!1;return e.isNumber(t)&&(n=!0),n},t.prototype.toString=function(){return"It.isAnyNumber()"},t}(),m=function(){function t(t){this._pred=t,this.___id=p.IMATCH_ID_VALUE}return t.prototype.___matches=function(t){var e=!1;return t&&this._pred(t)&&(e=!0),e},t.prototype.toString=function(){var t="It.is("+this._pred+")";return t},t}(),b=function(){function t(t){this.___id=p.IMATCH_ID_VALUE,this._value=e.cloneDeep(t)}return t.prototype.___matches=function(t){var n=!1;return e.isEqual(this._value,t)&&(n=!0),n},t.prototype.toString=function(){var t=h.argsName([this._value]),e="It.isValue("+t+")";return e},t}(),g=function(){function t(t){this.___id=p.IMATCH_ID_VALUE,this._value=e.cloneDeep(t)}return t.prototype.___matches=function(t){var n=!1,r=e.pick(t,e.keys(this._value));return e.isEqual(this._value,r)&&(n=!0),n},t.prototype.toString=function(){var t=h.argsName([this._value]),e="It.isObjectWith("+t+")";return e},t}();!function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.PROPERTY=1]="PROPERTY",t[t.FUNCTION=2]="FUNCTION"}(l||(l={}));var C;!function(t){t[t.STATIC=0]="STATIC",t[t.DYNAMIC=1]="DYNAMIC"}(C||(C={}));var O,I=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();!function(t){t[t.NONE=0]="NONE",t[t.SETUP=1]="SETUP",t[t.EXECUTE=2]="EXECUTE"}(O||(O={}));var w,P=function(){function t(t,e){this.proxyType=t,this.callType=e,this.invocationType=O.NONE}return Object.defineProperty(t.prototype,"isAnUnknownDynamicCallAtExecution",{get:function(){return this.proxyType==C.DYNAMIC&&this.callType==l.UNKNOWN&&this.invocationType==O.EXECUTE},enumerable:!0,configurable:!0}),t}(),x=function(t){function n(n,r,o,i,c){void 0===i&&(i=C.STATIC),void 0===c&&(c=l.FUNCTION);var u=t.call(this,i,c)||this;return u._that=n,u._property=r,o&&(u._args=e.cloneDeep(o),u._args.length=o.length,u._args.callee=o.callee),u}return I(n,t),Object.defineProperty(n.prototype,"args",{get:function(){return this._args||{length:0,callee:null}},set:function(t){this._args=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"property",{get:function(){return this._property},enumerable:!0,configurable:!0}),n.prototype.invokeBase=function(){var t={};this._that?h.clone(t,this._that):t=this._property.obj,this.returnValue=this._property.toFunc.apply(t,this._args)},n.prototype.toString=function(){var t=this.property+"("+h.argsName(this.args)+")";return t},n}(P),A=function(t){function n(n,r,o,i){void 0===o&&(o=C.STATIC),void 0===i&&(i=l.PROPERTY);var c=t.call(this,o,i)||this;return c._property=n,c.value=r,c.returnValue=e.cloneDeep(r),c}return I(n,t),Object.defineProperty(n.prototype,"args",{get:function(){var t=[];return Object.defineProperty(t,"callee",{configurable:!0,enumerable:!0,writable:!1,value:null}),t},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"property",{get:function(){return this._property},enumerable:!0,configurable:!0}),n.prototype.invokeBase=function(){this.returnValue=this._property.obj[this._property.name]},n.prototype.toString=function(){var t=""+this.property;return t},n}(P),N=function(t){function n(n,r){var o=t.call(this,n,r,C.DYNAMIC,l.UNKNOWN)||this;return o.returnValue=e.cloneDeep(r),o}return I(n,t),n}(A),E=function(t){function n(n,r,o,i){void 0===o&&(o=C.STATIC),void 0===i&&(i=l.PROPERTY);var c=t.call(this,o,i)||this;return c._property=n,c._args=e.cloneDeep(r),c._args.length=r.length,c._args.callee=r.callee,c}return I(n,t),Object.defineProperty(n.prototype,"args",{get:function(){return this._args},set:function(t){this._args=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"property",{get:function(){return this._property},enumerable:!0,configurable:!0}),n.prototype.invokeBase=function(){this._property.obj[this._property.name]=this._args[0],this.returnValue=this._property.obj[this._property.name]},n.prototype.toString=function(){var t=this.property+" = "+h.argsName(this.args[0]);return t},n}(P),T=function(t){function e(e,n,r,o){void 0===r&&(r=C.STATIC),void 0===o&&(o=l.FUNCTION);var i=t.call(this,r,o)||this;return i._property=e,i._getter=n,i}return I(e,t),Object.defineProperty(e.prototype,"args",{get:function(){var t=[];return Object.defineProperty(t,"callee",{configurable:!0,enumerable:!0,writable:!1,value:null}),t},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"property",{get:function(){return this._property},enumerable:!0,configurable:!0}),e.prototype.invokeBase=function(){this.returnValue=this._property.obj[this._property.name]},e.prototype.toString=function(){var t=""+this.property;return t},e}(P),j=function(t){function n(n,r,o,i,c){void 0===i&&(i=C.STATIC),void 0===c&&(c=l.FUNCTION);var u=t.call(this,i,c)||this;return u._property=n,u._setter=r,u._args=e.cloneDeep(o),u._args.length=o.length,u._args.callee=o.callee,u}return I(n,t),Object.defineProperty(n.prototype,"args",{get:function(){return this._args},set:function(t){this._args=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"property",{get:function(){return this._property},enumerable:!0,configurable:!0}),n.prototype.invokeBase=function(){this._property.obj[this._property.name]=this._args[0],this.returnValue=this._property.obj[this._property.name]},n.prototype.toString=function(){var t=this.property+"("+h.argsName(this.args[0])+")";return t},n}(P),k=function(){function t(t,n,r){this.obj=t,this.name=n,r&&(this.desc=e.cloneDeep(r))}return Object.defineProperty(t.prototype,"toFunc",{get:function(){var t;return t=e.isFunction(this.obj)?this.obj:this.obj[this.name]},enumerable:!0,configurable:!0}),t.prototype.toString=function(){var t=h.objectName(this.obj),e=t+"."+this.name;return e},t}(),S=function(){function t(t,n,r){this.obj=t,this.name=n,r&&(this.desc=e.cloneDeep(r))}return t.prototype.toString=function(){var t=h.objectName(this.obj),e=t+"."+this.name;return e},t}(),M=function(){function t(t,n){var r=this;this.___id=p.IPROXY_ID_VALUE,this.check(t);var o=this,i=s.getOwnAndPrototypeEnumerablesAndNonenumerables(t);e.each(i,function(i){if(e.isFunction(i.desc.value)){var c={configurable:i.desc.configurable,enumerable:i.desc.enumerable,writable:i.desc.writable};r.defineMethodProxy(o,n,t,i.name,c)}else{var c={configurable:i.desc.configurable,enumerable:i.desc.enumerable};void 0!==i.desc.value?r.defineValuePropertyProxy(o,n,t,i.name,i.desc.value,c):r.defineGetSetPropertyProxy(o,n,t,i.name,i.desc.get,i.desc.set,c)}})}return t.of=function(n,r){t.check(n);var o;if(e.isFunction(n)){var i=h.functionName(n);o=t.methodProxyValue(void 0,r,n,i,null)}else o=new t(n,r);return o},t.isProxy=function(t){return e.isNil(t)||e.isUndefined(t[p.IPROXY_ID_NAME])||t[p.IPROXY_ID_NAME]!==p.IPROXY_ID_VALUE?!1:!0},t.check=function(n){t.checkNotNullOrUndefined(n);var o=!1;if((e.isFunction(n)||e.isObject(n)&&!t.isPrimitiveObject(n))&&(o=!0),!o)throw new u(r.InvalidArg,n,"'"+n+"'; proxy argument should be a function or a non primitive object")},t.prototype.check=function(n){t.checkNotNullOrUndefined(n);var o=!1;if(e.isFunction(n)||!e.isObject(n)||t.isPrimitiveObject(n)||(o=!0),!o)throw new u(r.InvalidArg,n,"'"+n+"'; proxy argument should be a non primitive object")},t.checkNotNullOrUndefined=function(t){if(e.isNil(t))throw new u(r.InvalidArg,t,"'"+t+"'; proxy argument is required")},t.isPrimitiveObject=function(t){var n=!1;return(e.isFunction(t)||e.isArray(t)||e.isDate(t)||e.isNull(t))&&(n=!0),n},t.prototype.defineMethodProxy=function(e,n,r,o,i){void 0===i&&(i={configurable:!0,enumerable:!0,writable:!1}),i.value=t.methodProxyValue(e,n,r,o,i),this.defineProperty(e,o,i)},t.methodProxyValue=function(t,e,n,r,o){function i(){var i=new k(n,r,o),c=new x(t,i,arguments);return e.intercept(c),c.returnValue}return i},t.prototype.defineValuePropertyProxy=function(t,e,n,r,o,i){function c(){var t=new S(n,r),i=new A(t,o);return e.intercept(i),i.returnValue}function u(t){var o=new S(n,r),i=new E(o,arguments);e.intercept(i)}void 0===i&&(i={configurable:!0,enumerable:!0}),i.get=c,i.set=u,this.defineProperty(t,r,i)},t.prototype.defineGetSetPropertyProxy=function(t,e,n,r,o,i,c){function u(){var t=new S(n,r),i=new T(t,o);return e.intercept(i),i.returnValue}function a(t){var o=new S(n,r),c=new j(o,i,arguments);e.intercept(c)}void 0===c&&(c={configurable:!0,enumerable:!0}),c.get=u,c.set=a,this.defineProperty(t,r,c)},t.prototype.defineProperty=function(t,e,n){try{Object.defineProperty(t,e,n)}catch(r){console.log(r.message)}},t}(),V=function(){function t(t,e){this.___id=p.IPROXY_ID_VALUE;var n=new Proxy(t,e);return n}return t.of=function(e,n){t.check();var r=new t(e,n);return r},t.check=function(){if("undefined"==typeof Proxy)throw new u(r.InvalidDynamicProxyRuntime,null,"ES6 Proxy object not detected; the dynamic mocking feature requires ES6 Proxy object support")},t}(),D=function(){function t(t){this._interceptor=t}return t.prototype.apply=function(t,e,n){var r=h.functionName(t),o=new k(t,r),i=new x(t,o,n,C.DYNAMIC);return this._interceptor.intercept(i),i.returnValue},t.prototype.get=function(t,n,r){var o=this,i=t[n],c=new S(t,n),u=new N(c,i);return this._interceptor.intercept(u),!e.isFunction(i)&&u.callType==l.PROPERTY&&u.property.desc?u.returnValue:function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];o._interceptor.removeInvocation(u);var i=new k(t,n),c=new x(t,i,e,C.DYNAMIC);return o._interceptor.intercept(c),c.returnValue}},t.prototype.set=function(t,e,n,r){var o=new S(t,e),i=new E(o,[n],C.DYNAMIC);return this._interceptor.intercept(i),Reflect.set(t,e,n,r)},t.prototype.defineProperty=function(t,e,n){return n.configurable=!0,Reflect.defineProperty(t,e,n)},t}(),U=function(){function t(){}return t.createProxy=function(t,e){var n=M.of(t,e);return n},t.createProxyES6=function(t,e){var n=new D(e),r=V.of(t,n);return r},t}(),L=function(){function n(e,n,r){void 0===r&&(r=t.MockBehavior.Loose),this.target=e,this.canOverrideTarget=n,this.behavior=r,this._id=this.generateId(),this._name=this.getNameOf(this.target)}return Object.defineProperty(n.prototype,"object",{get:function(){return this._proxy},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"callBase",{get:function(){return this._callBase},set:function(t){this._callBase=t},enumerable:!0,configurable:!0}),n.prototype.generateId=function(){return"Mock<"+e.uniqueId()+">"},n.prototype.getNameOf=function(t){var n;if(e.isFunction(t))n=h.functionName(t);else if(e.isObject(t)){var r=t.constructor;n=h.functionName(r)}return n&&(n=n.trim()),n},n.prototype.verifyAll=function(){try{this._interceptor.verify()}catch(t){throw t}},n.prototype.reset=function(){this._interceptor.reset()},n}();!function(t){t[t.Continue=0]="Continue",t[t.Stop=1]="Stop"}(w||(w={}));var F,B=function(){function t(t){this.mock=t,this._actualInvocations=[],this._expectedCalls=[]}return Object.defineProperty(t.prototype,"behavior",{get:function(){return this.mock.behavior},enumerable:!0,configurable:!0}),t.prototype.addInvocation=function(t){this._actualInvocations.push(t)},t.prototype.removeInvocation=function(t){e.remove(this._actualInvocations,function(e){return e===t})},t.prototype.actualInvocations=function(){return this._actualInvocations},t.prototype.clearInvocations=function(){this._actualInvocations.splice(0,this._actualInvocations.length)},t.prototype.addExpectedCall=function(t){this._expectedCalls.push(t)},t.prototype.removeExpectedCall=function(t){e.filter(this._expectedCalls,function(e){return e.id!==t.id})},t.prototype.expectedCalls=function(){return this._expectedCalls},t.prototype.clearExpectedCalls=function(){this._expectedCalls.splice(0,this._expectedCalls.length)},t.prototype.reset=function(){this.clearInvocations(),this.clearExpectedCalls()},t}(),R=function(){function t(){}return t}(),Y=function(){function t(){}return t.prototype.handleIntercept=function(t,e,n){return e.addInvocation(t),w.Continue},t}(),H=function(){function n(){}return n.prototype.handleIntercept=function(n,o,i){var c=o.expectedCalls().slice(),a=function(t){return t.matches(n)},s=e.filter(c,function(t){return a(t)});if(s.length>1&&(a=function(t){return!t.isInvoked&&t.matches(n)}),i.call=e.find(c,function(t){return a(t)}),null!=i.call){if(n.isAnUnknownDynamicCallAtExecution&&(n.callType=i.call.setupCall.callType,n.callType==l.FUNCTION))return w.Stop;i.call.evaluatedSuccessfully()}else if(o.behavior==t.MockBehavior.Strict)throw new u(r.NoSetup,n,"'"+n+"'");return w.Continue},n}(),q=function(){function t(){}return t.prototype.handleIntercept=function(t,e,n){this._ctx=e;var r=n.call;return null!=r?(r.execute(t),w.Stop):w.Continue},t}(),G=function(){function t(){}return t.prototype.handleIntercept=function(t,e,n){return e.mock.callBase?(t.invokeBase(),w.Stop):w.Continue},t}(),X=function(){function t(){}return t.prototype.handleIntercept=function(t,e,n){return w.Continue},t}(),W=function(){function n(t){this._interceptorContext=new B(t)}return Object.defineProperty(n.prototype,"interceptorContext",{get:function(){return this._interceptorContext},enumerable:!0,configurable:!0}),n.prototype.intercept=function(t){var n=this,r=new R;t.invocationType=O.EXECUTE,e.some(this.interceptionStrategies(),function(e){return w.Stop===e.handleIntercept(t,n.interceptorContext,r)?!0:void 0})},n.prototype.removeInvocation=function(t){this._interceptorContext.removeInvocation(t)},n.prototype.addExpectedCall=function(t){this._interceptorContext.addExpectedCall(t)},n.prototype.verify=function(){var n=this._interceptorContext.expectedCalls(),r=[];if(this._interceptorContext.behavior==t.MockBehavior.Strict)for(var o=0,i=n;o<i.length;o++){var c=i[o];c.isVerifiable||c.setVerifiable(),r.push(c)}else r=e.filter(n,function(t){return t.isVerifiable});for(var u=0,a=r;u<a.length;u++){var s=a[u];this.verifyCallCount(s,s.expectedCallCount)}var p=e.filter(n,function(t){return t.isInSequence});this.verifyCallsOrder(p)},n.prototype.verifyCallCount=function(t,n){var r=this._interceptorContext.expectedCalls(),o=this._interceptorContext.actualInvocations(),i=e.filter(o,function(e){return t.matches(e)}).length;n.verify(i)||this.throwVerifyCallCountException(t.setupCall,n,r,o)},n.prototype.throwVerifyCallCountException=function(t,e,n,o){var i=e.failMessage(t),c=n.reduce(function(t,e){return t+" "+e+"\n"},""),a=o.reduce(function(t,e){return t+" "+e+"\n"},""),s=i+"\n Configured setups:\n"+c+"\n Performed invocations:\n"+a,p=new u(r.CallCountVerificationFailed,t,s);throw p},n.prototype.verifyCallsOrder=function(t){var e=this._interceptorContext.actualInvocations();this.checkCallOrderExpectations(t,e)},n.prototype.checkCallOrderExpectations=function(t,n){var r=function(r){for(var o=e.sum(r),i=0,c=0;c<r.length;c++)for(var u=t[c],a=r[c],s=1;a>=s;s++){var p=n[i++];if(!u.matches(p))return!1}return i===o},o=!1,i=function(e,n){if(!o)if(n===t.length)o=r(e);else for(var c=t[n].expectedCallCount.min;c<=t[n].expectedCallCount.max;c++)e[n]=c,i(e,n+1)};i([],0),o||this.throwVerifyCallOrderException()},n.prototype.throwVerifyCallOrderException=function(){var t=new u(r.CallOrderVerificationFailed,null);throw t},n.prototype.reset=function(){this._interceptorContext.reset()},n.prototype.interceptionStrategies=function(){var t=[new Y,new H,new q,new G,new X];return t},n}(),K=function(){function t(){}return Object.defineProperty(t.prototype,"interceptedCall",{get:function(){return this._interceptedCall},enumerable:!0,configurable:!0}),t.prototype.intercept=function(t){if(t.invocationType=O.SETUP,t.proxyType==C.DYNAMIC&&t.callType==l.UNKNOWN&&(t.callType=l.PROPERTY),this._interceptedCall)throw new u(r.MoreThanOneSetup,t,"'"+t+"'; setup should contain only one expression");this._interceptedCall=t},t.prototype.removeInvocation=function(t){this._interceptedCall&&this._interceptedCall===t&&(this._interceptedCall=void 0)},t}(),J=function(){function n(t,e,n,o){if(this.mock=t,this._setupExpression=e,this._callCount=0,this._id=this.generateId(),e(o),!n.interceptedCall)throw new u(r.InvalidSetup,this._setupExpression,"'"+this._setupExpression+"'");var i=n.interceptedCall,c=this.transformToMatchers(i.args);Object.defineProperty(c,"callee",{configurable:!0,enumerable:!0,writable:!1,value:i.args.callee}),i.args=c,this._setupCall=i}return n.ofStaticMock=function(t,e){var r=new K,o=U.createProxy(t.target,r),i=new n(t,e,r,o);return i},n.ofDynamicMock=function(t,e){var r=new K,o=U.createProxyES6(t.target,r),i=new n(t,e,r,o);return i},n.prototype.generateId=function(){return"MethodCall<"+e.uniqueId()+">"},n.prototype.transformToMatchers=function(t){var n=[];return e.each(t,function(t){if(e.isObject(t))if(f.isMatcher(t))n.push(t);else{var r=new m(function(n){return e.isEqual(n,t)});n.push(r)}else{var r=new b(t);n.push(r)}}),n},Object.defineProperty(n.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"setupExpression",{get:function(){return this._setupExpression},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"setupCall",{get:function(){return this._setupCall},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"isVerifiable",{get:function(){return this._isVerifiable},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"isInSequence",{get:function(){return this._expectedCallType===t.ExpectedCallType.InSequence},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"expectedCallCount",{get:function(){return this._expectedCallCount},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"isInvoked",{get:function(){return this._isInvoked},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"callCount",{get:function(){return this._callCount},enumerable:!0,configurable:!0}),n.prototype.setVerifiable=function(e,n){void 0===e&&(e=a.once()),void 0===n&&(n=t.ExpectedCallType.InAnyOrder),this._isVerifiable=!0,this._expectedCallCount=e,this._expectedCallType=n},n.prototype.evaluatedSuccessfully=function(){this._evaluatedSuccessfully=!0},n.prototype.matches=function(t){var n=!1;return this._setupCall.property&&t&&t.property&&this._setupCall.property.name===t.property.name&&this._setupCall.args.length>=t.args.length&&(n=!0,t.isAnUnknownDynamicCallAtExecution||e.each(this._setupCall.args,function(e,r){var o=e,i=t.args[r];n&&!o.___matches(i)&&(n=!1)})),n},n.prototype.execute=function(t){if(this._isInvoked=!0,null!=this._setupCallback&&this._setupCallback.apply(this,t.args),null!=this._thrownException)throw this._thrownException;this._callCount++},n.prototype.verifiable=function(t,e){this.setVerifiable(t,e)},n.prototype.toString=function(){var t=""+this.setupCall;return this.expectedCallCount&&(t=t+", "+this.expectedCallCount),t},n}(),z=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Q=function(t){function e(e,n,r,o){var i=t.call(this,e,n,r,o)||this;return i._overrideTarget=e.canOverrideTarget,i}return z(e,t),e.ofStaticMock=function(t,n){var r=new K,o=U.createProxy(t.target,r),i=new e(t,n,r,o);return i},e.ofDynamicMock=function(t,n){var r=new K,o=U.createProxyES6(t.target,r),i=new e(t,n,r,o);return i},e.prototype.execute=function(e){t.prototype.execute.call(this,e),this._callBase?e.invokeBase():this.hasReturnValue&&(e.returnValue=this._returnValueFunc.apply(this,e.args),e.property.desc={value:this.setupCall.property.desc&&this.setupCall.property.desc.value})},e.prototype.callback=function(t){return this._setupCallback=t,this},e.prototype["throws"]=function(t){return this._thrownException=t,this},e.prototype.returns=function(t){if(this._returnValueFunc=t,this.hasReturnValue=!0,this._overrideTarget){var e=this.mock.target,n=this.setupCall.property.name,r=this.setupCall.property.desc;r||this.setupCall.proxyType!=C.DYNAMIC?r&&(r.configurable=!0,r.enumerable=!0,r.value=this._returnValueFunc,Object.defineProperty(e,n,r)):(r={},r.configurable=!0,r.enumerable=!0,r.value=null,Object.defineProperty(e,n,r))}return this},e.prototype.callBase=function(){return this._callBase=!0,this},e}(J),Z=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),$=function(t){function n(e,n,r){var o=t.call(this,e,n,r)||this;return o._interceptor=new W(o),o._proxy=U.createProxy(e,o._interceptor),o}return Z(n,t),n.ofInstance=function(t,e){t=n.cloneDeep(t);var r=new n(t,!0,e);return r},n.ofGlobalInstance=function(t,e){var r=new n(t,!1,e);return r},n.ofType=function(t,e,r){var o=h.conthunktor(t,r),i=new n(o,!0,e);return i},n.cloneDeep=function(t){var n=t;if(!e.isFunction(t)){var r=function(t){return M.isProxy(t)?t:void 0};n=e.cloneDeepWith(t,r)}return n},n.prototype.setup=function(t){var e=Q.ofStaticMock(this,t);return this._interceptor.addExpectedCall(e),e},n.prototype.verify=function(t,e){var n=J.ofStaticMock(this,t);this._interceptor.addExpectedCall(n);try{this._interceptor.verifyCallCount(n,e)}catch(r){throw r}},n}(L),tt=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),et=function(t){function e(e,n,r,o){var i=t.call(this,e,r,o)||this;return n&&(i._name=n),i._interceptor=new W(i),i._proxy=U.createProxyES6(e,i._interceptor),i}return tt(e,t),e.ofType=function(t,n){var r=new e(function(){},t,!0,n);return r},e.prototype.setup=function(t){var e=Q.ofDynamicMock(this,t);return this._interceptor.addExpectedCall(e),e},e.prototype.verify=function(t,e){var n=J.ofDynamicMock(this,t);this._interceptor.addExpectedCall(n);try{this._interceptor.verifyCallCount(n,e)}catch(r){throw r}},e}(L),nt=function(){function e(){}return e.ofInstance=function(e,n){void 0===n&&(n=t.MockBehavior.Loose);var r=$.ofInstance(e,n);return r},e.ofType=function(n,r){void 0===r&&(r=t.MockBehavior.Loose);for(var o=[],i=2;i<arguments.length;i++)o[i-2]=arguments[i];var c;return c=n?e.ofType2(n,o,r):et.ofType(void 0,r)},e.ofType2=function(e,n,r){void 0===r&&(r=t.MockBehavior.Loose);var o=$.ofType(e,r,n);return o},e}(),rt=function(){function t(){}return t.isValue=function(t){var e=new b(t);return e},t.isObjectWith=function(t){var e=new g(t);return e},t.isAnyObject=function(t){var e=new y(t);return e},t.isAny=function(){var t=new _;return t},t.isAnyString=function(){var t=new v;return t},t.isAnyNumber=function(){var t=new d;return t},t.is=function(t){var e=new m(t);return e},t}();!function(t){t[t.Class=0]="Class",t[t.Function=1]="Function",t[t.Value=2]="Value"}(F||(F={}));var ot=function(){function t(t,e,n,r){this.mock=t,this._name=e,this._type=n,this.container=r,this._name||(this._name=t.name)}return Object.defineProperty(t.prototype,"object",{get:function(){return this.mock.object},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this._name||this.mock.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"behavior",{get:function(){return this.mock.behavior},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"callBase",{get:function(){return this.mock.callBase},set:function(t){this.mock.callBase=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"type",{get:function(){return this._type},enumerable:!0,configurable:!0}),t.prototype.setup=function(t){return this.mock.setup(t)},t.prototype.verify=function(t,e){this.mock.verify(t,e)},t.prototype.verifyAll=function(){this.mock.verifyAll()},t.prototype.reset=function(){this.mock.reset()},t}(),it=function(){function n(){}return n.ofInstance=function(n,r,o,i){void 0===o&&(o=window),void 0===i&&(i=t.MockBehavior.Loose);var c=$.ofGlobalInstance(n,i),u=e.isFunction(n)?F.Function:F.Value;return new ot(c,r,u,o)},n.ofType=function(e,n,r){void 0===n&&(n=window),void 0===r&&(r=t.MockBehavior.Loose);var o=new e,i=$.ofInstance(o,r);return new ot(i,void 0,F.Class,n)},n.ofType2=function(e,n,r){void 0===n&&(n=window),void 0===r&&(r=t.MockBehavior.Loose);var o=et.ofType(e,r);return new ot(o,void 0,F.Class,n)},n}(),ct=function(){function t(t){this._args=t}return t.prototype["with"]=function(t){var n={};try{e.each(this._args,function(t){var o=s.getOwnAndPrototypeEnumerablesAndNonenumerables(t.container),i=e.find(o,function(e){return e.name===t.name});if(i){n[t.name]=i.desc; | ||
var c={};switch(t.type){case F.Class:c.value=function(){return t.mock.object};break;case F.Function:c.value=t.mock.object;break;case F.Value:c.get=function(){return t.mock.object};break;default:throw new u(r.UnknownGlobalType,t,"unknown global type: "+t.type)}try{Object.defineProperty(t.container,t.name,c)}catch(a){console.log("1: "+a)}}}),t.apply(this,this._args)}catch(o){console.log("2: "+o)}finally{e.each(this._args,function(t){var e=n[t.name];if(e){switch(t.type){case F.Class:break;case F.Function:break;case F.Value:e.configurable=!0}try{Object.defineProperty(t.container,t.name,e)}catch(r){console.log("3: "+r)}}})}},t}(),ut=function(){function t(){}return t.using=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=new ct(t);return n},t}();t.Mock=nt,t.It=rt,t.Times=a,t.GlobalMock=it,t.GlobalScope=ut,t.MockException=u,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("lodash"),require("circular-json")):"function"==typeof define&&define.amd?define(["exports","lodash","circular-json"],e):e(t.TypeMoq=t.TypeMoq||{},t._,t.CircularJSON)}(this,function(t,e,n){!function(t){t[t.Loose=0]="Loose",t[t.Strict=1]="Strict"}(t.MockBehavior||(t.MockBehavior={})),function(t){t[t.InAnyOrder=0]="InAnyOrder",t[t.InSequence=1]="InSequence"}(t.ExpectedCallType||(t.ExpectedCallType={}));var r,o=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),i=function(t){function e(n,r){var o=t.call(this,r)||this;return o.name=n,Object.setPrototypeOf(o,e.prototype),o}return o(e,t),e.prototype.toString=function(){var t=this.message?this.name+" - "+this.message:this.name;return t},e}(Error),c=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();!function(t){t[t.NoSetup="no setup expression found for"]="NoSetup",t[t.MoreThanOneSetup="more than one setup expression found for"]="MoreThanOneSetup",t[t.InvalidArg="invalid argument"]="InvalidArg",t[t.InvalidSetup="invalid setup expression"]="InvalidSetup",t[t.InvalidMatcher="invalid matching expression"]="InvalidMatcher",t[t.UnknownGlobalType="unknown global type"]="UnknownGlobalType",t[t.CallCountVerificationFailed="invocation count verification failed"]="CallCountVerificationFailed",t[t.CallOrderVerificationFailed="invocation order verification failed"]="CallOrderVerificationFailed",t[t.InvalidDynamicProxyRuntime="invalid dynamic proxy runtime"]="InvalidDynamicProxyRuntime"}(r||(r={}));var u=function(t){function e(n,r,o){void 0===o&&(o=void 0);var i=t.call(this,"MockException",o)||this;return i.reason=n,i.ctx=r,i.message=o,Object.setPrototypeOf(i,e.prototype),i}return c(e,t),e.prototype.toString=function(){var t=this.name+" - "+this.reason;return this.message&&(t=t+" ("+this.message+")"),t},e}(i),a=function(){function t(t,n,r,o){this._condition=t,this.min=n,this.max=r,this._failMessage=e.template(o)}return t.prototype.failMessage=function(t){return this._failMessage({i:t,min:this.min,max:this.max,c:this._lastCallCount})},t.prototype.verify=function(t){return this._lastCallCount=t,this._condition(t)},t.checkArg=function(t,e){if(0>t)throw new u(r.InvalidArg,void 0,e+" argument cannot be a negative number")},t.exactly=function(e){return t.checkArg(e,"'Times.exactly'"),new t(function(t){return t===e},e,e,t.NO_MATCHING_CALLS_EXACTLY_N_TIMES)},t.atLeast=function(e){return t.checkArg(e,"'Times.atLeast'"),new t(function(t){return t>=e},e,255,t.NO_MATCHING_CALLS_AT_LEAST_N_TIMES)},t.atMost=function(e){return t.checkArg(e,"'Times.atMost'"),new t(function(t){return t>=0&&e>=t},0,e,t.NO_MATCHING_CALLS_AT_MOST_N_TIMES)},t.never=function(){return t.exactly(0)},t.once=function(){return t.exactly(1)},t.atLeastOnce=function(){return t.atLeast(1)},t.atMostOnce=function(){return t.atMost(1)},t.prototype.toString=function(){var t="";return t=this.min===this.max?0===this.min?"never":1===this.min?"once":this.min+" times":0===this.min&&255!==this.max?"at most "+this.max+" times":"at least "+this.min+" times"},t}();a.NO_MATCHING_CALLS_EXACTLY_N_TIMES="expected invocation of <%= i %> exactly <%= min %> times, invoked <%= c %> times",a.NO_MATCHING_CALLS_AT_LEAST_N_TIMES="expected invocation of <%= i %> at least <%= min %> times, invoked <%= c %> times",a.NO_MATCHING_CALLS_AT_MOST_N_TIMES="expected invocation of <%= i %> at most <%= max %> times, invoked <%= c %> times";var s=function(){function t(){}return t.getOwnEnumerables=function(t){return this._getPropertyNames(t,!0,!1,this._enumerable)},t.getOwnNonenumerables=function(t){return this._getPropertyNames(t,!0,!1,this._notEnumerable)},t.getOwnEnumerablesAndNonenumerables=function(t){return this._getPropertyNames(t,!0,!1,this._enumerableAndNotEnumerable)},t.getPrototypeEnumerables=function(t){return this._getPropertyNames(t,!1,!0,this._enumerable)},t.getPrototypeNonenumerables=function(t){return this._getPropertyNames(t,!1,!0,this._notEnumerable)},t.getPrototypeEnumerablesAndNonenumerables=function(t){return this._getPropertyNames(t,!1,!0,this._enumerableAndNotEnumerable)},t.getOwnAndPrototypeEnumerables=function(t){return this._getPropertyNames(t,!0,!0,this._enumerable)},t.getOwnAndPrototypeNonenumerables=function(t){return this._getPropertyNames(t,!0,!0,this._notEnumerable)},t.getOwnAndPrototypeEnumerablesAndNonenumerables=function(t){return this._getPropertyNames(t,!0,!0,this._enumerableAndNotEnumerable)},t._enumerable=function(t,e){return t.propertyIsEnumerable(e)},t._notEnumerable=function(t,e){return!t.propertyIsEnumerable(e)},t._enumerableAndNotEnumerable=function(t,e){return!0},t._getPropertyNames=function(t,n,r,o){var i=[];do{if(n)for(var c=Object.getOwnPropertyNames(t),u=function(n){var r=e.find(i,function(t){return t.name===n});if(!r&&o(t,n)){var c=Object.getOwnPropertyDescriptor(t,n);i.push({name:n,desc:c})}},a=0,s=c;a<s.length;a++){var p=s[a];u(p)}if(!r)break;n=!0}while(t=Object.getPrototypeOf(t));return i},t}(),p=function(){function t(){}return t}();p.IMATCH_ID_VALUE="438A51D3-6864-49D7-A655-CA1153B86965",p.IMATCH_ID_NAME="___id",p.IMATCH_MATCHES_NAME="___matches",p.IPROXY_ID_VALUE="BCDF5CE5-F0DF-40B7-8BA0-69DF395033C8",p.IPROXY_ID_NAME="___id";var l,f=function(){function t(){}return t.isMatcher=function(t){return!e.isNil(t)&&!e.isUndefined(t[p.IMATCH_MATCHES_NAME])&&!e.isUndefined(t[p.IMATCH_ID_NAME])&&t[p.IMATCH_ID_NAME]===p.IMATCH_ID_VALUE},t}(),h=function(){function t(){}return t.functionName=function(t){var e;if(t.name)e=t.name;else{var n=t.toString();n=n.substr("function ".length),e=n.substr(0,n.indexOf("("))}return e},t.objectName=function(e){var n=t.functionName(e.constructor);return n},t.argsName=function(t){var r=Array.prototype.slice.call(t),o=r.map(function(t){var e="";return e=f.isMatcher(t)?t.toString():n.stringify(t)}),i=e.join(o);return i},t.conthunktor=function(t,e){var n=new(t.bind.apply(t,[void 0].concat(e)));return n},t.clone=function(t,e){for(var n=s.getOwnAndPrototypeEnumerablesAndNonenumerables(e),r=0,o=n;r<o.length;r++){var i=o[r];Object.defineProperty(t,i.name,i.desc)}},t}(),y=function(){function t(t){this._ctor=t,this.___id=p.IMATCH_ID_VALUE}return t.prototype.___matches=function(t){var e=!1;return t&&t.constructor.prototype==this._ctor.prototype&&(e=!0),e},t.prototype.toString=function(){var t="It.isAnyObject("+h.functionName(this._ctor)+")";return t},t}(),_=function(){function t(){this.___id=p.IMATCH_ID_VALUE}return t.prototype.___matches=function(t){var e=!0;return e},t.prototype.toString=function(){return"It.isAny()"},t}(),v=function(){function t(){this.___id=p.IMATCH_ID_VALUE}return t.prototype.___matches=function(t){var n=!1;return e.isString(t)&&(n=!0),n},t.prototype.toString=function(){return"It.isAnyString()"},t}(),d=function(){function t(){this.___id=p.IMATCH_ID_VALUE}return t.prototype.___matches=function(t){var n=!1;return e.isNumber(t)&&(n=!0),n},t.prototype.toString=function(){return"It.isAnyNumber()"},t}(),m=function(){function t(t){this._pred=t,this.___id=p.IMATCH_ID_VALUE}return t.prototype.___matches=function(t){var e=!1;return t&&this._pred(t)&&(e=!0),e},t.prototype.toString=function(){var t="It.is("+this._pred+")";return t},t}(),b=function(){function t(t){this.___id=p.IMATCH_ID_VALUE,this._value=e.cloneDeep(t)}return t.prototype.___matches=function(t){var n=!1;return e.isEqual(this._value,t)&&(n=!0),n},t.prototype.toString=function(){var t=h.argsName([this._value]),e="It.isValue("+t+")";return e},t}(),g=function(){function t(t){this.___id=p.IMATCH_ID_VALUE,this._value=e.cloneDeep(t)}return t.prototype.___matches=function(t){var n=!1,r=e.pick(t,e.keys(this._value));return e.isEqual(this._value,r)&&(n=!0),n},t.prototype.toString=function(){var t=h.argsName([this._value]),e="It.isObjectWith("+t+")";return e},t}();!function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.PROPERTY=1]="PROPERTY",t[t.FUNCTION=2]="FUNCTION"}(l||(l={}));var C;!function(t){t[t.STATIC=0]="STATIC",t[t.DYNAMIC=1]="DYNAMIC"}(C||(C={}));var O,I=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();!function(t){t[t.NONE=0]="NONE",t[t.SETUP=1]="SETUP",t[t.EXECUTE=2]="EXECUTE"}(O||(O={}));var w,P=function(){function t(t,e){this.proxyType=t,this.callType=e,this.invocationType=O.NONE}return Object.defineProperty(t.prototype,"isAnUnknownDynamicCallAtExecution",{get:function(){return this.proxyType==C.DYNAMIC&&this.callType==l.UNKNOWN&&this.invocationType==O.EXECUTE},enumerable:!0,configurable:!0}),t}(),x=function(t){function n(n,r,o,i,c){void 0===i&&(i=C.STATIC),void 0===c&&(c=l.FUNCTION);var u=t.call(this,i,c)||this;return u._that=n,u._property=r,o&&(u._args=e.cloneDeep(o),u._args.length=o.length,u._args.callee=o.callee),u}return I(n,t),Object.defineProperty(n.prototype,"args",{get:function(){return this._args||{length:0,callee:null}},set:function(t){this._args=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"property",{get:function(){return this._property},enumerable:!0,configurable:!0}),n.prototype.invokeBase=function(){var t={};this._that?h.clone(t,this._that):t=this._property.obj,this.returnValue=this._property.toFunc.apply(t,this._args)},n.prototype.toString=function(){var t=this.property+"("+h.argsName(this.args)+")";return t},n}(P),A=function(t){function n(n,r,o,i){void 0===o&&(o=C.STATIC),void 0===i&&(i=l.PROPERTY);var c=t.call(this,o,i)||this;return c._property=n,c.value=r,c.returnValue=e.cloneDeep(r),c}return I(n,t),Object.defineProperty(n.prototype,"args",{get:function(){var t=[];return Object.defineProperty(t,"callee",{configurable:!0,enumerable:!0,writable:!1,value:null}),t},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"property",{get:function(){return this._property},enumerable:!0,configurable:!0}),n.prototype.invokeBase=function(){this.returnValue=this._property.obj[this._property.name]},n.prototype.toString=function(){var t=""+this.property;return t},n}(P),N=function(t){function n(n,r){var o=t.call(this,n,r,C.DYNAMIC,l.UNKNOWN)||this;return o.returnValue=e.cloneDeep(r),o}return I(n,t),n}(A),T=function(t){function n(n,r,o,i){void 0===o&&(o=C.STATIC),void 0===i&&(i=l.PROPERTY);var c=t.call(this,o,i)||this;return c._property=n,c._args=e.cloneDeep(r),c._args.length=r.length,c._args.callee=r.callee,c}return I(n,t),Object.defineProperty(n.prototype,"args",{get:function(){return this._args},set:function(t){this._args=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"property",{get:function(){return this._property},enumerable:!0,configurable:!0}),n.prototype.invokeBase=function(){this._property.obj[this._property.name]=this._args[0],this.returnValue=this._property.obj[this._property.name]},n.prototype.toString=function(){var t=this.property+" = "+h.argsName(this.args[0]);return t},n}(P),E=function(t){function e(e,n,r,o){void 0===r&&(r=C.STATIC),void 0===o&&(o=l.FUNCTION);var i=t.call(this,r,o)||this;return i._property=e,i._getter=n,i}return I(e,t),Object.defineProperty(e.prototype,"args",{get:function(){var t=[];return Object.defineProperty(t,"callee",{configurable:!0,enumerable:!0,writable:!1,value:null}),t},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"property",{get:function(){return this._property},enumerable:!0,configurable:!0}),e.prototype.invokeBase=function(){this.returnValue=this._property.obj[this._property.name]},e.prototype.toString=function(){var t=""+this.property;return t},e}(P),j=function(t){function n(n,r,o,i,c){void 0===i&&(i=C.STATIC),void 0===c&&(c=l.FUNCTION);var u=t.call(this,i,c)||this;return u._property=n,u._setter=r,u._args=e.cloneDeep(o),u._args.length=o.length,u._args.callee=o.callee,u}return I(n,t),Object.defineProperty(n.prototype,"args",{get:function(){return this._args},set:function(t){this._args=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"property",{get:function(){return this._property},enumerable:!0,configurable:!0}),n.prototype.invokeBase=function(){this._property.obj[this._property.name]=this._args[0],this.returnValue=this._property.obj[this._property.name]},n.prototype.toString=function(){var t=this.property+"("+h.argsName(this.args[0])+")";return t},n}(P),M=function(){function t(t,n,r){this.obj=t,this.name=n,r&&(this.desc=e.cloneDeep(r))}return Object.defineProperty(t.prototype,"toFunc",{get:function(){var t;return t=e.isFunction(this.obj)?this.obj:this.obj[this.name]},enumerable:!0,configurable:!0}),t.prototype.toString=function(){var t=h.objectName(this.obj),e=t+"."+this.name;return e},t}(),k=function(){function t(t,n,r){this.obj=t,this.name=n,r&&(this.desc=e.cloneDeep(r))}return t.prototype.toString=function(){var t=h.objectName(this.obj),e=t+"."+this.name;return e},t}(),S=function(){function t(t,n){var r=this;this.___id=p.IPROXY_ID_VALUE,this.check(t);var o=this,i=s.getOwnAndPrototypeEnumerablesAndNonenumerables(t);e.each(i,function(i){if(e.isFunction(i.desc.value)){var c={configurable:i.desc.configurable,enumerable:i.desc.enumerable,writable:i.desc.writable};r.defineMethodProxy(o,n,t,i.name,c)}else{var c={configurable:i.desc.configurable,enumerable:i.desc.enumerable};void 0!==i.desc.value?r.defineValuePropertyProxy(o,n,t,i.name,i.desc.value,c):r.defineGetSetPropertyProxy(o,n,t,i.name,i.desc.get,i.desc.set,c)}})}return t.of=function(n,r){t.check(n);var o;if(e.isFunction(n)){var i=h.functionName(n);o=t.methodProxyValue(void 0,r,n,i,null)}else o=new t(n,r);return o},t.isProxy=function(t){return e.isNil(t)||e.isUndefined(t[p.IPROXY_ID_NAME])||t[p.IPROXY_ID_NAME]!==p.IPROXY_ID_VALUE?!1:!0},t.check=function(n){t.checkNotNullOrUndefined(n);var o=!1;if((e.isFunction(n)||e.isObject(n)&&!t.isPrimitiveObject(n))&&(o=!0),!o)throw new u(r.InvalidArg,n,"'"+n+"'; proxy argument should be a function or a non primitive object")},t.prototype.check=function(n){t.checkNotNullOrUndefined(n);var o=!1;if(e.isFunction(n)||!e.isObject(n)||t.isPrimitiveObject(n)||(o=!0),!o)throw new u(r.InvalidArg,n,"'"+n+"'; proxy argument should be a non primitive object")},t.checkNotNullOrUndefined=function(t){if(e.isNil(t))throw new u(r.InvalidArg,t,"'"+t+"'; proxy argument is required")},t.isPrimitiveObject=function(t){var n=!1;return(e.isFunction(t)||e.isArray(t)||e.isDate(t)||e.isNull(t))&&(n=!0),n},t.prototype.defineMethodProxy=function(e,n,r,o,i){void 0===i&&(i={configurable:!0,enumerable:!0,writable:!1}),i.value=t.methodProxyValue(e,n,r,o,i),this.defineProperty(e,o,i)},t.methodProxyValue=function(t,e,n,r,o){function i(){var i=new M(n,r,o),c=new x(t,i,arguments);return e.intercept(c),c.returnValue}return i},t.prototype.defineValuePropertyProxy=function(t,e,n,r,o,i){function c(){var t=new k(n,r),i=new A(t,o);return e.intercept(i),i.returnValue}function u(t){var o=new k(n,r),i=new T(o,arguments);e.intercept(i)}void 0===i&&(i={configurable:!0,enumerable:!0}),i.get=c,i.set=u,this.defineProperty(t,r,i)},t.prototype.defineGetSetPropertyProxy=function(t,e,n,r,o,i,c){function u(){var t=new k(n,r),i=new E(t,o);return e.intercept(i),i.returnValue}function a(t){var o=new k(n,r),c=new j(o,i,arguments);e.intercept(c)}void 0===c&&(c={configurable:!0,enumerable:!0}),c.get=u,c.set=a,this.defineProperty(t,r,c)},t.prototype.defineProperty=function(t,e,n){try{Object.defineProperty(t,e,n)}catch(r){console.log(r.message)}},t}(),V=function(){function t(t,e){this.___id=p.IPROXY_ID_VALUE;var n=new Proxy(t,e);return n}return t.of=function(e,n){t.check();var r=new t(e,n);return r},t.check=function(){if("undefined"==typeof Proxy)throw new u(r.InvalidDynamicProxyRuntime,null,"ES6 Proxy object not detected; the dynamic mocking feature requires ES6 Proxy object support")},t}(),D=function(){function t(t){this._interceptor=t}return t.prototype.apply=function(t,e,n){var r=h.functionName(t),o=new M(t,r),i=new x(t,o,n,C.DYNAMIC);return this._interceptor.intercept(i),i.returnValue},t.prototype.get=function(t,n,r){var o=this,i=t[n],c=new k(t,n),u=new N(c,i);return this._interceptor.intercept(u),!e.isFunction(i)&&u.callType==l.PROPERTY&&u.property.desc?u.returnValue:function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];o._interceptor.removeInvocation(u);var i=new M(t,n),c=new x(t,i,e,C.DYNAMIC);return o._interceptor.intercept(c),c.returnValue}},t.prototype.set=function(t,e,n,r){var o=new k(t,e),i=new T(o,[n],C.DYNAMIC);return this._interceptor.intercept(i),Reflect.set(t,e,n,r)},t.prototype.defineProperty=function(t,e,n){return n.configurable=!0,Reflect.defineProperty(t,e,n)},t}(),U=function(){function t(){}return t.createProxy=function(t,e){var n=S.of(t,e);return n},t.createProxyES6=function(t,e){var n=new D(e),r=V.of(t,n);return r},t}(),L=function(){function n(e,n,r){void 0===r&&(r=t.MockBehavior.Loose),this.target=e,this.canOverrideTarget=n,this.behavior=r,this._id=this.generateId(),this._name=this.getNameOf(this.target)}return Object.defineProperty(n.prototype,"object",{get:function(){return this._proxy},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"callBase",{get:function(){return this._callBase},set:function(t){this._callBase=t},enumerable:!0,configurable:!0}),n.prototype.generateId=function(){return"Mock<"+e.uniqueId()+">"},n.prototype.getNameOf=function(t){var n;if(e.isFunction(t))n=h.functionName(t);else if(e.isObject(t)){var r=t.constructor;n=h.functionName(r)}return n&&(n=n.trim()),n},n.prototype.verifyAll=function(){try{this._interceptor.verify()}catch(t){throw t}},n.prototype.reset=function(){this._interceptor.reset()},n}();!function(t){t[t.Continue=0]="Continue",t[t.Stop=1]="Stop"}(w||(w={}));var F,B=function(){function t(t){this.mock=t,this._actualInvocations=[],this._expectedCalls=[]}return Object.defineProperty(t.prototype,"behavior",{get:function(){return this.mock.behavior},enumerable:!0,configurable:!0}),t.prototype.addInvocation=function(t){this._actualInvocations.push(t)},t.prototype.removeInvocation=function(t){e.remove(this._actualInvocations,function(e){return e===t})},t.prototype.actualInvocations=function(){return this._actualInvocations},t.prototype.clearInvocations=function(){this._actualInvocations.splice(0,this._actualInvocations.length)},t.prototype.addExpectedCall=function(t){this._expectedCalls.push(t)},t.prototype.removeExpectedCall=function(t){e.filter(this._expectedCalls,function(e){return e.id!==t.id})},t.prototype.expectedCalls=function(){return this._expectedCalls},t.prototype.clearExpectedCalls=function(){this._expectedCalls.splice(0,this._expectedCalls.length)},t.prototype.reset=function(){this.clearInvocations(),this.clearExpectedCalls()},t}(),R=function(){function t(){}return t}(),Y=function(){function t(){}return t.prototype.handleIntercept=function(t,e,n){return e.addInvocation(t),w.Continue},t}(),H=function(){function n(){}return n.prototype.handleIntercept=function(n,o,i){var c=o.expectedCalls().slice(),a=function(t){return t.matches(n)},s=e.filter(c,function(t){return a(t)});if(s.length>1&&(a=function(t){return!t.isInvoked&&t.matches(n)}),i.call=e.find(c,function(t){return a(t)}),null!=i.call){if(n.isAnUnknownDynamicCallAtExecution&&(n.callType=i.call.setupCall.callType,n.callType==l.FUNCTION))return w.Stop;i.call.evaluatedSuccessfully()}else if(o.behavior==t.MockBehavior.Strict)throw new u(r.NoSetup,n,"'"+n+"'");return w.Continue},n}(),q=function(){function t(){}return t.prototype.handleIntercept=function(t,e,n){this._ctx=e;var r=n.call;return null!=r?(r.execute(t),w.Stop):w.Continue},t}(),G=function(){function t(){}return t.prototype.handleIntercept=function(t,e,n){return e.mock.callBase?(t.invokeBase(),w.Stop):w.Continue},t}(),X=function(){function t(){}return t.prototype.handleIntercept=function(t,e,n){return w.Continue},t}(),W=function(){function n(t){this._interceptorContext=new B(t)}return Object.defineProperty(n.prototype,"interceptorContext",{get:function(){return this._interceptorContext},enumerable:!0,configurable:!0}),n.prototype.intercept=function(t){var n=this,r=new R;t.invocationType=O.EXECUTE,e.some(this.interceptionStrategies(),function(e){return w.Stop===e.handleIntercept(t,n.interceptorContext,r)?!0:void 0})},n.prototype.removeInvocation=function(t){this._interceptorContext.removeInvocation(t)},n.prototype.addExpectedCall=function(t){this._interceptorContext.addExpectedCall(t)},n.prototype.verify=function(){var n=this._interceptorContext.expectedCalls(),r=[];if(this._interceptorContext.behavior==t.MockBehavior.Strict)for(var o=0,i=n;o<i.length;o++){var c=i[o];c.isVerifiable||c.setVerifiable(),r.push(c)}else r=e.filter(n,function(t){return t.isVerifiable});for(var u=0,a=r;u<a.length;u++){var s=a[u];this.verifyCallCount(s,s.expectedCallCount)}var p=e.filter(n,function(t){return t.isInSequence});this.verifyCallsOrder(p)},n.prototype.verifyCallCount=function(t,n){var r=this._interceptorContext.expectedCalls(),o=this._interceptorContext.actualInvocations(),i=e.filter(o,function(e){return t.matches(e)}).length;n.verify(i)||this.throwVerifyCallCountException(t.setupCall,n,r,o)},n.prototype.throwVerifyCallCountException=function(t,e,n,o){var i=e.failMessage(t),c=n.reduce(function(t,e){return t+" "+e+"\n"},""),a=o.reduce(function(t,e){return t+" "+e+"\n"},""),s=i+"\n Configured setups:\n"+c+"\n Performed invocations:\n"+a,p=new u(r.CallCountVerificationFailed,t,s);throw p},n.prototype.verifyCallsOrder=function(t){var e=this._interceptorContext.actualInvocations();this.checkCallOrderExpectations(t,e)},n.prototype.checkCallOrderExpectations=function(t,n){var r=function(r){for(var o=e.sum(r),i=0,c=0;c<r.length;c++)for(var u=t[c],a=r[c],s=1;a>=s;s++){var p=n[i++];if(!u.matches(p))return!1}return i===o},o=!1,i=function(e,n){if(!o)if(n===t.length)o=r(e);else for(var c=t[n].expectedCallCount.min;c<=t[n].expectedCallCount.max;c++)e[n]=c,i(e,n+1)};i([],0),o||this.throwVerifyCallOrderException()},n.prototype.throwVerifyCallOrderException=function(){var t=new u(r.CallOrderVerificationFailed,null);throw t},n.prototype.reset=function(){this._interceptorContext.reset()},n.prototype.interceptionStrategies=function(){var t=[new Y,new H,new q,new G,new X];return t},n}(),K=function(){function t(){}return Object.defineProperty(t.prototype,"interceptedCall",{get:function(){return this._interceptedCall},enumerable:!0,configurable:!0}),t.prototype.intercept=function(t){if(t.invocationType=O.SETUP,t.proxyType==C.DYNAMIC&&t.callType==l.UNKNOWN&&(t.callType=l.PROPERTY),this._interceptedCall)throw new u(r.MoreThanOneSetup,t,"'"+t+"'; setup should contain only one expression");this._interceptedCall=t},t.prototype.removeInvocation=function(t){this._interceptedCall&&this._interceptedCall===t&&(this._interceptedCall=void 0)},t}(),J=function(){function n(t,e,n,o){if(this.mock=t,this._setupExpression=e,this._callCount=0,this._id=this.generateId(),e(o),!n.interceptedCall)throw new u(r.InvalidSetup,this._setupExpression,"'"+this._setupExpression+"'");var i=n.interceptedCall,c=this.transformToMatchers(i.args);Object.defineProperty(c,"callee",{configurable:!0,enumerable:!0,writable:!1,value:i.args.callee}),i.args=c,this._setupCall=i}return n.ofStaticMock=function(t,e){var r=new K,o=U.createProxy(t.target,r),i=new n(t,e,r,o);return i},n.ofDynamicMock=function(t,e){var r=new K,o=U.createProxyES6(t.target,r),i=new n(t,e,r,o);return i},n.prototype.generateId=function(){return"MethodCall<"+e.uniqueId()+">"},n.prototype.transformToMatchers=function(t){var n=[];return e.each(t,function(t){if(e.isObject(t))if(f.isMatcher(t))n.push(t);else{var r=new m(function(n){return e.isEqual(n,t)});n.push(r)}else{var r=new b(t);n.push(r)}}),n},Object.defineProperty(n.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"setupExpression",{get:function(){return this._setupExpression},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"setupCall",{get:function(){return this._setupCall},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"isVerifiable",{get:function(){return this._isVerifiable},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"isInSequence",{get:function(){return this._expectedCallType===t.ExpectedCallType.InSequence},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"expectedCallCount",{get:function(){return this._expectedCallCount},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"isInvoked",{get:function(){return this._isInvoked},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"callCount",{get:function(){return this._callCount},enumerable:!0,configurable:!0}),n.prototype.setVerifiable=function(e,n){void 0===e&&(e=a.once()),void 0===n&&(n=t.ExpectedCallType.InAnyOrder),this._isVerifiable=!0,this._expectedCallCount=e,this._expectedCallType=n},n.prototype.evaluatedSuccessfully=function(){this._evaluatedSuccessfully=!0},n.prototype.matches=function(t){var n=!1;return this._setupCall.property&&t&&t.property&&this._setupCall.property.name===t.property.name&&this._setupCall.args.length>=t.args.length&&(n=!0,t.isAnUnknownDynamicCallAtExecution||e.each(this._setupCall.args,function(e,r){var o=e,i=t.args[r];n&&!o.___matches(i)&&(n=!1)})),n},n.prototype.execute=function(t){if(this._isInvoked=!0,null!=this._setupCallback&&this._setupCallback.apply(this,t.args),null!=this._thrownException)throw this._thrownException;this._callCount++},n.prototype.verifiable=function(t,e){this.setVerifiable(t,e)},n.prototype.toString=function(){var t=""+this.setupCall;return this.expectedCallCount&&(t=t+", "+this.expectedCallCount),t},n}(),z=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Q=function(t){function e(e,n,r,o){var i=t.call(this,e,n,r,o)||this;return i._overrideTarget=e.canOverrideTarget,i}return z(e,t),e.ofStaticMock=function(t,n){var r=new K,o=U.createProxy(t.target,r),i=new e(t,n,r,o);return i},e.ofDynamicMock=function(t,n){var r=new K,o=U.createProxyES6(t.target,r),i=new e(t,n,r,o);return i},e.prototype.execute=function(e){t.prototype.execute.call(this,e),this._callBase?e.invokeBase():this.hasReturnValue&&(e.returnValue=this._returnValueFunc.apply(this,e.args),e.property.desc={value:this.setupCall.property.desc&&this.setupCall.property.desc.value})},e.prototype.callback=function(t){return this._setupCallback=t,this},e.prototype["throws"]=function(t){return this._thrownException=t,this},e.prototype.returns=function(t){if(this._returnValueFunc=t,this.hasReturnValue=!0,this._overrideTarget){var e=this.mock.target,n=this.setupCall.property.name,r=this.setupCall.property.desc;r||this.setupCall.proxyType!=C.DYNAMIC?r&&(r.configurable=!0,r.enumerable=!0,r.value=this._returnValueFunc,Object.defineProperty(e,n,r)):(r={},r.configurable=!0,r.enumerable=!0,r.value=null,Object.defineProperty(e,n,r))}return this},e.prototype.callBase=function(){return this._callBase=!0,this},e}(J),Z=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),$=function(t){function n(e,n,r){var o=t.call(this,e,n,r)||this;return o._interceptor=new W(o),o._proxy=U.createProxy(e,o._interceptor),o}return Z(n,t),n.ofInstance=function(t,e){t=n.cloneDeep(t);var r=new n(t,!0,e);return r},n.ofGlobalInstance=function(t,e){var r=new n(t,!1,e);return r},n.ofType=function(t,e,r){var o=h.conthunktor(t,r),i=new n(o,!0,e);return i},n.cloneDeep=function(t){var n=t;if(!e.isFunction(t)){var r=function(t){return S.isProxy(t)?t:void 0};n=e.cloneDeepWith(t,r)}return n},n.prototype.setup=function(t){var e=Q.ofStaticMock(this,t);return this._interceptor.addExpectedCall(e),e},n.prototype.verify=function(t,e){var n=J.ofStaticMock(this,t);this._interceptor.addExpectedCall(n);try{this._interceptor.verifyCallCount(n,e)}catch(r){throw r}},n}(L),tt=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),et=function(t){function e(e,n,r,o){var i=t.call(this,e,r,o)||this;return n&&(i._name=n),i._interceptor=new W(i),i._proxy=U.createProxyES6(e,i._interceptor),i}return tt(e,t),e.ofType=function(t,n){var r=new e(function(){},t,!0,n);return r},e.prototype.setup=function(t){var e=Q.ofDynamicMock(this,t);return this._interceptor.addExpectedCall(e),e},e.prototype.verify=function(t,e){var n=J.ofDynamicMock(this,t);this._interceptor.addExpectedCall(n);try{this._interceptor.verifyCallCount(n,e)}catch(r){throw r}},e}(L),nt=function(){function e(){}return e.ofInstance=function(e,n){void 0===n&&(n=t.MockBehavior.Loose);var r=$.ofInstance(e,n);return r},e.ofType=function(n,r){void 0===r&&(r=t.MockBehavior.Loose);for(var o=[],i=2;i<arguments.length;i++)o[i-2]=arguments[i];var c;return c=n?e.ofType2(n,o,r):et.ofType(void 0,r)},e.ofType2=function(e,n,r){void 0===r&&(r=t.MockBehavior.Loose);var o=$.ofType(e,r,n);return o},e}(),rt=function(){function t(){}return t.isValue=function(t){var e=new b(t);return e},t.isObjectWith=function(t){var e=new g(t);return e},t.isAnyObject=function(t){var e=new y(t);return e},t.isAny=function(){var t=new _;return t},t.isAnyString=function(){var t=new v;return t},t.isAnyNumber=function(){var t=new d;return t},t.is=function(t){var e=new m(t);return e},t}();!function(t){t[t.Class=0]="Class",t[t.Function=1]="Function",t[t.Value=2]="Value"}(F||(F={}));var ot=function(){function t(t,e,n,r){this.mock=t,this._name=e,this._type=n,this.container=r,this._name||(this._name=t.name)}return Object.defineProperty(t.prototype,"object",{get:function(){return this.mock.object},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this._name||this.mock.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"behavior",{get:function(){return this.mock.behavior},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"callBase",{get:function(){return this.mock.callBase},set:function(t){this.mock.callBase=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"type",{get:function(){return this._type},enumerable:!0,configurable:!0}),t.prototype.setup=function(t){return this.mock.setup(t)},t.prototype.verify=function(t,e){this.mock.verify(t,e)},t.prototype.verifyAll=function(){this.mock.verifyAll()},t.prototype.reset=function(){this.mock.reset()},t}(),it=function(){function n(){}return n.ofInstance=function(n,r,o,i){void 0===o&&(o=window),void 0===i&&(i=t.MockBehavior.Loose);var c=$.ofGlobalInstance(n,i),u=e.isFunction(n)?F.Function:F.Value;return new ot(c,r,u,o)},n.ofType=function(e,n,r){void 0===n&&(n=window),void 0===r&&(r=t.MockBehavior.Loose);var o=new e,i=$.ofInstance(o,r);return new ot(i,void 0,F.Class,n)},n.ofType2=function(e,n,r){void 0===n&&(n=window),void 0===r&&(r=t.MockBehavior.Loose);var o=et.ofType(e,r);return new ot(o,void 0,F.Class,n); | ||
},n}(),ct=function(){function t(t){this._args=t}return t.prototype["with"]=function(t){var n={};try{e.each(this._args,function(t){var o=s.getOwnAndPrototypeEnumerablesAndNonenumerables(t.container),i=e.find(o,function(e){return e.name===t.name});if(i){n[t.name]=i.desc;var c={};switch(t.type){case F.Class:c.value=function(){return t.mock.object};break;case F.Function:c.value=t.mock.object;break;case F.Value:c.get=function(){return t.mock.object};break;default:throw new u(r.UnknownGlobalType,t,"unknown global type: "+t.type)}try{Object.defineProperty(t.container,t.name,c)}catch(a){console.log("1: "+a)}}}),t.apply(this,this._args)}catch(o){console.log("2: "+o)}finally{e.each(this._args,function(t){var e=n[t.name];if(e){switch(t.type){case F.Class:break;case F.Function:break;case F.Value:e.configurable=!0}try{Object.defineProperty(t.container,t.name,e)}catch(r){console.log("3: "+r)}}})}},t}(),ut=function(){function t(){}return t.using=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=new ct(t);return n},t}();t.Mock=nt,t.It=rt,t.Times=a,t.GlobalMock=it,t.GlobalScope=ut,t.MockException=u,Object.defineProperty(t,"__esModule",{value:!0})}); |
@@ -74,2 +74,4 @@ // Generated by dts-bundle v0.7.2 | ||
static exactly(n: number): Times; | ||
static atLeast(n: number): Times; | ||
static atMost(n: number): Times; | ||
static never(): Times; | ||
@@ -363,3 +365,3 @@ static once(): Times; | ||
protected _callCount: number; | ||
protected _thrownException: all.Exception; | ||
protected _thrownException: Error; | ||
protected _evaluatedSuccessfully: boolean; | ||
@@ -582,6 +584,5 @@ protected constructor(mock: MockBase<T>, _setupExpression: all.IFunc2<T, TResult>, interceptor: InterceptorSetup<T>, proxy: T); | ||
declare module 'typemoq/Api/IThrows' { | ||
import * as error from "typemoq/Error/_all"; | ||
import { IVerifies } from "typemoq/Api/IVerifies"; | ||
export interface IThrows { | ||
throws<T extends error.Exception>(exception: T): IThrowsResult; | ||
throws<T extends Error>(exception: T): IThrowsResult; | ||
} | ||
@@ -588,0 +589,0 @@ export interface IThrowsResult extends IVerifies { |
{ | ||
"name": "typemoq", | ||
"version": "1.7.0", | ||
"version": "1.8.0", | ||
"description": "A simple mocking library for TypeScript", | ||
@@ -26,6 +26,7 @@ "author": "Florin Nitoi <florin.nitoi@gmail.com>", | ||
"spy", | ||
"TDD", | ||
"testing", | ||
"library", | ||
"sandbox", | ||
"typescript", | ||
"javascript" | ||
"typescript" | ||
], | ||
@@ -42,33 +43,33 @@ "scripts": { | ||
"devDependencies": { | ||
"@types/chai": "^3.4.34", | ||
"@types/chai": "3.4.34", | ||
"@types/circular-json": "^0.1.30", | ||
"@types/lodash": "^4.14.37", | ||
"@types/mocha": "^2.2.32", | ||
"@types/mocha": "2.2.32", | ||
"@types/node": "^6.0.45", | ||
"chai": "^3.5.0", | ||
"del": "^0.1.3", | ||
"dts-bundle": "^0.7.2", | ||
"gulp": "^3.6.0", | ||
"gulp-concat": "^2.4.3", | ||
"gulp-conventional-changelog": "^1.1.0", | ||
"gulp-load-plugins": "^0.5.0", | ||
"gulp-rename": "^1.2.0", | ||
"gulp-replace": "^0.5.4", | ||
"gulp-rollup": "^2.5.1", | ||
"gulp-size": "^0.3.0", | ||
"gulp-sourcemaps": "^2.2.0", | ||
"gulp-spawn-mocha": "^3.1.0", | ||
"gulp-typescript": "^3.1.1", | ||
"gulp-uglify": "^0.2.1", | ||
"karma": "^1.3.0", | ||
"karma-chai": "^0.1.0", | ||
"karma-chrome-launcher": "^0.1.7", | ||
"karma-firefox-launcher": "^0.1.4", | ||
"karma-ie-launcher": "^1.0.0", | ||
"karma-mocha": "^0.1.9", | ||
"karma-sauce-launcher": "^1.1.0", | ||
"merge2": "^1.0.2", | ||
"mocha": "^3.1.2", | ||
"run-sequence": "^1.0.2", | ||
"typescript": "^2.1.4" | ||
"chai": "3.5.0", | ||
"del": "0.1.3", | ||
"dts-bundle": "0.7.2", | ||
"gulp": "^3.9.1", | ||
"gulp-concat": "2.4.3", | ||
"gulp-conventional-changelog": "1.1.0", | ||
"gulp-load-plugins": "0.5.0", | ||
"gulp-rename": "1.2.0", | ||
"gulp-replace": "0.5.4", | ||
"gulp-rollup": "^2.13.0", | ||
"gulp-size": "0.3.0", | ||
"gulp-sourcemaps": "^2.6.0", | ||
"gulp-spawn-mocha": "3.1.0", | ||
"gulp-typescript": "^3.1.7", | ||
"gulp-uglify": "0.2.1", | ||
"karma": "1.3.0", | ||
"karma-chai": "0.1.0", | ||
"karma-chrome-launcher": "0.1.7", | ||
"karma-firefox-launcher": "0.1.4", | ||
"karma-ie-launcher": "1.0.0", | ||
"karma-mocha": "0.1.9", | ||
"karma-sauce-launcher": "1.1.0", | ||
"merge2": "1.0.2", | ||
"mocha": "3.1.2", | ||
"run-sequence": "1.0.2", | ||
"typescript": "^2.3.4" | ||
}, | ||
@@ -75,0 +76,0 @@ "engines": { |
217
README.md
@@ -151,16 +151,16 @@ TypeMoq [![build badge](https://travis-ci.org/florinn/typemoq.svg?branch=master)](https://travis-ci.org/florinn/typemoq) | ||
// Using class as constructor parameter | ||
let mock: TypeMoq.IMock<Bar> = TypeMoq.Mock.ofType(Bar); | ||
const mock: TypeMoq.IMock<Bar> = TypeMoq.Mock.ofType(Bar); | ||
// Using class as constructor parameter and casting result to interface | ||
let mock: TypeMoq.IMock<IBar> = TypeMoq.Mock.ofType(Bar); | ||
const mock: TypeMoq.IMock<IBar> = TypeMoq.Mock.ofType(Bar); | ||
// Using interface as type variable and class as constructor parameter | ||
let mock: TypeMoq.IMock<IBar> = TypeMoq.Mock.ofType<IBar>(Bar); | ||
const mock: TypeMoq.IMock<IBar> = TypeMoq.Mock.ofType<IBar>(Bar); | ||
// Using class as constructor parameter and constructor arguments | ||
let bar = new Bar(); | ||
let mock: TypeMoq.IMock<Foo> = TypeMoq.Mock.ofType(Foo, TypeMoq.MockBehavior.Loose, bar); | ||
const bar = new Bar(); | ||
const mock: TypeMoq.IMock<Foo> = TypeMoq.Mock.ofType(Foo, TypeMoq.MockBehavior.Loose, bar); | ||
// Using a generic class as constructor parameter and constructor arguments | ||
let mock: TypeMoq.IMock<GenericFoo<Bar>> = TypeMoq.Mock.ofType(GenericFoo, TypeMoq.MockBehavior.Loose, Bar, 999); | ||
const mock: TypeMoq.IMock<GenericFoo<Bar>> = TypeMoq.Mock.ofType(GenericFoo, TypeMoq.MockBehavior.Loose, Bar, 999); | ||
``` | ||
@@ -180,8 +180,8 @@ | ||
// From an existing object | ||
let bar = new Bar(); | ||
let mock: TypeMoq.IMock<Bar> = TypeMoq.Mock.ofInstance(bar); | ||
const bar = new Bar(); | ||
const mock: TypeMoq.IMock<Bar> = TypeMoq.Mock.ofInstance(bar); | ||
// Or from function objects | ||
let mock1: TypeMoq.IMock<() => string> = TypeMoq.Mock.ofInstance(someFunc); | ||
let mock2: TypeMoq.IMock<(a: any, b: any, c: any)=>string> = TypeMoq.Mock.ofInstance(someFuncWithArgs); | ||
const mock1: TypeMoq.IMock<() => string> = TypeMoq.Mock.ofInstance(someFunc); | ||
const mock2: TypeMoq.IMock<(a: any, b: any, c: any)=>string> = TypeMoq.Mock.ofInstance(someFuncWithArgs); | ||
``` | ||
@@ -201,3 +201,3 @@ | ||
// Using Function as type parameter | ||
let mock: TypeMoq.IMock<Function> = TypeMoq.Mock.ofType<Function>(); | ||
const mock: TypeMoq.IMock<Function> = TypeMoq.Mock.ofType<Function>(); | ||
``` | ||
@@ -209,6 +209,6 @@ | ||
// Using the 'instance' side of the class as type parameter | ||
let mock: TypeMoq.IMock<Bar> = TypeMoq.Mock.ofType<Bar>(); | ||
const mock: TypeMoq.IMock<Bar> = TypeMoq.Mock.ofType<Bar>(); | ||
// Specifying mock behavior | ||
let mock: TypeMoq.IMock<Foo> = TypeMoq.Mock.ofType<Foo>(undefined, TypeMoq.MockBehavior.Loose); | ||
const mock: TypeMoq.IMock<Foo> = TypeMoq.Mock.ofType<Foo>(undefined, TypeMoq.MockBehavior.Loose); | ||
``` | ||
@@ -220,3 +220,3 @@ | ||
// Using the 'static' side of the class as type parameter | ||
let mock: TypeMoq.IMock<typeof Bar> = TypeMoq.Mock.ofType<typeof Bar>(); | ||
const mock: TypeMoq.IMock<typeof Bar> = TypeMoq.Mock.ofType<typeof Bar>(); | ||
``` | ||
@@ -228,3 +228,3 @@ | ||
// Using an interface as type parameter | ||
let mock: TypeMoq.IMock<IBar> = TypeMoq.Mock.ofType<IBar>(); | ||
const mock: TypeMoq.IMock<IBar> = TypeMoq.Mock.ofType<IBar>(); | ||
``` | ||
@@ -247,3 +247,3 @@ | ||
let mock: TypeMoq.IMock<IThing> = TypeMoq.Mock.ofType<IThing>(); | ||
const mock: TypeMoq.IMock<IThing> = TypeMoq.Mock.ofType<IThing>(); | ||
@@ -264,3 +264,14 @@ expect(mock.object.getA("abc")).to.be.undefined; | ||
This limitation also impacts the scenario where a mocked object is passed to `Promise.resolve`. To be able to handle such scenario, the mocked object must be set as a thenable (i.e. has a "then" method) by returning `undefined` or another value: | ||
```typescript | ||
mock.setup((x: any) => x.then).returns(() => undefined); | ||
Promise.resolve(mock.object) | ||
.then(x => { | ||
expect(x).eql(mock.object); | ||
}); | ||
``` | ||
**Note:** | ||
@@ -288,3 +299,3 @@ A mock (created in any of the ways listed above) exposes the actual mock object through the `.object` property (that has the same type as the class or object being mocked). | ||
If no matcher is specified then an implicit matcher is considered that performs strict equality deep comparison, equivalent to `It.is(x => _.isEqual(x, a))`. | ||
If no matcher is specified then an implicit matcher is considered that performs strict equality deep comparison, equivalent to `TypeMoq.It.is(x => _.isEqual(x, a))`. | ||
@@ -295,7 +306,7 @@ ##### Matching functions | ||
// Match a no args function | ||
let mock: TypeMoq.IMock<() => string> = TypeMoq.Mock.ofInstance(someFunc); | ||
const mock: TypeMoq.IMock<() => string> = TypeMoq.Mock.ofInstance(someFunc); | ||
mock.setup(x => x()).returns(() => "At vero eos et accusamus"); | ||
// Match a function with args | ||
let mock: TypeMoq.IMock<(a: any, b: any, c: any) => string> = TypeMoq.Mock.ofInstance(someFuncWithArgs); | ||
const mock: TypeMoq.IMock<(a: any, b: any, c: any) => string> = TypeMoq.Mock.ofInstance(someFuncWithArgs); | ||
mock.setup(x => x(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => "At vero eos et accusamus"); | ||
@@ -315,3 +326,3 @@ ``` | ||
let mock = TypeMoq.Mock.ofType(Doer); | ||
const mock = TypeMoq.Mock.ofType(Doer); | ||
@@ -334,3 +345,3 @@ // Match a no args method | ||
// Match a method with object value params | ||
let bar = new Bar(); | ||
const bar = new Bar(); | ||
mock.setup(x => x.doObject(TypeMoq.It.isAnyObject(Bar))); | ||
@@ -350,13 +361,11 @@ | ||
// Match a method with any interface/class params | ||
let bar1 = new Bar(); | ||
let bar2 = new Bar(); | ||
mock.setup(x => x.doBar(TypeMoq.It.isAnyObject(Bar))); | ||
// Match a method by a param predicate | ||
let bar1 = new Bar(); | ||
const bar1 = new Bar(); | ||
bar1.value = "Ut enim ad minim veniam"; | ||
let bar2 = new Bar(); | ||
let mock = TypeMoq.Mock.ofType(Doer); | ||
const bar2 = new Bar(); | ||
const mock = TypeMoq.Mock.ofType(Doer); | ||
mock.setup(x => x.doBar(It.is((x: Bar) => x.value === "Ut enim ad minim veniam"))).returns(() => bar2); | ||
mock.setup(x => x.doBar(TypeMoq.It.is((x: Bar) => x.value === "Ut enim ad minim veniam"))).returns(() => bar2); | ||
``` | ||
@@ -381,4 +390,4 @@ | ||
let greeter = Greeter.instance(); | ||
let mock: TypeMoq.IMock<typeof Greeter> = Typemoq.Mock.ofType<typeof Greeter>(); | ||
const greeter = Greeter.instance(); | ||
const mock: TypeMoq.IMock<typeof Greeter> = TypeMoq.Mock.ofType<typeof Greeter>(); | ||
@@ -400,3 +409,3 @@ mock.setup(x => x.instance()).returns(() => greeter); | ||
// Match a property getter | ||
let mock = TypeMoq.Mock.ofType(FooWithPublicGetterAndSetter); | ||
const mock = TypeMoq.Mock.ofType(FooWithPublicGetterAndSetter); | ||
mock.setup(x => x.foo); | ||
@@ -406,3 +415,3 @@ | ||
mock.object.foo = "Lorem ipsum dolor sit amet"; | ||
mock.verify(x => x.foo = It.isValue("Lorem ipsum dolor sit amet"), Times.atLeastOnce()); | ||
mock.verify(x => x.foo = TypeMoq.It.isValue("Lorem ipsum dolor sit amet"), Times.atLeastOnce()); | ||
``` | ||
@@ -420,3 +429,3 @@ | ||
let mock = TypeMoq.Mock.ofType(Baz); | ||
const mock = TypeMoq.Mock.ofType(Baz); | ||
mock.setup(x => x.value); // OK | ||
@@ -439,11 +448,37 @@ mock.setup(x => x.anyValue); // throws MockException - invalid setup expression | ||
let mock = TypeMoq.Mock.ofType(FooWithObjectArgMethod); | ||
const mock = TypeMoq.Mock.ofType(FooWithObjectArgMethod); | ||
// Match object deeply | ||
mock.setup(x => x.foo(It.isValue({ bar: 'hello', jaz: 42 }))); | ||
mock.setup(x => x.foo(TypeMoq.It.isValue({ bar: 'hello', jaz: 42 }))); | ||
// Match object partially | ||
mock.setup(x => x.foo(It.isObjectWith({ jaz: 42 }))); | ||
mock.setup(x => x.foo(TypeMoq.It.isObjectWith({ jaz: 42 }))); | ||
``` | ||
**Note:** | ||
For the predicate based matcher, `TypeMoq.It.is<T>(predicate: IFunc2<T, boolean>)`, the argument of the predicate is a deep clone of the target argument, thus for doing object equality comparison, `===` should be replaced by `_.isEqual`. | ||
```typescript | ||
interface BeanParams { | ||
colour: string | ||
} | ||
interface Service { | ||
getBeans(params: BeanParams): string; | ||
} | ||
const service = TypeMoq.Mock.ofType<Service>(); | ||
const beanParams: BeanParams = { colour: 'red' }; | ||
// Wrong way of doing strict object comparison | ||
service.setup(x => x.getBeans(TypeMoq.It.is<BeanParams>(x => x === beanParams))).returns(() => 'success'); | ||
expect(service.object.getBeans(beanParams)).to.not.eq('success'); | ||
// Right way of doing strict object comparison | ||
service.setup(x => x.getBeans(TypeMoq.It.is<BeanParams>(x => _.isEqual(x, beanParams)))).returns(() => 'success'); | ||
service.setup(x => x.getBeans(beanParams)).returns(() => 'success'); // Short form equivalent to the explicit form above | ||
expect(service.object.getBeans(beanParams)).to.eq('success'); | ||
``` | ||
##### Attaching return callbacks | ||
@@ -471,3 +506,3 @@ | ||
```typescript | ||
let mock = TypeMoq.Mock.ofType(Doer); | ||
const mock = TypeMoq.Mock.ofType(Doer); | ||
let called1, called2 = false; | ||
@@ -487,3 +522,3 @@ let numberArg: number; | ||
```typescript | ||
let mock = TypeMoq.Mock.ofInstance(() => -1); | ||
const mock = TypeMoq.Mock.ofInstance(() => -1); | ||
@@ -501,3 +536,3 @@ // record | ||
```typescript | ||
let mock = TypeMoq.Mock.ofInstance(() => -1); | ||
const mock = TypeMoq.Mock.ofInstance(() => -1); | ||
@@ -534,3 +569,3 @@ // record | ||
```typescript | ||
let mock = TypeMoq.Mock.ofType(Doer, TypeMoq.MockBehavior.Strict); | ||
const mock = TypeMoq.Mock.ofType(Doer, TypeMoq.MockBehavior.Strict); | ||
``` | ||
@@ -557,6 +592,8 @@ | ||
```TypeMoq.Times.exactly(n: number)``` | Called exactly `n` times | ||
```TypeMoq.Times.never()``` | Never called | ||
```TypeMoq.Times.once()``` | Called once | ||
```TypeMoq.Times.never()``` | Never called | ||
```TypeMoq.Times.once()``` | Called once | ||
```TypeMoq.Times.atLeast(n: number)``` | Called at least `n` times | ||
```TypeMoq.Times.atMost(n: number)``` | Called at most `n` times | ||
```TypeMoq.Times.atLeastOnce()``` | Called at least once (default value) | ||
```TypeMoq.Times.atMostOnce()``` | Called at most once | ||
```TypeMoq.Times.atMostOnce()``` | Called at most once | ||
@@ -569,3 +606,3 @@ ##### Verify expectations one by one | ||
// Verify that a no args function was called at least once | ||
let mock: TypeMoq.IMock<() => string> = TypeMoq.Mock.ofInstance(someFunc); | ||
const mock: TypeMoq.IMock<() => string> = TypeMoq.Mock.ofInstance(someFunc); | ||
mock.object(); | ||
@@ -575,3 +612,3 @@ mock.verify(x => x(), TypeMoq.Times.atLeastOnce()); | ||
// Verify that a function with args was called at least once | ||
let mock: TypeMoq.IMock<(a: any, b: any, c: any) => string> = TypeMoq.Mock.ofInstance(someFuncWithArgs); | ||
const mock: TypeMoq.IMock<(a: any, b: any, c: any) => string> = TypeMoq.Mock.ofInstance(someFuncWithArgs); | ||
mock.object(1, 2, 3); | ||
@@ -581,3 +618,3 @@ mock.verify(x => x(TypeMoq.It.isAnyNumber(), TypeMoq.It.isAnyNumber(), TypeMoq.It.isAnyNumber()), TypeMoq.Times.atLeastOnce()); | ||
// Verify that no args method was called at least once | ||
let mock = TypeMoq.Mock.ofType(Doer); | ||
const mock = TypeMoq.Mock.ofType(Doer); | ||
mock.object.doVoid(); | ||
@@ -587,3 +624,3 @@ mock.verify(x => x.doVoid(), TypeMoq.Times.atLeastOnce()); | ||
// Verify that method with params was called at least once | ||
let mock = TypeMoq.Mock.ofType(Doer); | ||
const mock = TypeMoq.Mock.ofType(Doer); | ||
mock.object.doString("Lorem ipsum dolor sit amet"); | ||
@@ -593,3 +630,3 @@ mock.verify(x => x.doString(TypeMoq.It.isValue("Lorem ipsum dolor sit amet")), TypeMoq.Times.atLeastOnce()); | ||
// Verify that value getter was called at least once | ||
let mock = TypeMoq.Mock.ofType(Bar); | ||
const mock = TypeMoq.Mock.ofType(Bar); | ||
mock.object.value; | ||
@@ -599,3 +636,3 @@ mock.verify(x => x.value, TypeMoq.Times.atLeastOnce()); | ||
// Verify that value setter was called at least once | ||
let mock = TypeMoq.Mock.ofType(Bar); | ||
const mock = TypeMoq.Mock.ofType(Bar); | ||
mock.object.value = "Lorem ipsum dolor sit amet"; | ||
@@ -610,4 +647,4 @@ mock.verify(x => x.value = TypeMoq.It.isValue("Lorem ipsum dolor sit amet"), TypeMoq.Times.atLeastOnce()); | ||
```typescript | ||
let mockBar = TypeMoq.Mock.ofType(Bar); | ||
let mockFoo = TypeMoq.Mock.ofType(Foo, TypeMoq.MockBehavior.Loose, mockBar.object); | ||
const mockBar = TypeMoq.Mock.ofType(Bar); | ||
const mockFoo = TypeMoq.Mock.ofType(Foo, TypeMoq.MockBehavior.Loose, mockBar.object); | ||
mockFoo.callBase = true; | ||
@@ -637,9 +674,9 @@ | ||
let mock: TypeMoq.IMock<FooBar> = TypeMoq.Mock.ofType(FooBar); | ||
const mock: TypeMoq.IMock<FooBar> = TypeMoq.Mock.ofType(FooBar); | ||
mock.callBase = true; | ||
mock.object.register(); | ||
mock.object.registerLambda(); // inside a lambda function calls cannot be verified | ||
mock.object.registerLambda(); // Function calls cannot be verified inside a lambda | ||
mock.verify(x => x.canExecute(), Times.once()); | ||
mock.verify(x => x.canExecute(), TypeMoq.Times.once()); | ||
``` | ||
@@ -649,10 +686,10 @@ | ||
Instead of verifying one expectation at a time, you may specify the expectation at setup time by calling `verifiable(times: Times)` and then `verifyAll()` to check all expectations. | ||
Instead of verifying one expectation at a time, you may specify the expectation at setup time by calling `verifiable(times: TypeMoq.Times)` and then `verifyAll()` to check all expectations. | ||
The default value of the `times` parameter is equal to `Times.once()`. | ||
The default value of the `times` parameter is equal to `TypeMoq.Times.once()`. | ||
```typescript | ||
mock.setup(x => x.doNumber(999)).verifiable(); // Times.once() | ||
mock.setup(x => x.doString(It.isAny())).verifiable(Times.exactly(2)); | ||
mock.setup(x => x.doVoid()).verifiable(Times.atMostOnce()); | ||
mock.setup(x => x.doNumber(999)).verifiable(); // implicitly TypeMoq.Times.once() | ||
mock.setup(x => x.doString(TypeMoq.It.isAny())).verifiable(TypeMoq.Times.exactly(2)); | ||
mock.setup(x => x.doVoid()).verifiable(TypeMoq.Times.atMostOnce()); | ||
@@ -667,9 +704,9 @@ mock.object.doVoid(); | ||
When mock behavior is `MockBehavior.Strict`, every call to `.setup()` automatically calls `.verifiable()` behind the scenes, as the default. | ||
When mock behavior is `TypeMoq.MockBehavior.Strict`, every call to `.setup()` automatically calls `.verifiable()` behind the scenes, as the default. | ||
```typescript | ||
let mock = TypeMoq.Mock.ofType(Doer, TypeMoq.MockBehavior.Strict); | ||
const mock = TypeMoq.Mock.ofType(Doer, TypeMoq.MockBehavior.Strict); | ||
mock.setup(x => x.doNumber(999)); // Times.once() | ||
mock.setup(x => x.doVoid()).verifiable(Times.atMostOnce()); | ||
mock.setup(x => x.doNumber(999)); // implicitly TypeMoq.Times.once() | ||
mock.setup(x => x.doVoid()).verifiable(TypeMoq.Times.atMostOnce()); | ||
@@ -690,6 +727,6 @@ mock.object.doVoid(); | ||
```typescript | ||
let mock = Mock.ofInstance((x: number) => { }); | ||
const mock = TypeMoq.Mock.ofInstance((x: number) => { }); | ||
mock.setup(x => x(1)).verifiable(Times.once(), ExpectedCallType.InSequence); | ||
mock.setup(x => x(2)).verifiable(Times.once(), ExpectedCallType.InSequence); | ||
mock.setup(x => x(1)).verifiable(TypeMoq.Times.once(), TypeMoq.ExpectedCallType.InSequence); | ||
mock.setup(x => x(2)).verifiable(TypeMoq.Times.once(), TypeMoq.ExpectedCallType.InSequence); | ||
@@ -728,12 +765,12 @@ mock.object(2); | ||
// Create an instance using class as ctor parameter | ||
let mock: TypeMoq.IGlobalMock<GlobalBar> = TypeMoq.GlobalMock.ofType(GlobalBar, global); | ||
const mock: TypeMoq.IGlobalMock<GlobalBar> = TypeMoq.GlobalMock.ofType(GlobalBar, global); | ||
// Create an instance using class as ctor parameter and casting result to interface | ||
let mock: TypeMoq.IGlobalMock<IGlobalBar> = TypeMoq.GlobalMock.ofType(GlobalBar, global); | ||
const mock: TypeMoq.IGlobalMock<IGlobalBar> = TypeMoq.GlobalMock.ofType(GlobalBar, global); | ||
// Create an instance using interface as type variable and class as ctor parameter | ||
let mock: TypeMoq.IGlobalMock<IGlobalBar> = TypeMoq.GlobalMock.ofType<IGlobalBar>(GlobalBar, global); | ||
const mock: TypeMoq.IGlobalMock<IGlobalBar> = TypeMoq.GlobalMock.ofType<IGlobalBar>(GlobalBar, global); | ||
// Create an instance of 'XmlHttpRequest' global type | ||
let mock = TypeMoq.GlobalMock.ofType(XMLHttpRequest, global); | ||
const mock = TypeMoq.GlobalMock.ofType(XMLHttpRequest, global); | ||
``` | ||
@@ -747,20 +784,20 @@ | ||
// Create an instance using class as ctor parameter and ctor args | ||
let bar = new Bar(); | ||
let foo = new Foo(bar); | ||
let mock: TypeMoq.IGlobalMock<Foo> = TypeMoq.GlobalMock.ofInstance(foo); | ||
const bar = new Bar(); | ||
const foo = new Foo(bar); | ||
const mock: TypeMoq.IGlobalMock<Foo> = TypeMoq.GlobalMock.ofInstance(foo); | ||
// Create an instance using a generic class as ctor parameter and ctor args | ||
let foo = new GenericFoo(Bar); | ||
let mock: TypeMoq.IGlobalMock<GenericFoo<Bar>> = TypeMoq.GlobalMock.ofInstance(foo); | ||
const foo = new GenericFoo(Bar); | ||
const mock: TypeMoq.IGlobalMock<GenericFoo<Bar>> = TypeMoq.GlobalMock.ofInstance(foo); | ||
// Create an instance from an existing object | ||
let bar = new GlobalBar(); | ||
let mock: TypeMoq.IGlobalMock<GlobalBar> = TypeMoq.GlobalMock.ofInstance(bar); | ||
const bar = new GlobalBar(); | ||
const mock: TypeMoq.IGlobalMock<GlobalBar> = TypeMoq.GlobalMock.ofInstance(bar); | ||
// Create an instance from a function object | ||
let mock1: TypeMoq.IGlobalMock<() => string> = TypeMoq.GlobalMock.ofInstance(someGlobalFunc); | ||
let mock2: TypeMoq.IGlobalMock<(a: any, b: any, c: any) => string> = TypeMoq.GlobalMock.ofInstance(someGlobalFuncWithArgs); | ||
const mock1: TypeMoq.IGlobalMock<() => string> = TypeMoq.GlobalMock.ofInstance(someGlobalFunc); | ||
const mock2: TypeMoq.IGlobalMock<(a: any, b: any, c: any) => string> = TypeMoq.GlobalMock.ofInstance(someGlobalFuncWithArgs); | ||
// Create an instance from 'window.localStorage' global object | ||
let mock = TypeMoq.GlobalMock.ofInstance(localStorage, "localStorage"); | ||
const mock = TypeMoq.GlobalMock.ofInstance(localStorage, "localStorage"); | ||
``` | ||
@@ -777,9 +814,9 @@ | ||
// Create an instance using a class as type parameter | ||
let mock: TypeMoq.IGlobalMock<GlobalBar> = TypeMoq.GlobalMock.ofType2<GlobalBar>("GlobalBar", global); | ||
const mock: TypeMoq.IGlobalMock<GlobalBar> = TypeMoq.GlobalMock.ofType2<GlobalBar>("GlobalBar", global); | ||
// Create an instance using an interface as type parameter | ||
let mock: TypeMoq.IGlobalMock<IGlobalBar> = TypeMoq.GlobalMock.ofType2<IGlobalBar>("IGlobalBar", global); | ||
const mock: TypeMoq.IGlobalMock<IGlobalBar> = TypeMoq.GlobalMock.ofType2<IGlobalBar>("IGlobalBar", global); | ||
// Create an instance of 'XmlHttpRequest' global type | ||
let mock = TypeMoq.GlobalMock.ofType2<XMLHttpRequest>("XMLHttpRequest", global); | ||
const mock = TypeMoq.GlobalMock.ofType2<XMLHttpRequest>("XMLHttpRequest", global); | ||
``` | ||
@@ -805,3 +842,3 @@ | ||
// Global no args function is auto sandboxed | ||
let mock = TypeMoq.GlobalMock.ofInstance(someGlobalFunc); | ||
const mock = TypeMoq.GlobalMock.ofInstance(someGlobalFunc); | ||
TypeMoq.GlobalScope.using(mock).with(() => { | ||
@@ -813,3 +850,3 @@ someGlobalFunc(); | ||
// Global function with args is auto sandboxed | ||
let mock = TypeMoq.GlobalMock.ofInstance(someGlobalFuncWithArgs); | ||
const mock = TypeMoq.GlobalMock.ofInstance(someGlobalFuncWithArgs); | ||
TypeMoq.GlobalScope.using(mock).with(() => { | ||
@@ -822,5 +859,5 @@ someGlobalFuncWithArgs(1,2,3); | ||
// Global object is auto sandboxed | ||
let mock = TypeMoq.GlobalMock.ofType(GlobalBar); | ||
const mock = TypeMoq.GlobalMock.ofType(GlobalBar); | ||
TypeMoq.GlobalScope.using(mock).with(() => { | ||
let bar1 = new GlobalBar(); | ||
const bar1 = new GlobalBar(); | ||
bar1.value; | ||
@@ -831,5 +868,5 @@ bar1.value; | ||
// 'window.XmlHttpRequest' global object is auto sandboxed | ||
let mock = TypeMoq.GlobalMock.ofType(XMLHttpRequest); | ||
const mock = TypeMoq.GlobalMock.ofType(XMLHttpRequest); | ||
TypeMoq.GlobalScope.using(mock).with(() => { | ||
let xhr1 = new XMLHttpRequest(); | ||
const xhr1 = new XMLHttpRequest(); | ||
xhr1.open("GET", "http://www.typescriptlang.org", true); | ||
@@ -839,3 +876,3 @@ xhr1.send(); | ||
}); | ||
let xhr2 = new XMLHttpRequest(); | ||
const xhr2 = new XMLHttpRequest(); | ||
xhr2.open("GET", "http://www.typescriptlang.org", true); | ||
@@ -846,3 +883,3 @@ xhr2.send(); | ||
// 'window.localStorage' global object is auto sandboxed | ||
let mock = TypeMoq.GlobalMock.ofInstance(localStorage, "localStorage"); | ||
const mock = TypeMoq.GlobalMock.ofInstance(localStorage, "localStorage"); | ||
mock.setup(x => x.getItem(TypeMoq.It.isAnyString())).returns((key: string) => "[]"); | ||
@@ -849,0 +886,0 @@ TypeMoq.GlobalScope.using(mock).with(() => { |
@@ -1,9 +0,8 @@ | ||
import * as error from "../Error/_all"; | ||
import { IVerifies } from "./IVerifies"; | ||
import { IVerifies } from "./IVerifies"; | ||
export interface IThrows { | ||
throws<T extends error.Exception>(exception: T): IThrowsResult; | ||
throws<T extends Error>(exception: T): IThrowsResult; | ||
} | ||
export interface IThrowsResult extends IVerifies { | ||
} | ||
} |
@@ -8,5 +8,5 @@ import * as _ from "lodash"; | ||
private static NO_MATCHING_CALLS_EXACTLY_N_TIMES = "expected invocation of <%= i %> <%= n %> times, invoked <%= m %> times"; | ||
private static NO_MATCHING_CALLS_AT_LEAST_ONCE = "expected invocation of <%= i %> at least once, invoked <%= m %> times"; | ||
private static NO_MATCHING_CALLS_AT_MOST_ONCE = "expected invocation of <%= i %> at most once, invoked <%= m %> times"; | ||
private static NO_MATCHING_CALLS_EXACTLY_N_TIMES = "expected invocation of <%= i %> exactly <%= min %> times, invoked <%= c %> times"; | ||
private static NO_MATCHING_CALLS_AT_LEAST_N_TIMES = "expected invocation of <%= i %> at least <%= min %> times, invoked <%= c %> times"; | ||
private static NO_MATCHING_CALLS_AT_MOST_N_TIMES = "expected invocation of <%= i %> at most <%= max %> times, invoked <%= c %> times"; | ||
@@ -25,3 +25,3 @@ private _lastCallCount: number; | ||
failMessage(call: proxy.ICallContext) { | ||
return this._failMessage({ i: call, n: this.min, m: this._lastCallCount }); | ||
return this._failMessage({ i: call, min: this.min, max: this.max, c: this._lastCallCount }); | ||
} | ||
@@ -34,9 +34,23 @@ | ||
static exactly(n: number): Times { | ||
private static checkArg(n: number, target: string) { | ||
if (n < 0) | ||
throw new error.MockException(error.MockExceptionReason.InvalidArg, | ||
undefined, "'Times.exactly' argument cannot be a negative number"); | ||
undefined, `${target} argument cannot be a negative number`); | ||
} | ||
static exactly(n: number): Times { | ||
Times.checkArg(n, "'Times.exactly'"); | ||
return new Times(c => c === n, n, n, Times.NO_MATCHING_CALLS_EXACTLY_N_TIMES); | ||
} | ||
static atLeast(n: number): Times { | ||
Times.checkArg(n, "'Times.atLeast'"); | ||
return new Times(c => c >= n, n, 255, Times.NO_MATCHING_CALLS_AT_LEAST_N_TIMES); | ||
} | ||
static atMost(n: number): Times { | ||
Times.checkArg(n, "'Times.atMost'"); | ||
return new Times(c => c >= 0 && c <= n, 0, n, Times.NO_MATCHING_CALLS_AT_MOST_N_TIMES); | ||
} | ||
static never(): Times { | ||
@@ -51,7 +65,7 @@ return Times.exactly(0); | ||
static atLeastOnce(): Times { | ||
return new Times(c => c >= 1, 1, 255, Times.NO_MATCHING_CALLS_AT_LEAST_ONCE); | ||
return Times.atLeast(1); | ||
} | ||
static atMostOnce(): Times { | ||
return new Times(c => c >= 0 && c <= 1, 0, 1, Times.NO_MATCHING_CALLS_AT_MOST_ONCE); | ||
return Times.atMost(1); | ||
} | ||
@@ -70,10 +84,10 @@ | ||
} else { | ||
if (this.min >= 0 && this.max <= 1) | ||
res = "at most once"; | ||
else if (this.min >= 1) | ||
res = "at least once" | ||
if (this.min === 0 && this.max !== 255) | ||
res = `at most ${this.max} times`; | ||
else | ||
res = `at least ${this.min} times`; | ||
} | ||
return res; | ||
} | ||
} |
@@ -11,2 +11,2 @@ export class Exception extends Error { | ||
} | ||
} | ||
} |
@@ -17,3 +17,3 @@ import * as _ from "lodash"; | ||
protected _callCount: number = 0; | ||
protected _thrownException: all.Exception; | ||
protected _thrownException: Error; | ||
protected _evaluatedSuccessfully: boolean; | ||
@@ -20,0 +20,0 @@ |
@@ -7,11 +7,11 @@ ///<reference path="../../node_modules/typescript/lib/lib.es6.d.ts"/> | ||
let GlobalMock = TypeMoq.GlobalMock; | ||
let GlobalScope = TypeMoq.GlobalScope; | ||
let It = TypeMoq.It; | ||
let Times = TypeMoq.Times; | ||
const GlobalMock = TypeMoq.GlobalMock; | ||
const GlobalScope = TypeMoq.GlobalScope; | ||
const It = TypeMoq.It; | ||
const Times = TypeMoq.Times; | ||
import * as chai from "chai"; | ||
let assert = chai.assert; | ||
let expect = chai.expect; | ||
const assert = chai.assert; | ||
const expect = chai.expect; | ||
@@ -29,4 +29,4 @@ let container: any; | ||
let hasProxyES6 = (typeof Proxy != "undefined"); | ||
let noProxyES6Msg = "global 'Proxy' object not available"; | ||
const hasProxyES6 = (typeof Proxy != "undefined"); | ||
const noProxyES6Msg = "global 'Proxy' object not available"; | ||
@@ -39,3 +39,3 @@ describe("GlobalMock", () => { | ||
let mock: TypeMoq.IGlobalMock<GlobalBar> = GlobalMock.ofType(GlobalBar, container); | ||
const mock: TypeMoq.IGlobalMock<GlobalBar> = GlobalMock.ofType(GlobalBar, container); | ||
@@ -47,3 +47,3 @@ expect(mock).to.be.not.null; | ||
let mock: TypeMoq.IGlobalMock<IGlobalBar> = GlobalMock.ofType(GlobalBar, container); | ||
const mock: TypeMoq.IGlobalMock<IGlobalBar> = GlobalMock.ofType(GlobalBar, container); | ||
@@ -55,3 +55,3 @@ expect(mock).to.be.not.null; | ||
let mock: TypeMoq.IGlobalMock<IGlobalBar> = GlobalMock.ofType<IGlobalBar>(GlobalBar, container); | ||
const mock: TypeMoq.IGlobalMock<IGlobalBar> = GlobalMock.ofType<IGlobalBar>(GlobalBar, container); | ||
@@ -63,5 +63,5 @@ expect(mock).to.be.not.null; | ||
let bar = new TypeMoqTests.Bar(); | ||
let foo = new TypeMoqTests.Foo(bar); | ||
let mock: TypeMoq.IGlobalMock<TypeMoqTests.Foo> = GlobalMock.ofInstance(foo, "foo", container); | ||
const bar = new TypeMoqTests.Bar(); | ||
const foo = new TypeMoqTests.Foo(bar); | ||
const mock: TypeMoq.IGlobalMock<TypeMoqTests.Foo> = GlobalMock.ofInstance(foo, "foo", container); | ||
@@ -73,4 +73,4 @@ expect(mock.object).to.be.not.null; | ||
let foo = new TypeMoqTests.GenericFoo(TypeMoqTests.Bar); | ||
let mock: TypeMoq.IGlobalMock<TypeMoqTests.GenericFoo<TypeMoqTests.Bar>> = GlobalMock.ofInstance(foo, "foo", container); | ||
const foo = new TypeMoqTests.GenericFoo(TypeMoqTests.Bar); | ||
const mock: TypeMoq.IGlobalMock<TypeMoqTests.GenericFoo<TypeMoqTests.Bar>> = GlobalMock.ofInstance(foo, "foo", container); | ||
@@ -82,5 +82,5 @@ expect(mock.object).to.be.not.null; | ||
let bar = new GlobalBar(); | ||
const bar = new GlobalBar(); | ||
let mock: TypeMoq.IGlobalMock<GlobalBar> = GlobalMock.ofInstance(bar, "bar", container); | ||
const mock: TypeMoq.IGlobalMock<GlobalBar> = GlobalMock.ofInstance(bar, "bar", container); | ||
@@ -92,4 +92,4 @@ expect(mock).to.be.not.null; | ||
let mock1: TypeMoq.IGlobalMock<() => string> = GlobalMock.ofInstance(someGlobalFunc, undefined, container); | ||
let mock2: TypeMoq.IGlobalMock<(a: any, b: any, c: any) => string> = GlobalMock.ofInstance(someGlobalFuncWithArgs, undefined, container); | ||
const mock1: TypeMoq.IGlobalMock<() => string> = GlobalMock.ofInstance(someGlobalFunc, undefined, container); | ||
const mock2: TypeMoq.IGlobalMock<(a: any, b: any, c: any) => string> = GlobalMock.ofInstance(someGlobalFuncWithArgs, undefined, container); | ||
@@ -108,3 +108,3 @@ expect(mock1).to.be.not.null; | ||
else { | ||
let mock: TypeMoq.IGlobalMock<TypeMoqTests.IThing> = GlobalMock.ofType2<TypeMoqTests.IThing>("TypeMoqTests.IThing", container); | ||
const mock: TypeMoq.IGlobalMock<TypeMoqTests.IThing> = GlobalMock.ofType2<TypeMoqTests.IThing>("TypeMoqTests.IThing", container); | ||
@@ -128,3 +128,3 @@ expect(mock.object).to.be.not.null; | ||
let mock = GlobalMock.ofInstance(someGlobalFunc, undefined, container); | ||
const mock = GlobalMock.ofInstance(someGlobalFunc, undefined, container); | ||
@@ -149,3 +149,3 @@ mock.verify(x => x(), Times.never()); | ||
let mock = GlobalMock.ofInstance(someGlobalFuncWithArgs, undefined, container); | ||
const mock = GlobalMock.ofInstance(someGlobalFuncWithArgs, undefined, container); | ||
@@ -171,3 +171,3 @@ mock.verify(x => x(It.isAny(), It.isAny(), It.isAny()), Times.never()); | ||
let mock = GlobalMock.ofType(GlobalBar, container); | ||
const mock = GlobalMock.ofType(GlobalBar, container); | ||
@@ -178,3 +178,3 @@ mock.verify(x => x.value, Times.never()); | ||
let bar1 = new container.GlobalBar(); | ||
const bar1 = new container.GlobalBar(); | ||
@@ -188,3 +188,3 @@ bar1.value; | ||
let bar2 = new container.GlobalBar(); | ||
const bar2 = new container.GlobalBar(); | ||
@@ -198,3 +198,3 @@ bar2.value; | ||
let mock = GlobalMock.ofType(XMLHttpRequest, container); | ||
const mock = GlobalMock.ofType(XMLHttpRequest, container); | ||
@@ -205,3 +205,3 @@ mock.verify(x => x.send(It.isAny()), Times.never()); | ||
let xhr1 = new container.XMLHttpRequest(); | ||
const xhr1 = new container.XMLHttpRequest(); | ||
@@ -217,3 +217,3 @@ xhr1.open("GET", "http://www.typescriptlang.org", true); | ||
let xhr2 = new container.XMLHttpRequest(); | ||
const xhr2 = new container.XMLHttpRequest(); | ||
@@ -233,3 +233,3 @@ xhr2.open("GET", "http://www.typescriptlang.org", true); | ||
else { | ||
let mock = GlobalMock.ofInstance(localStorage, "localStorage", container); | ||
const mock = GlobalMock.ofInstance(localStorage, "localStorage", container); | ||
@@ -263,3 +263,3 @@ mock.setup(x => x.getItem(It.isAnyString())).returns((key: string) => "[]"); | ||
else { | ||
let mock = GlobalMock.ofType2<GlobalBar>("GlobalBar", container); | ||
const mock = GlobalMock.ofType2<GlobalBar>("GlobalBar", container); | ||
@@ -270,3 +270,3 @@ mock.verify(x => x.value, Times.never()); | ||
let bar1 = new container.GlobalBar(); | ||
const bar1 = new container.GlobalBar(); | ||
@@ -280,3 +280,3 @@ bar1.value; | ||
let bar2 = new container.GlobalBar(); | ||
const bar2 = new container.GlobalBar(); | ||
@@ -296,3 +296,3 @@ bar2.value; | ||
else { | ||
let mock = GlobalMock.ofType2<XMLHttpRequest>("XMLHttpRequest", container); | ||
const mock = GlobalMock.ofType2<XMLHttpRequest>("XMLHttpRequest", container); | ||
@@ -303,3 +303,3 @@ mock.verify(x => x.send(It.isAny()), Times.never()); | ||
let xhr1 = new container.XMLHttpRequest(); | ||
const xhr1 = new container.XMLHttpRequest(); | ||
@@ -315,3 +315,3 @@ xhr1.open("GET", "http://www.typescriptlang.org", true); | ||
let xhr2 = new container.XMLHttpRequest(); | ||
const xhr2 = new container.XMLHttpRequest(); | ||
@@ -318,0 +318,0 @@ xhr2.open("GET", "http://www.typescriptlang.org", true); |
Sorry, the diff of this file is too big to display
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 too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
485419
6709
852