Socket
Socket
Sign inDemoInstall

typemoq

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typemoq - npm Package Compare versions

Comparing version 1.8.0 to 2.0.0

5

CHANGELOG.md

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

v2.0.0 / 2017-08-08
===================
* add IMock.target property and shouldOverrideTarget option #74
v1.8.0 / 2017-07-21

@@ -2,0 +7,0 @@ ===================

4

dist/typemoq-min.js

@@ -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,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})});
!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._,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,a=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),s=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 a(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.NO_MATCHING_CALLS_EXACTLY_N_TIMES="expected invocation of <%= i %> exactly <%= min %> times, invoked <%= c %> times",t.NO_MATCHING_CALLS_AT_LEAST_N_TIMES="expected invocation of <%= i %> at least <%= min %> times, invoked <%= c %> times",t.NO_MATCHING_CALLS_AT_MOST_N_TIMES="expected invocation of <%= i %> at most <%= max %> times, invoked <%= c %> times",t}(),p=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}(),l=function(){function t(){}return t.IMATCH_ID_VALUE="438A51D3-6864-49D7-A655-CA1153B86965",t.IMATCH_ID_NAME="___id",t.IMATCH_MATCHES_NAME="___matches",t.IPROXY_ID_VALUE="BCDF5CE5-F0DF-40B7-8BA0-69DF395033C8",t.IPROXY_ID_NAME="___id",t}(),f=function(){function t(){}return t.isMatcher=function(t){return!e.isNil(t)&&!e.isUndefined(t[l.IMATCH_MATCHES_NAME])&&!e.isUndefined(t[l.IMATCH_ID_NAME])&&t[l.IMATCH_ID_NAME]===l.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=p.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=l.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=l.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=l.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=l.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=l.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=l.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=l.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"}(u||(u={}));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==u.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=u.FUNCTION);var a=t.call(this,i,c)||this;return a._that=n,a._property=r,o&&(a._args=e.cloneDeep(o),a._args.length=o.length,a._args.callee=o.callee),a}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=u.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,u.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=u.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=u.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=u.FUNCTION);var a=t.call(this,i,c)||this;return a._property=n,a._setter=r,a._args=e.cloneDeep(o),a._args.length=o.length,a._args.callee=o.callee,a}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}(),M=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=l.IPROXY_ID_VALUE,this.check(t);var o=this,i=p.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[l.IPROXY_ID_NAME])||t[l.IPROXY_ID_NAME]!==l.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 a(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 a(r.InvalidArg,n,"'"+n+"'; proxy argument should be a non primitive object")},t.checkNotNullOrUndefined=function(t){if(e.isNil(t))throw new a(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 M(n,r),i=new A(t,o);return e.intercept(i),i.returnValue}function u(t){var o=new M(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 M(n,r),i=new E(t,o);return e.intercept(i),i.returnValue}function a(t){var o=new M(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=l.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 a(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 M(t,n),a=new N(c,i);return this._interceptor.intercept(a),!e.isFunction(i)&&a.callType==u.PROPERTY&&a.property.desc?a.returnValue:function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];o._interceptor.removeInvocation(a);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 M(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(),s=function(t){return t.matches(n)},p=e.filter(c,function(t){return s(t)});if(p.length>1&&(s=function(t){return!t.isInvoked&&t.matches(n)}),i.call=e.find(c,function(t){return s(t)}),null!=i.call){if(n.isAnUnknownDynamicCallAtExecution&&(n.callType=i.call.setupCall.callType,n.callType==u.FUNCTION))return w.Stop;i.call.evaluatedSuccessfully()}else if(o.behavior==t.MockBehavior.Strict)throw new a(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"},""),u=o.reduce(function(t,e){return t+" "+e+"\n"},""),s=i+"\n Configured setups:\n"+c+"\n Performed invocations:\n"+u,p=new a(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 a(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==u.UNKNOWN&&(t.callType=u.PROPERTY),this._interceptedCall)throw new a(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 a(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=s.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,this.setupCall.callType==u.FUNCTION?r.value=this._returnValueFunc:r.get=this._returnValueFunc,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,r){t=n.cloneDeep(t);var o=new n(t,r,e);return o},n.ofGlobalInstance=function(t,e){var r=new n(t,!1,e);return r},n.ofType=function(t,e,r,o){var i=h.conthunktor(t,o),c=new n(i,r,e);return c},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,r){var o=new e(function(){},t,r,n);return o},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,r){void 0===n&&(n=t.MockBehavior.Loose),void 0===r&&(r=!0);var o=$.ofInstance(e,n,r);return o},e.ofType=function(n,r,o){void 0===r&&(r=t.MockBehavior.Loose),void 0===o&&(o=!0);for(var i=[],c=3;c<arguments.length;c++)i[c-3]=arguments[c];var u;return u=n?e.ofType2(n,i,r,o):et.ofType(void 0,r,o)},e.ofType2=function(e,n,r,o){void 0===r&&(r=t.MockBehavior.Loose),void 0===o&&(o=!0);var i=$.ofType(e,r,o,n);return i},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,"target",{get:function(){return this.mock.target},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,!1);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,!1);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=p.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 a(r.UnknownGlobalType,t,"unknown global type: "+t.type)}try{Object.defineProperty(t.container,t.name,c)}catch(u){console.log("1: "+u)}}}),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=s,t.GlobalMock=it,t.GlobalScope=ut,t.MockException=a,Object.defineProperty(t,"__esModule",{value:!0})});

@@ -28,5 +28,5 @@ // Generated by dts-bundle v0.7.2

export class MockApi {
static ofInstance<U>(targetInstance: U, behavior?: MockBehavior): IMock<U>;
static ofType<U>(targetConstructor?: common.CtorWithArgs<U>, behavior?: MockBehavior, ...targetConstructorArgs: any[]): IMock<U>;
static ofType2<U>(targetConstructor: common.CtorWithArgs<U>, targetConstructorArgs: any[], behavior?: MockBehavior): IMock<U>;
static ofInstance<U>(targetInstance: U, behavior?: MockBehavior, shouldOverrideTarget?: boolean): IMock<U>;
static ofType<U>(targetConstructor?: common.CtorWithArgs<U>, behavior?: MockBehavior, shouldOverrideTarget?: boolean, ...targetConstructorArgs: any[]): IMock<U>;
static ofType2<U>(targetConstructor: common.CtorWithArgs<U>, targetConstructorArgs: any[], behavior?: MockBehavior, shouldOverrideTarget?: boolean): IMock<U>;
}

@@ -42,2 +42,3 @@ }

readonly object: T;
readonly target: T;
readonly name: string;

@@ -195,2 +196,3 @@ readonly behavior: MockBehavior;

readonly object: T;
readonly target: T;
readonly name: string;

@@ -197,0 +199,0 @@ readonly behavior: MockBehavior;

@@ -132,3 +132,3 @@ 'use strict';

'circular-json': 'CircularJSON',
'lodash': '_'
lodash: '_'
}

@@ -157,3 +157,4 @@ },

typemoq: 'TypeMoq',
chai: 'chai'
chai: 'chai',
lodash: '_'
}

@@ -182,3 +183,4 @@ },

typemoq: 'TypeMoq',
chai: 'chai'
chai: 'chai',
lodash: '_'
}

@@ -185,0 +187,0 @@ },

{
"name": "typemoq",
"version": "1.8.0",
"version": "2.0.0",
"description": "A simple mocking library for TypeScript",

@@ -33,4 +33,4 @@ "author": "Florin Nitoi <florin.nitoi@gmail.com>",

"scripts": {
"gulp": "gulp",
"postinstall": "postinstall-build dist \"npm run gulp build\""
"build": "gulp build",
"postinstall": "postinstall-build dist"
},

@@ -40,3 +40,3 @@ "dependencies": {

"lodash": "^4.16.4",
"postinstall-build": "^2.1.3"
"postinstall-build": "^5.0.1"
},

@@ -58,3 +58,3 @@ "devDependencies": {

"gulp-replace": "0.5.4",
"gulp-rollup": "^2.13.0",
"gulp-rollup": "^2.14.0",
"gulp-size": "0.3.0",

@@ -61,0 +61,0 @@ "gulp-sourcemaps": "^2.6.0",

@@ -19,9 +19,5 @@ TypeMoq [![build badge](https://travis-ci.org/florinn/typemoq.svg?branch=master)](https://travis-ci.org/florinn/typemoq)

----------
[![Sauce Test Status](https://saucelabs.com/browser-matrix/florinn.svg)](https://saucelabs.com/u/florinn)
----------
Installing

@@ -122,2 +118,23 @@ -------------

```typescript
(method) TypeMoq.Mock.ofType<T>(targetConstructor?: {
new (...ctorArgs: any[]): T;
prototype: Object;
}, behavior?: TypeMoq.MockBehavior, shouldOverrideTarget?: boolean, ...targetConstructorArgs: any[]): TypeMoq.IMock<T>
(method) TypeMoq.Mock.ofType2<T>(targetConstructor: {
new (...ctorArgs: any[]): T;
prototype: Object;
}, targetConstructorArgs: any[], behavior?: TypeMoq.MockBehavior, shouldOverrideTarget?: boolean): TypeMoq.IMock<T>
```
* *targetConstructor* - target constructor type
* *...targetConstructorArgs* - target constructor args
* *behavior* - mock behavior (see [Control mock behavior](#control-mock-behavior))
* *shouldOverrideTarget* - override target properties (see [Override target properties](#override-target-properties))
**Note:** During the creation of the static mock, the target object is being instantiated as a regular JavaScript object by executing the target constructor with any provided constructor args
Examples:
```typescript
interface IBar {

@@ -172,2 +189,15 @@ value: string;

```typescript
(method) TypeMoq.Mock.ofInstance<T>(
targetInstance: T, behavior?: TypeMoq.MockBehavior, shouldOverrideTarget?: boolean): TypeMoq.IMock<T>
```
* *targetInstance* - target object
* *behavior* - mock behavior (see [Control mock behavior](#control-mock-behavior))
* *shouldOverrideTarget* - override target properties (see [Override target properties](#override-target-properties))
**Note:** To create the static mock, the provided target object is replaced by a deep clone which is accesible through the `.target` property of the resulting mock object
Examples:
```typescript
function someFunc() {

@@ -192,6 +222,19 @@ return "someFunc was called";

Dynamic mocking requires your runtime (browser or node.js) to support the `Proxy` global object added in ECMAScript 6.
If `Proxy` is not detected, TypeMoq is going to throw a MockException.
**Important:** Dynamic mocking requires the runtime (browser or node.js) to support the `Proxy` global object added in ECMAScript 6. If `Proxy` is not detected, TypeMoq is going to throw a MockException.
A dynamic mock is created by specifying a type parameter.
A dynamic mock is created by specifying just a type parameter and some optional args:
```typescript
(method) TypeMoq.Mock.ofType<T>(targetConstructor?: {
new (...ctorArgs: any[]): T;
prototype: Object;
}, behavior?: TypeMoq.MockBehavior, shouldOverrideTarget?: boolean): TypeMoq.IMock<T>
```
* *targetConstructor* - always `undefined` for dynamic mocks
* *behavior* - mock behavior (see [Control mock behavior](#control-mock-behavior))
* *shouldOverrideTarget* - override target properties (see [Override target properties](#override-target-properties))
**Note:** While creating the dynamic mock, the target object is **not** instantiated by executing the constructor of the provided type parameter
The following type parameters are supported:

@@ -231,3 +274,3 @@

As opposed to static mocks, dynamic mocks have some limitations due to the absence of the underlying target instance:
As opposed to static mocks, dynamic mocks have some limitations:

@@ -274,6 +317,10 @@ * No partial mocking

**Note:**
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).
#### Mocks type
Mocks (created in any of the ways listed above) have the type `IMock<T>` and expose a couple important properties:
* `(property) TypeMoq.IMock<T>.object: T` - the actual mock object (that has the same type T as the class or object being mocked)
* `(property) TypeMoq.IMock<T>.target: T` - the underlying object being mocked
### Setup mocks

@@ -283,2 +330,7 @@

```typescript
(method) TypeMoq.IMock<T>.setup<TResult>(
expression: (x: T) => TResult): TypeMoq.MethodCallReturn<T, TResult>
```
`setup` accepts a function (also referred as 'matcher') taking as input argument the type being mocked and as body the value/property/method (with arguments if that's the case) to match.

@@ -410,3 +462,2 @@

**Note:**
To be able to match a property make sure the property is initialized.

@@ -448,3 +499,2 @@ Otherwise the TypeScript compiler will omit the uninitialized property from the emitted JavaScript and hence TypeMoq will throw a MockException with an 'invalid setup expression' message.

**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`.

@@ -474,5 +524,9 @@

##### Attaching return callbacks
```typescript
(method) TypeMoq.IReturns<T, TResult>.returns(
valueFunction: (...x: any[]) => TResult): TypeMoq.IReturnsResult<T>
```
The callback attached to `.returns` has the same signature as the matching function/method.

@@ -489,2 +543,8 @@

```typescript
(method) TypeMoq.IThrows.throws<T extends Error>(exception: T): TypeMoq.IThrowsResult
```
Example:
```typescript
mock.setup(...).throws(new CustomException());

@@ -496,4 +556,14 @@ ```

```typescript
(method) TypeMoq.ICallback<T, TResult>.callback(
action: () => void): TypeMoq.IReturnsThrows<T, TResult>
(method) TypeMoq.ICallback<T, TResult>.callback(
action: (x: T) => void): TypeMoq.IReturnsThrows<T, TResult>
```
Attached callbacks are called before the `.returns` callback or `.throws` get called, and they have similar signature and behavior to `.returns` callbacks.
Examples:
```typescript

@@ -547,2 +617,6 @@ const mock = TypeMoq.Mock.ofType(Doer);

```typescript
(method) TypeMoq.IMock<T>.reset(): void
```
Calling `.reset()` on a mock returns the mock to its initial state by removing any previous setups.

@@ -555,3 +629,3 @@

When creating a mock, you may specify a behavior value such as:
At mock creation, use the optional `behavior` argument with value:

@@ -567,2 +641,6 @@ * `MockBehavior.Loose` (default) - never throws when no corresponding setup is found and just returns default values

```typescript
(property) TypeMoq.IMock<T>.callBase: boolean
```
When the mock property `callBase` is set to `true`, if there's no overriding setup the mock invokes the object being mocked.

@@ -576,4 +654,36 @@

### Override target properties
At mock creation, use the optional `shouldOverrideTarget` argument with value:
* `true` (default) - mock setups are going to be applied to the target object
* `false` - mock setups are **not** going to be applied to the target object
To be able to use the target object inside `.returns`, you need to choose **not** to override the target properties:
```typescript
const targetInstance = {
n: 100,
getValue() {
return this.n;
},
setValue(n) {
this.n = n;
}
};
const mock = TypeMoq.Mock.ofInstance(targetInstance, undefined, false);
mock.setup(x => x.getValue()).returns(() => mock.target.getValue());
expect(mock.object.getValue()).equal(100);
```
### Verify expectations
```typescript
(method) TypeMoq.IVerifies.verifiable(times?: TypeMoq.Times): void
```
Expectations can be verified either one by one or all at once by marking matchers as verifiable.

@@ -595,4 +705,11 @@

```typescript
(method) TypeMoq.IMock<T>.verify<TResult>(
expression: (x: T) => TResult, times: TypeMoq.Times): void
```
To verify an expectation you can use the `verify` method and specify a matching function and an expectation.
Examples:
```typescript

@@ -672,2 +789,6 @@ // Verify that a no args function was called at least once

```typescript
(method) TypeMoq.IMock<T>.verifyAll(): void
```
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.

@@ -738,2 +859,13 @@

```typescript
(method) TypeMoq.GlobalMock.ofType<T>(targetConstructor: {
new (): T;
prototype: Object;
}, container?: Object, behavior?: TypeMoq.MockBehavior): TypeMoq.IGlobalMock<T>
```
Due to browser security limitations, global mocks created by specifying class type cannot have constructor arguments.
Examples:
```typescript
// global scope

@@ -764,4 +896,11 @@

```typescript
(method) TypeMoq.GlobalMock.ofInstance<T>(
targetInstance: T, globalName?: string, container?: Object, behavior?: TypeMoq.MockBehavior): TypeMoq.IGlobalMock<T>
```
When creating mock instances out of global objects (such as `window.localStorage`), you should provide the name of the global object (*"localStorage"* in this case) as the second parameter.
Examples:
```typescript

@@ -789,7 +928,9 @@ // Create an instance using class as ctor parameter and ctor args

**Note:**
Due to browser security limitations, global mocks created by specifying class type cannot have constructor arguments
#### Dynamic global mocks
```typescript
(method) TypeMoq.GlobalMock.ofType2<T>(
globalName: string, container?: Object, behavior?: TypeMoq.MockBehavior): TypeMoq.IGlobalMock<T>
```
Dynamic global mocks are created by specifying a type parameter and the name of the global object as the first constructor argument.

@@ -810,6 +951,16 @@

### Auto sandbox global mocks
```typescript
(method) TypeMoq.GlobalScope.using(
...args: TypeMoq.IGlobalMock<any>[]): TypeMoq.IUsingResult
(method) TypeMoq.IUsingResult.with(action: () => void): void
```
Replacing and restoring global class types and objects is done automagically by combining global mocks with global scopes.
Examples:
```typescript

@@ -874,1 +1025,6 @@ // global scope

Inside the scope of a TypeMoq.GlobalScope, when constructing objects from global functions/class types which are being replaced by mocks, the constructor always returns the mocked object (of corresponding type) passed in as argument to the `TypeMoq.GlobalScope.using` function
## License
[MIT](https://github.com/florinn/typemoq/blob/master/LICENSE)

@@ -13,4 +13,4 @@ import * as _ from "lodash";

static ofInstance<U>(targetInstance: U, globalName?: string, container: Object = window, behavior = MockBehavior.Loose): IGlobalMock<U> {
let mock = StaticMock.ofGlobalInstance(targetInstance, behavior);
let type = _.isFunction(targetInstance) ? GlobalType.Function : GlobalType.Value;
const mock = StaticMock.ofGlobalInstance(targetInstance, behavior);
const type = _.isFunction(targetInstance) ? GlobalType.Function : GlobalType.Value;
return new GMock(mock, globalName, type, container);

@@ -20,4 +20,4 @@ }

static ofType<U>(targetConstructor: common.Ctor<U>, container: Object = window, behavior = MockBehavior.Loose): IGlobalMock<U> {
let targetInstance = new targetConstructor();
let mock: IMock<U> = StaticMock.ofInstance(targetInstance, behavior);
const targetInstance = new targetConstructor();
const mock: IMock<U> = StaticMock.ofInstance(targetInstance, behavior, false);
return new GMock(mock, undefined, GlobalType.Class, container);

@@ -27,3 +27,3 @@ }

static ofType2<U>(globalName: string, container: Object = window, behavior = MockBehavior.Loose): IGlobalMock<U> {
let mock: IMock<U> = DynamicMock.ofType<U>(globalName, behavior);
const mock: IMock<U> = DynamicMock.ofType<U>(globalName, behavior, false);
return new GMock(mock, undefined, GlobalType.Class, container);

@@ -30,0 +30,0 @@ }

import * as common from "../Common/_all";
import { MethodCallReturn } from "../MethodCallReturn";
import { MockBehavior } from "./MockBehavior";
import { Times } from "./Times";
import { Times } from "./Times";
export interface IMock<T> {
readonly object: T;
readonly target: T;
readonly name: string;

@@ -9,0 +10,0 @@ readonly behavior: MockBehavior;

@@ -9,18 +9,18 @@ import * as common from "../Common/_all";

static ofInstance<U>(targetInstance: U, behavior = MockBehavior.Loose): IMock<U> {
let mock = StaticMock.ofInstance(targetInstance, behavior);
static ofInstance<U>(targetInstance: U, behavior = MockBehavior.Loose, shouldOverrideTarget = true): IMock<U> {
const mock = StaticMock.ofInstance(targetInstance, behavior, shouldOverrideTarget);
return mock;
}
static ofType<U>(targetConstructor?: common.CtorWithArgs<U>, behavior = MockBehavior.Loose, ...targetConstructorArgs: any[]): IMock<U> {
static ofType<U>(targetConstructor?: common.CtorWithArgs<U>, behavior = MockBehavior.Loose, shouldOverrideTarget = true, ...targetConstructorArgs: any[]): IMock<U> {
let mock: IMock<U>;
if (targetConstructor)
mock = MockApi.ofType2(targetConstructor, targetConstructorArgs, behavior);
mock = MockApi.ofType2(targetConstructor, targetConstructorArgs, behavior, shouldOverrideTarget);
else
mock = DynamicMock.ofType<U>(undefined, behavior);
mock = DynamicMock.ofType<U>(undefined, behavior, shouldOverrideTarget);
return mock;
}
static ofType2<U>(targetConstructor: common.CtorWithArgs<U>, targetConstructorArgs: any[], behavior = MockBehavior.Loose): IMock<U> {
let mock: IMock<U> = StaticMock.ofType(targetConstructor, behavior, targetConstructorArgs);
static ofType2<U>(targetConstructor: common.CtorWithArgs<U>, targetConstructorArgs: any[], behavior = MockBehavior.Loose, shouldOverrideTarget = true): IMock<U> {
const mock: IMock<U> = StaticMock.ofType(targetConstructor, behavior, shouldOverrideTarget, targetConstructorArgs);
return mock;

@@ -27,0 +27,0 @@ }

@@ -25,4 +25,4 @@ import * as all from "./_all";

static ofType<U>(name: string, behavior: all.MockBehavior): all.IMock<U> {
let mock: DynamicMock<U> = new DynamicMock<U>(<any>(() => { }), name, true, behavior);
static ofType<U>(name: string, behavior: all.MockBehavior, shouldOverrideTarget: boolean): all.IMock<U> {
const mock: DynamicMock<U> = new DynamicMock<U>(<any>(() => { }), name, shouldOverrideTarget, behavior);
return mock;

@@ -34,3 +34,3 @@ }

setup<TResult>(expression: all.IFunc2<T, TResult>): MethodCallReturn<T, TResult> {
let call = MethodCallReturn.ofDynamicMock(this, expression);
const call = MethodCallReturn.ofDynamicMock(this, expression);
this._interceptor.addExpectedCall(call);

@@ -43,3 +43,3 @@ return call;

verify<TResult>(expression: all.IFunc2<T, TResult>, times: all.Times): void {
let call = MethodCall.ofDynamicMock(this, expression);
const call = MethodCall.ofDynamicMock(this, expression);
this._interceptor.addExpectedCall(call);

@@ -46,0 +46,0 @@ try {

@@ -15,2 +15,3 @@ import * as all from "./_all";

get object() { return this.mock.object; }
get target() { return this.mock.target; }

@@ -17,0 +18,0 @@ get name() { return this._name || this.mock.name; }

@@ -80,3 +80,8 @@ import * as all from "./_all";

desc.enumerable = true;
desc.value = null;
if (this.setupCall.callType == all.CallType.FUNCTION)
desc.value = this._returnValueFunc;
else
desc.get = this._returnValueFunc;
Object.defineProperty(obj, name, desc);

@@ -83,0 +88,0 @@ }

@@ -15,5 +15,5 @@ import * as _ from "lodash";

let funcName = common.Utils.functionName(target);
let method = new inv.MethodInfo(target, funcName);
let invocation: ICallContext = new inv.MethodInvocation(target, method, argArray, ProxyType.DYNAMIC);
const funcName = common.Utils.functionName(target);
const method = new inv.MethodInfo(target, funcName);
const invocation: ICallContext = new inv.MethodInvocation(target, method, argArray, ProxyType.DYNAMIC);
this._interceptor.intercept(invocation);

@@ -26,12 +26,12 @@

let propValue = (<any>target)[p];
let method = new inv.PropertyInfo(target, <string>p);
let invocation = new inv.DynamicGetInvocation(method, propValue);
const propValue = (<any>target)[p];
const method = new inv.PropertyInfo(target, <string>p);
const invocation = new inv.DynamicGetInvocation(method, propValue);
this._interceptor.intercept(invocation);
if (!_.isFunction(propValue) &&
if (!_.isFunction(propValue) &&
invocation.callType == CallType.PROPERTY &&
invocation.property.desc) // value getter invocation at execution time
return invocation.returnValue;

@@ -43,4 +43,4 @@ else

let method = new inv.MethodInfo(target, <string>p);
let methodInvocation = new inv.MethodInvocation(target, method, <any>args, ProxyType.DYNAMIC);
const method = new inv.MethodInfo(target, <string>p);
const methodInvocation = new inv.MethodInvocation(target, method, <any>args, ProxyType.DYNAMIC);
this._interceptor.intercept(methodInvocation);

@@ -54,4 +54,4 @@

let method = new inv.PropertyInfo(target, <string>p);
let invocation: ICallContext = new inv.ValueSetterInvocation(method, <any>[value], ProxyType.DYNAMIC);
const method = new inv.PropertyInfo(target, <string>p);
const invocation: ICallContext = new inv.ValueSetterInvocation(method, <any>[value], ProxyType.DYNAMIC);
this._interceptor.intercept(invocation);

@@ -63,5 +63,5 @@

defineProperty(target: T, p: PropKey, attributes: common.PropDescriptor): boolean {
attributes.configurable = true;
return Reflect.defineProperty(<Object>target, p, attributes);

@@ -68,0 +68,0 @@ }

@@ -12,8 +12,8 @@ import * as _ from "lodash";

private constructor(
target: T,
canOverrideTarget: boolean,
target: T,
canOverrideTarget: boolean,
behavior: all.MockBehavior) {
super(target, canOverrideTarget, behavior);
this._interceptor = new InterceptorExecute(this);

@@ -23,5 +23,5 @@ this._proxy = all.ProxyFactory.createProxy<T>(target, this._interceptor);

static ofInstance<U>(targetInstance: U, behavior: all.MockBehavior): all.IMock<U> {
static ofInstance<U>(targetInstance: U, behavior: all.MockBehavior, shouldOverrideTarget: boolean): all.IMock<U> {
targetInstance = StaticMock.cloneDeep(targetInstance);
let mock: StaticMock<U> = new StaticMock(targetInstance, true, behavior);
const mock: StaticMock<U> = new StaticMock(targetInstance, shouldOverrideTarget, behavior);
return mock;

@@ -31,9 +31,9 @@ }

static ofGlobalInstance<U>(targetInstance: U, behavior: all.MockBehavior): all.IMock<U> {
let mock: StaticMock<U> = new StaticMock(targetInstance, false, behavior);
const mock: StaticMock<U> = new StaticMock(targetInstance, false, behavior);
return mock;
}
static ofType<U>(targetConstructor: all.CtorWithArgs<U>, behavior: all.MockBehavior, targetConstructorArgs: any[]): all.IMock<U> {
let targetInstance: U = all.Utils.conthunktor(targetConstructor, targetConstructorArgs);
let mock: StaticMock<U> = new StaticMock(targetInstance, true, behavior);
static ofType<U>(targetConstructor: all.CtorWithArgs<U>, behavior: all.MockBehavior, shouldOverrideTarget: boolean, targetConstructorArgs: any[]): all.IMock<U> {
const targetInstance: U = all.Utils.conthunktor(targetConstructor, targetConstructorArgs);
const mock: StaticMock<U> = new StaticMock(targetInstance, shouldOverrideTarget, behavior);
return mock;

@@ -58,3 +58,3 @@ }

setup<TResult>(expression: all.IFunc2<T, TResult>): MethodCallReturn<T, TResult> {
let call = MethodCallReturn.ofStaticMock(this, expression);
const call = MethodCallReturn.ofStaticMock(this, expression);
this._interceptor.addExpectedCall(call);

@@ -67,3 +67,3 @@ return call;

verify<TResult>(expression: all.IFunc2<T, TResult>, times: all.Times): void {
let call = MethodCall.ofStaticMock(this, expression);
const call = MethodCall.ofStaticMock(this, expression);
this._interceptor.addExpectedCall(call);

@@ -70,0 +70,0 @@ try {

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 too big to display

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc