Python-test
Advanced tools
| import { MethodAction } from "../MethodAction"; | ||
| export declare class ArgCaptor { | ||
| private actions; | ||
| constructor(actions: MethodAction[]); | ||
| first(): any; | ||
| second(): any; | ||
| third(): any; | ||
| beforeLast(): any; | ||
| last(): any; | ||
| byCallIndex(index: number): any; | ||
| } | ||
| export interface ArgCaptor1<T> { | ||
| first(): [T]; | ||
| second(): [T]; | ||
| third(): [T]; | ||
| beforeLast(): [T]; | ||
| last(): [T]; | ||
| byCallIndex(index: number): [T]; | ||
| } | ||
| export interface ArgCaptor2<T0, T1> { | ||
| first(): [T0, T1]; | ||
| second(): [T0, T1]; | ||
| third(): [T0, T1]; | ||
| beforeLast(): [T0, T1]; | ||
| last(): [T0, T1]; | ||
| byCallIndex(index: number): [T0, T1]; | ||
| } | ||
| export interface ArgCaptor3<T0, T1, T2> { | ||
| first(): [T0, T1, T2]; | ||
| second(): [T0, T1, T2]; | ||
| third(): [T0, T1, T2]; | ||
| beforeLast(): [T0, T1, T2]; | ||
| last(): [T0, T1, T2]; | ||
| byCallIndex(index: number): [T0, T1, T2]; | ||
| } | ||
| export interface ArgCaptor4<T0, T1, T2, T3> { | ||
| first(): [T0, T1, T2, T3]; | ||
| second(): [T0, T1, T2, T3]; | ||
| third(): [T0, T1, T2, T3]; | ||
| beforeLast(): [T0, T1, T2, T3]; | ||
| last(): [T0, T1, T2, T3]; | ||
| byCallIndex(index: number): [T0, T1, T2, T3]; | ||
| } | ||
| export interface ArgCaptor5<T0, T1, T2, T3, T4> { | ||
| first(): [T0, T1, T2, T3, T4]; | ||
| second(): [T0, T1, T2, T3, T4]; | ||
| third(): [T0, T1, T2, T3, T4]; | ||
| beforeLast(): [T0, T1, T2, T3, T4]; | ||
| last(): [T0, T1, T2, T3, T4]; | ||
| byCallIndex(index: number): [T0, T1, T2, T3, T4]; | ||
| } | ||
| export interface ArgCaptor6<T0, T1, T2, T3, T4, T5> { | ||
| first(): [T0, T1, T2, T3, T4, T5]; | ||
| second(): [T0, T1, T2, T3, T4, T5]; | ||
| third(): [T0, T1, T2, T3, T4, T5]; | ||
| beforeLast(): [T0, T1, T2, T3, T4, T5]; | ||
| last(): [T0, T1, T2, T3, T4, T5]; | ||
| byCallIndex(index: number): [T0, T1, T2, T3, T4, T5]; | ||
| } | ||
| export interface ArgCaptor7<T0, T1, T2, T3, T4, T5, T6> { | ||
| first(): [T0, T1, T2, T3, T4, T5, T6]; | ||
| second(): [T0, T1, T2, T3, T4, T5, T6]; | ||
| third(): [T0, T1, T2, T3, T4, T5, T6]; | ||
| beforeLast(): [T0, T1, T2, T3, T4, T5, T6]; | ||
| last(): [T0, T1, T2, T3, T4, T5, T6]; | ||
| byCallIndex(index: number): [T0, T1, T2, T3, T4, T5, T6]; | ||
| } | ||
| export interface ArgCaptor8<T0, T1, T2, T3, T4, T5, T6, T7> { | ||
| first(): [T0, T1, T2, T3, T4, T5, T6, T7]; | ||
| second(): [T0, T1, T2, T3, T4, T5, T6, T7]; | ||
| third(): [T0, T1, T2, T3, T4, T5, T6, T7]; | ||
| beforeLast(): [T0, T1, T2, T3, T4, T5, T6, T7]; | ||
| last(): [T0, T1, T2, T3, T4, T5, T6, T7]; | ||
| byCallIndex(index: number): [T0, T1, T2, T3, T4, T5, T6, T7]; | ||
| } | ||
| export interface ArgCaptor9<T0, T1, T2, T3, T4, T5, T6, T7, T8> { | ||
| first(): [T0, T1, T2, T3, T4, T5, T6, T7, T8]; | ||
| second(): [T0, T1, T2, T3, T4, T5, T6, T7, T8]; | ||
| third(): [T0, T1, T2, T3, T4, T5, T6, T7, T8]; | ||
| beforeLast(): [T0, T1, T2, T3, T4, T5, T6, T7, T8]; | ||
| last(): [T0, T1, T2, T3, T4, T5, T6, T7, T8]; | ||
| byCallIndex(index: number): [T0, T1, T2, T3, T4, T5, T6, T7, T8]; | ||
| } | ||
| export interface ArgCaptor10<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> { | ||
| first(): [T0, T1, T2, T3, T4, T5, T6, T7, T8, T9]; | ||
| second(): [T0, T1, T2, T3, T4, T5, T6, T7, T8, T9]; | ||
| third(): [T0, T1, T2, T3, T4, T5, T6, T7, T8, T9]; | ||
| beforeLast(): [T0, T1, T2, T3, T4, T5, T6, T7, T8, T9]; | ||
| last(): [T0, T1, T2, T3, T4, T5, T6, T7, T8, T9]; | ||
| byCallIndex(index: number): [T0, T1, T2, T3, T4, T5, T6, T7, T8, T9]; | ||
| } |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var ArgCaptor = (function () { | ||
| function ArgCaptor(actions) { | ||
| this.actions = actions; | ||
| } | ||
| ArgCaptor.prototype.first = function () { | ||
| return this.byCallIndex(0); | ||
| }; | ||
| ArgCaptor.prototype.second = function () { | ||
| return this.byCallIndex(1); | ||
| }; | ||
| ArgCaptor.prototype.third = function () { | ||
| return this.byCallIndex(2); | ||
| }; | ||
| ArgCaptor.prototype.beforeLast = function () { | ||
| return this.byCallIndex(this.actions.length - 2); | ||
| }; | ||
| ArgCaptor.prototype.last = function () { | ||
| return this.byCallIndex(this.actions.length - 1); | ||
| }; | ||
| ArgCaptor.prototype.byCallIndex = function (index) { | ||
| if (index >= this.actions.length) { | ||
| throw new Error("Cannot capture arguments, method has not been called so many times: " + (index + 1)); | ||
| } | ||
| return this.actions[index].args; | ||
| }; | ||
| return ArgCaptor; | ||
| }()); | ||
| exports.ArgCaptor = ArgCaptor; | ||
| //# sourceMappingURL=ArgCaptor.js.map |
| {"version":3,"file":"ArgCaptor.js","sourceRoot":"","sources":["../../src/capture/ArgCaptor.ts"],"names":[],"mappings":";;AAEA;IACI,mBAAoB,OAAuB;QAAvB,YAAO,GAAP,OAAO,CAAgB;IAC3C,CAAC;IAEM,yBAAK,GAAZ;QACI,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAC/B,CAAC;IAEM,0BAAM,GAAb;QACI,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAC/B,CAAC;IAEM,yBAAK,GAAZ;QACI,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAC/B,CAAC;IAEM,8BAAU,GAAjB;QACI,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACrD,CAAC;IAEM,wBAAI,GAAX;QACI,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACrD,CAAC;IAEM,+BAAW,GAAlB,UAAmB,KAAa;QAC5B,IAAI,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YAC9B,MAAM,IAAI,KAAK,CAAC,0EAAuE,KAAK,GAAG,CAAC,CAAE,CAAC,CAAC;SACvG;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;IACpC,CAAC;IACL,gBAAC;AAAD,CAAC,AA9BD,IA8BC;AA9BY,8BAAS"} |
| import { Matcher } from "./type/Matcher"; | ||
| export declare class ArgsToMatchersValidator { | ||
| validate(matchers: Matcher[], args: any[]): boolean; | ||
| } |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var ArgsToMatchersValidator = (function () { | ||
| function ArgsToMatchersValidator() { | ||
| } | ||
| ArgsToMatchersValidator.prototype.validate = function (matchers, args) { | ||
| if (matchers.length !== args.length) { | ||
| return false; | ||
| } | ||
| return matchers.every(function (matcher, index) { return matcher.match(args[index]); }); | ||
| }; | ||
| return ArgsToMatchersValidator; | ||
| }()); | ||
| exports.ArgsToMatchersValidator = ArgsToMatchersValidator; | ||
| //# sourceMappingURL=ArgsToMatchersValidator.js.map |
| {"version":3,"file":"ArgsToMatchersValidator.js","sourceRoot":"","sources":["../../src/matcher/ArgsToMatchersValidator.ts"],"names":[],"mappings":";;AAEA;IAAA;IAOA,CAAC;IANU,0CAAQ,GAAf,UAAgB,QAAmB,EAAE,IAAW;QAC5C,IAAI,QAAQ,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,EAAE;YACjC,OAAO,KAAK,CAAC;SAChB;QACD,OAAO,QAAQ,CAAC,KAAK,CAAC,UAAC,OAAgB,EAAE,KAAa,IAAK,OAAA,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAA1B,CAA0B,CAAC,CAAC;IAC3F,CAAC;IACL,8BAAC;AAAD,CAAC,AAPD,IAOC;AAPY,0DAAuB"} |
| import { Matcher } from "./Matcher"; | ||
| export declare class AnyFunctionMatcher extends Matcher { | ||
| constructor(); | ||
| match(value: any): boolean; | ||
| toString(): string; | ||
| } |
| "use strict"; | ||
| var __extends = (this && this.__extends) || (function () { | ||
| var extendStatics = Object.setPrototypeOf || | ||
| ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
| function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
| return function (d, b) { | ||
| extendStatics(d, b); | ||
| function __() { this.constructor = d; } | ||
| d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
| }; | ||
| })(); | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var _ = require("lodash"); | ||
| var Matcher_1 = require("./Matcher"); | ||
| var AnyFunctionMatcher = (function (_super) { | ||
| __extends(AnyFunctionMatcher, _super); | ||
| function AnyFunctionMatcher() { | ||
| return _super.call(this) || this; | ||
| } | ||
| AnyFunctionMatcher.prototype.match = function (value) { | ||
| return _.isFunction(value); | ||
| }; | ||
| AnyFunctionMatcher.prototype.toString = function () { | ||
| return "anyFunction()"; | ||
| }; | ||
| return AnyFunctionMatcher; | ||
| }(Matcher_1.Matcher)); | ||
| exports.AnyFunctionMatcher = AnyFunctionMatcher; | ||
| //# sourceMappingURL=AnyFunctionMatcher.js.map |
| {"version":3,"file":"AnyFunctionMatcher.js","sourceRoot":"","sources":["../../../src/matcher/type/AnyFunctionMatcher.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0BAA4B;AAC5B,qCAAkC;AAElC;IAAwC,sCAAO;IAC3C;eACI,iBAAO;IACX,CAAC;IAEM,kCAAK,GAAZ,UAAa,KAAU;QACnB,OAAO,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAEM,qCAAQ,GAAf;QACI,OAAO,eAAe,CAAC;IAC3B,CAAC;IACL,yBAAC;AAAD,CAAC,AAZD,CAAwC,iBAAO,GAY9C;AAZY,gDAAkB"} |
| import { Matcher } from "./Matcher"; | ||
| export declare class AnyNumberMatcher extends Matcher { | ||
| constructor(); | ||
| match(value: any): boolean; | ||
| toString(): string; | ||
| } |
| "use strict"; | ||
| var __extends = (this && this.__extends) || (function () { | ||
| var extendStatics = Object.setPrototypeOf || | ||
| ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
| function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
| return function (d, b) { | ||
| extendStatics(d, b); | ||
| function __() { this.constructor = d; } | ||
| d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
| }; | ||
| })(); | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var _ = require("lodash"); | ||
| var Matcher_1 = require("./Matcher"); | ||
| var AnyNumberMatcher = (function (_super) { | ||
| __extends(AnyNumberMatcher, _super); | ||
| function AnyNumberMatcher() { | ||
| return _super.call(this) || this; | ||
| } | ||
| AnyNumberMatcher.prototype.match = function (value) { | ||
| return _.isNumber(value); | ||
| }; | ||
| AnyNumberMatcher.prototype.toString = function () { | ||
| return "anyNumber()"; | ||
| }; | ||
| return AnyNumberMatcher; | ||
| }(Matcher_1.Matcher)); | ||
| exports.AnyNumberMatcher = AnyNumberMatcher; | ||
| //# sourceMappingURL=AnyNumberMatcher.js.map |
| {"version":3,"file":"AnyNumberMatcher.js","sourceRoot":"","sources":["../../../src/matcher/type/AnyNumberMatcher.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0BAA4B;AAC5B,qCAAkC;AAElC;IAAsC,oCAAO;IACzC;eACI,iBAAO;IACX,CAAC;IAEM,gCAAK,GAAZ,UAAa,KAAU;QACnB,OAAO,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IAEM,mCAAQ,GAAf;QACI,OAAO,aAAa,CAAC;IACzB,CAAC;IACL,uBAAC;AAAD,CAAC,AAZD,CAAsC,iBAAO,GAY5C;AAZY,4CAAgB"} |
| import { Matcher } from "./Matcher"; | ||
| export declare class AnyOfClassMatcher<T> extends Matcher { | ||
| private expectedClass; | ||
| constructor(expectedClass: new (...args: any[]) => T); | ||
| match(value: any): boolean; | ||
| toString(): string; | ||
| } |
| "use strict"; | ||
| var __extends = (this && this.__extends) || (function () { | ||
| var extendStatics = Object.setPrototypeOf || | ||
| ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
| function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
| return function (d, b) { | ||
| extendStatics(d, b); | ||
| function __() { this.constructor = d; } | ||
| d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
| }; | ||
| })(); | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var Matcher_1 = require("./Matcher"); | ||
| var AnyOfClassMatcher = (function (_super) { | ||
| __extends(AnyOfClassMatcher, _super); | ||
| function AnyOfClassMatcher(expectedClass) { | ||
| var _this = _super.call(this) || this; | ||
| _this.expectedClass = expectedClass; | ||
| if (expectedClass === null) { | ||
| throw new Error("The expected class cannot be null."); | ||
| } | ||
| return _this; | ||
| } | ||
| AnyOfClassMatcher.prototype.match = function (value) { | ||
| return value instanceof this.expectedClass; | ||
| }; | ||
| AnyOfClassMatcher.prototype.toString = function () { | ||
| return "anyOfClass(" + this.expectedClass["name"] + ")"; | ||
| }; | ||
| return AnyOfClassMatcher; | ||
| }(Matcher_1.Matcher)); | ||
| exports.AnyOfClassMatcher = AnyOfClassMatcher; | ||
| //# sourceMappingURL=AnyOfClassMatcher.js.map |
| {"version":3,"file":"AnyOfClassMatcher.js","sourceRoot":"","sources":["../../../src/matcher/type/AnyOfClassMatcher.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAkC;AAElC;IAA0C,qCAAO;IAC7C,2BAAoB,aAAwC;QAA5D,YACI,iBAAO,SAIV;QALmB,mBAAa,GAAb,aAAa,CAA2B;QAExD,IAAI,aAAa,KAAK,IAAI,EAAE;YACxB,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;SACzD;;IACL,CAAC;IAEM,iCAAK,GAAZ,UAAa,KAAU;QACnB,OAAO,KAAK,YAAY,IAAI,CAAC,aAAa,CAAC;IAC/C,CAAC;IAEM,oCAAQ,GAAf;QACI,OAAO,gBAAc,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,MAAG,CAAC;IACvD,CAAC;IACL,wBAAC;AAAD,CAAC,AAfD,CAA0C,iBAAO,GAehD;AAfY,8CAAiB"} |
| import { Matcher } from "./Matcher"; | ||
| export declare class AnyStringMatcher extends Matcher { | ||
| constructor(); | ||
| match(value: any): boolean; | ||
| toString(): string; | ||
| } |
| "use strict"; | ||
| var __extends = (this && this.__extends) || (function () { | ||
| var extendStatics = Object.setPrototypeOf || | ||
| ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
| function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
| return function (d, b) { | ||
| extendStatics(d, b); | ||
| function __() { this.constructor = d; } | ||
| d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
| }; | ||
| })(); | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var _ = require("lodash"); | ||
| var Matcher_1 = require("./Matcher"); | ||
| var AnyStringMatcher = (function (_super) { | ||
| __extends(AnyStringMatcher, _super); | ||
| function AnyStringMatcher() { | ||
| return _super.call(this) || this; | ||
| } | ||
| AnyStringMatcher.prototype.match = function (value) { | ||
| return _.isString(value); | ||
| }; | ||
| AnyStringMatcher.prototype.toString = function () { | ||
| return "anyString()"; | ||
| }; | ||
| return AnyStringMatcher; | ||
| }(Matcher_1.Matcher)); | ||
| exports.AnyStringMatcher = AnyStringMatcher; | ||
| //# sourceMappingURL=AnyStringMatcher.js.map |
| {"version":3,"file":"AnyStringMatcher.js","sourceRoot":"","sources":["../../../src/matcher/type/AnyStringMatcher.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0BAA4B;AAC5B,qCAAkC;AAElC;IAAsC,oCAAO;IACzC;eACI,iBAAO;IACX,CAAC;IAEM,gCAAK,GAAZ,UAAa,KAAU;QACnB,OAAO,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IAEM,mCAAQ,GAAf;QACI,OAAO,aAAa,CAAC;IACzB,CAAC;IACL,uBAAC;AAAD,CAAC,AAZD,CAAsC,iBAAO,GAY5C;AAZY,4CAAgB"} |
| import { Matcher } from "./Matcher"; | ||
| export declare class AnythingMatcher extends Matcher { | ||
| constructor(); | ||
| match(value: any): boolean; | ||
| toString(): string; | ||
| } |
| "use strict"; | ||
| var __extends = (this && this.__extends) || (function () { | ||
| var extendStatics = Object.setPrototypeOf || | ||
| ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
| function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
| return function (d, b) { | ||
| extendStatics(d, b); | ||
| function __() { this.constructor = d; } | ||
| d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
| }; | ||
| })(); | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var Matcher_1 = require("./Matcher"); | ||
| var AnythingMatcher = (function (_super) { | ||
| __extends(AnythingMatcher, _super); | ||
| function AnythingMatcher() { | ||
| return _super.call(this) || this; | ||
| } | ||
| AnythingMatcher.prototype.match = function (value) { | ||
| return true; | ||
| }; | ||
| AnythingMatcher.prototype.toString = function () { | ||
| return "anything()"; | ||
| }; | ||
| return AnythingMatcher; | ||
| }(Matcher_1.Matcher)); | ||
| exports.AnythingMatcher = AnythingMatcher; | ||
| //# sourceMappingURL=AnythingMatcher.js.map |
| {"version":3,"file":"AnythingMatcher.js","sourceRoot":"","sources":["../../../src/matcher/type/AnythingMatcher.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAkC;AAElC;IAAqC,mCAAO;IACxC;eACI,iBAAO;IACX,CAAC;IAEM,+BAAK,GAAZ,UAAa,KAAU;QACnB,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,kCAAQ,GAAf;QACI,OAAO,YAAY,CAAC;IACxB,CAAC;IACL,sBAAC;AAAD,CAAC,AAZD,CAAqC,iBAAO,GAY3C;AAZY,0CAAe"} |
| import { Matcher } from "./Matcher"; | ||
| export declare class BetweenMatcher extends Matcher { | ||
| private min; | ||
| private max; | ||
| constructor(min: number, max: number); | ||
| match(value: any): boolean; | ||
| toString(): string; | ||
| } |
| "use strict"; | ||
| var __extends = (this && this.__extends) || (function () { | ||
| var extendStatics = Object.setPrototypeOf || | ||
| ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
| function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
| return function (d, b) { | ||
| extendStatics(d, b); | ||
| function __() { this.constructor = d; } | ||
| d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
| }; | ||
| })(); | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var Matcher_1 = require("./Matcher"); | ||
| var BetweenMatcher = (function (_super) { | ||
| __extends(BetweenMatcher, _super); | ||
| function BetweenMatcher(min, max) { | ||
| var _this = _super.call(this) || this; | ||
| _this.min = min; | ||
| _this.max = max; | ||
| if (min > max) { | ||
| throw new Error("between matcher error: min value can\'t be greater than max"); | ||
| } | ||
| return _this; | ||
| } | ||
| BetweenMatcher.prototype.match = function (value) { | ||
| return value >= this.min && value <= this.max; | ||
| }; | ||
| BetweenMatcher.prototype.toString = function () { | ||
| return "between(" + this.min + ", " + this.max + ")"; | ||
| }; | ||
| return BetweenMatcher; | ||
| }(Matcher_1.Matcher)); | ||
| exports.BetweenMatcher = BetweenMatcher; | ||
| //# sourceMappingURL=BetweenMatcher.js.map |
| {"version":3,"file":"BetweenMatcher.js","sourceRoot":"","sources":["../../../src/matcher/type/BetweenMatcher.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAkC;AAElC;IAAoC,kCAAO;IACvC,wBAAoB,GAAW,EAAU,GAAW;QAApD,YACI,iBAAO,SAKV;QANmB,SAAG,GAAH,GAAG,CAAQ;QAAU,SAAG,GAAH,GAAG,CAAQ;QAGhD,IAAI,GAAG,GAAG,GAAG,EAAE;YACX,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;SAClF;;IACL,CAAC;IAEM,8BAAK,GAAZ,UAAa,KAAU;QACnB,OAAO,KAAK,IAAI,IAAI,CAAC,GAAG,IAAI,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC;IAClD,CAAC;IAEM,iCAAQ,GAAf;QACI,OAAO,aAAW,IAAI,CAAC,GAAG,UAAK,IAAI,CAAC,GAAG,MAAG,CAAC;IAC/C,CAAC;IACL,qBAAC;AAAD,CAAC,AAhBD,CAAoC,iBAAO,GAgB1C;AAhBY,wCAAc"} |
| import { Matcher } from "./Matcher"; | ||
| export declare class DeepEqualMatcher<T> extends Matcher { | ||
| private expectedValue; | ||
| constructor(expectedValue: T); | ||
| match(value: any): boolean; | ||
| toString(): string; | ||
| } |
| "use strict"; | ||
| var __extends = (this && this.__extends) || (function () { | ||
| var extendStatics = Object.setPrototypeOf || | ||
| ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
| function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
| return function (d, b) { | ||
| extendStatics(d, b); | ||
| function __() { this.constructor = d; } | ||
| d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
| }; | ||
| })(); | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var _ = require("lodash"); | ||
| var Matcher_1 = require("./Matcher"); | ||
| var DeepEqualMatcher = (function (_super) { | ||
| __extends(DeepEqualMatcher, _super); | ||
| function DeepEqualMatcher(expectedValue) { | ||
| var _this = _super.call(this) || this; | ||
| _this.expectedValue = expectedValue; | ||
| return _this; | ||
| } | ||
| DeepEqualMatcher.prototype.match = function (value) { | ||
| return _.isEqualWith(this.expectedValue, value, function (expected, actual) { | ||
| if (expected instanceof Matcher_1.Matcher) { | ||
| return expected.match(actual); | ||
| } | ||
| return undefined; | ||
| }); | ||
| }; | ||
| DeepEqualMatcher.prototype.toString = function () { | ||
| if (this.expectedValue instanceof Array) { | ||
| return "deepEqual([" + this.expectedValue + "])"; | ||
| } | ||
| else { | ||
| return "deepEqual(" + this.expectedValue + ")"; | ||
| } | ||
| }; | ||
| return DeepEqualMatcher; | ||
| }(Matcher_1.Matcher)); | ||
| exports.DeepEqualMatcher = DeepEqualMatcher; | ||
| //# sourceMappingURL=DeepEqualMatcher.js.map |
| {"version":3,"file":"DeepEqualMatcher.js","sourceRoot":"","sources":["../../../src/matcher/type/DeepEqualMatcher.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0BAA4B;AAC5B,qCAAkC;AAElC;IAAyC,oCAAO;IAC5C,0BAAoB,aAAgB;QAApC,YACI,iBAAO,SACV;QAFmB,mBAAa,GAAb,aAAa,CAAG;;IAEpC,CAAC;IAEM,gCAAK,GAAZ,UAAa,KAAU;QACnB,OAAO,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,EAC1C,UAAC,QAAa,EAAE,MAAW;YACvB,IAAI,QAAQ,YAAY,iBAAO,EAAE;gBAC7B,OAAO,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;aACjC;YAED,OAAO,SAAS,CAAC;QACrB,CAAC,CAAC,CAAC;IACX,CAAC;IAEM,mCAAQ,GAAf;QACI,IAAI,IAAI,CAAC,aAAa,YAAY,KAAK,EAAE;YACrC,OAAO,gBAAc,IAAI,CAAC,aAAa,OAAI,CAAC;SAC/C;aAAM;YACH,OAAO,eAAa,IAAI,CAAC,aAAa,MAAG,CAAC;SAC7C;IACL,CAAC;IACL,uBAAC;AAAD,CAAC,AAvBD,CAAyC,iBAAO,GAuB/C;AAvBY,4CAAgB"} |
| export declare class Matcher { | ||
| match(value: any): boolean; | ||
| toString(): string; | ||
| } |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var Matcher = (function () { | ||
| function Matcher() { | ||
| } | ||
| Matcher.prototype.match = function (value) { | ||
| return false; | ||
| }; | ||
| Matcher.prototype.toString = function () { | ||
| return ""; | ||
| }; | ||
| return Matcher; | ||
| }()); | ||
| exports.Matcher = Matcher; | ||
| //# sourceMappingURL=Matcher.js.map |
| {"version":3,"file":"Matcher.js","sourceRoot":"","sources":["../../../src/matcher/type/Matcher.ts"],"names":[],"mappings":";;AAAA;IAAA;IAQA,CAAC;IAPU,uBAAK,GAAZ,UAAa,KAAU;QACnB,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,0BAAQ,GAAf;QACI,OAAO,EAAE,CAAC;IACd,CAAC;IACL,cAAC;AAAD,CAAC,AARD,IAQC;AARY,0BAAO"} |
| import { Matcher } from "./Matcher"; | ||
| export declare class MatchingStringMatcher extends Matcher { | ||
| private expectedValue; | ||
| constructor(expectedValue: any); | ||
| match(value: any): boolean; | ||
| toString(): string; | ||
| } |
| "use strict"; | ||
| var __extends = (this && this.__extends) || (function () { | ||
| var extendStatics = Object.setPrototypeOf || | ||
| ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
| function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
| return function (d, b) { | ||
| extendStatics(d, b); | ||
| function __() { this.constructor = d; } | ||
| d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
| }; | ||
| })(); | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var Matcher_1 = require("./Matcher"); | ||
| var MatchingStringMatcher = (function (_super) { | ||
| __extends(MatchingStringMatcher, _super); | ||
| function MatchingStringMatcher(expectedValue) { | ||
| var _this = _super.call(this) || this; | ||
| _this.expectedValue = expectedValue; | ||
| return _this; | ||
| } | ||
| MatchingStringMatcher.prototype.match = function (value) { | ||
| return value.match(this.expectedValue); | ||
| }; | ||
| MatchingStringMatcher.prototype.toString = function () { | ||
| return "match(" + this.expectedValue + ")"; | ||
| }; | ||
| return MatchingStringMatcher; | ||
| }(Matcher_1.Matcher)); | ||
| exports.MatchingStringMatcher = MatchingStringMatcher; | ||
| //# sourceMappingURL=MatchingStringMatcher.js.map |
| {"version":3,"file":"MatchingStringMatcher.js","sourceRoot":"","sources":["../../../src/matcher/type/MatchingStringMatcher.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAkC;AAElC;IAA2C,yCAAO;IAC9C,+BAAoB,aAAkB;QAAtC,YACI,iBAAO,SACV;QAFmB,mBAAa,GAAb,aAAa,CAAK;;IAEtC,CAAC;IAEM,qCAAK,GAAZ,UAAa,KAAU;QACnB,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC3C,CAAC;IAEM,wCAAQ,GAAf;QACI,OAAO,WAAS,IAAI,CAAC,aAAa,MAAG,CAAC;IAC1C,CAAC;IACL,4BAAC;AAAD,CAAC,AAZD,CAA2C,iBAAO,GAYjD;AAZY,sDAAqB"} |
| import { Matcher } from "./Matcher"; | ||
| export declare class NotNullMatcher extends Matcher { | ||
| match(value: any): boolean; | ||
| toString(): string; | ||
| } |
| "use strict"; | ||
| var __extends = (this && this.__extends) || (function () { | ||
| var extendStatics = Object.setPrototypeOf || | ||
| ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
| function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
| return function (d, b) { | ||
| extendStatics(d, b); | ||
| function __() { this.constructor = d; } | ||
| d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
| }; | ||
| })(); | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var _ = require("lodash"); | ||
| var Matcher_1 = require("./Matcher"); | ||
| var NotNullMatcher = (function (_super) { | ||
| __extends(NotNullMatcher, _super); | ||
| function NotNullMatcher() { | ||
| return _super !== null && _super.apply(this, arguments) || this; | ||
| } | ||
| NotNullMatcher.prototype.match = function (value) { | ||
| return !_.isNull(value); | ||
| }; | ||
| NotNullMatcher.prototype.toString = function () { | ||
| return "notNull()"; | ||
| }; | ||
| return NotNullMatcher; | ||
| }(Matcher_1.Matcher)); | ||
| exports.NotNullMatcher = NotNullMatcher; | ||
| //# sourceMappingURL=NotNullMatcher.js.map |
| {"version":3,"file":"NotNullMatcher.js","sourceRoot":"","sources":["../../../src/matcher/type/NotNullMatcher.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0BAA4B;AAC5B,qCAAkC;AAElC;IAAoC,kCAAO;IAA3C;;IAQA,CAAC;IAPU,8BAAK,GAAZ,UAAa,KAAU;QACnB,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAEM,iCAAQ,GAAf;QACI,OAAO,WAAW,CAAC;IACvB,CAAC;IACL,qBAAC;AAAD,CAAC,AARD,CAAoC,iBAAO,GAQ1C;AARY,wCAAc"} |
| import { Matcher } from "./Matcher"; | ||
| export declare class ObjectContainingMatcher extends Matcher { | ||
| private expectedValue; | ||
| constructor(expectedValue: any); | ||
| match(value: Object): boolean; | ||
| toString(): string; | ||
| } |
| "use strict"; | ||
| var __extends = (this && this.__extends) || (function () { | ||
| var extendStatics = Object.setPrototypeOf || | ||
| ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
| function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
| return function (d, b) { | ||
| extendStatics(d, b); | ||
| function __() { this.constructor = d; } | ||
| d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
| }; | ||
| })(); | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var _ = require("lodash"); | ||
| var Matcher_1 = require("./Matcher"); | ||
| var ObjectContainingMatcher = (function (_super) { | ||
| __extends(ObjectContainingMatcher, _super); | ||
| function ObjectContainingMatcher(expectedValue) { | ||
| var _this = _super.call(this) || this; | ||
| _this.expectedValue = expectedValue; | ||
| return _this; | ||
| } | ||
| ObjectContainingMatcher.prototype.match = function (value) { | ||
| return _.isMatch(value, this.expectedValue); | ||
| }; | ||
| ObjectContainingMatcher.prototype.toString = function () { | ||
| return "objectContaining(" + this.expectedValue + ")"; | ||
| }; | ||
| return ObjectContainingMatcher; | ||
| }(Matcher_1.Matcher)); | ||
| exports.ObjectContainingMatcher = ObjectContainingMatcher; | ||
| //# sourceMappingURL=ObjectContainingMatcher.js.map |
| {"version":3,"file":"ObjectContainingMatcher.js","sourceRoot":"","sources":["../../../src/matcher/type/ObjectContainingMatcher.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0BAA4B;AAC5B,qCAAkC;AAElC;IAA6C,2CAAO;IAChD,iCAAoB,aAAkB;QAAtC,YACI,iBAAO,SACV;QAFmB,mBAAa,GAAb,aAAa,CAAK;;IAEtC,CAAC;IAEM,uCAAK,GAAZ,UAAa,KAAa;QACtB,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAChD,CAAC;IAEM,0CAAQ,GAAf;QACI,OAAO,sBAAoB,IAAI,CAAC,aAAa,MAAG,CAAC;IACrD,CAAC;IACL,8BAAC;AAAD,CAAC,AAZD,CAA6C,iBAAO,GAYnD;AAZY,0DAAuB"} |
| import { Matcher } from "./Matcher"; | ||
| export declare class StrictEqualMatcher extends Matcher { | ||
| private expectedValue; | ||
| constructor(expectedValue: any); | ||
| match(value: any): boolean; | ||
| toString(): string; | ||
| } |
| "use strict"; | ||
| var __extends = (this && this.__extends) || (function () { | ||
| var extendStatics = Object.setPrototypeOf || | ||
| ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
| function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
| return function (d, b) { | ||
| extendStatics(d, b); | ||
| function __() { this.constructor = d; } | ||
| d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
| }; | ||
| })(); | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var Matcher_1 = require("./Matcher"); | ||
| var StrictEqualMatcher = (function (_super) { | ||
| __extends(StrictEqualMatcher, _super); | ||
| function StrictEqualMatcher(expectedValue) { | ||
| var _this = _super.call(this) || this; | ||
| _this.expectedValue = expectedValue; | ||
| return _this; | ||
| } | ||
| StrictEqualMatcher.prototype.match = function (value) { | ||
| return this.expectedValue === value; | ||
| }; | ||
| StrictEqualMatcher.prototype.toString = function () { | ||
| if (this.expectedValue instanceof Array) { | ||
| return "strictEqual([" + this.expectedValue + "])"; | ||
| } | ||
| else { | ||
| return "strictEqual(" + this.expectedValue + ")"; | ||
| } | ||
| }; | ||
| return StrictEqualMatcher; | ||
| }(Matcher_1.Matcher)); | ||
| exports.StrictEqualMatcher = StrictEqualMatcher; | ||
| //# sourceMappingURL=StrictEqualMatcher.js.map |
| {"version":3,"file":"StrictEqualMatcher.js","sourceRoot":"","sources":["../../../src/matcher/type/StrictEqualMatcher.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAkC;AAElC;IAAwC,sCAAO;IAC3C,4BAAoB,aAAkB;QAAtC,YACI,iBAAO,SACV;QAFmB,mBAAa,GAAb,aAAa,CAAK;;IAEtC,CAAC;IAEM,kCAAK,GAAZ,UAAa,KAAU;QACnB,OAAO,IAAI,CAAC,aAAa,KAAK,KAAK,CAAC;IACxC,CAAC;IAEM,qCAAQ,GAAf;QACI,IAAI,IAAI,CAAC,aAAa,YAAY,KAAK,EAAE;YACrC,OAAO,kBAAgB,IAAI,CAAC,aAAa,OAAI,CAAC;SACjD;aAAM;YACH,OAAO,iBAAe,IAAI,CAAC,aAAa,MAAG,CAAC;SAC/C;IACL,CAAC;IACL,yBAAC;AAAD,CAAC,AAhBD,CAAwC,iBAAO,GAgB9C;AAhBY,gDAAkB"} |
| import { Matcher } from "./matcher/type/Matcher"; | ||
| export declare class MethodAction { | ||
| methodName: string; | ||
| args: any[]; | ||
| private static globalCallIndex; | ||
| private callIndex; | ||
| constructor(methodName: string, args: any[]); | ||
| isApplicable(methodName: string, matchers: Matcher[]): boolean; | ||
| getCallIndex(): number; | ||
| hasBeenCalledBefore(action: MethodAction): boolean; | ||
| } |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var MethodAction = (function () { | ||
| function MethodAction(methodName, args) { | ||
| this.methodName = methodName; | ||
| this.args = args; | ||
| this.callIndex = ++MethodAction.globalCallIndex; | ||
| } | ||
| MethodAction.prototype.isApplicable = function (methodName, matchers) { | ||
| var _this = this; | ||
| var methodNameMatch = this.methodName === methodName; | ||
| var argumentsCountMatch = this.args.length === matchers.length; | ||
| if (!methodNameMatch || !argumentsCountMatch) { | ||
| return false; | ||
| } | ||
| return matchers.every(function (matcher, index) { return matcher.match(_this.args[index]); }); | ||
| }; | ||
| MethodAction.prototype.getCallIndex = function () { | ||
| return this.callIndex; | ||
| }; | ||
| MethodAction.prototype.hasBeenCalledBefore = function (action) { | ||
| return this.getCallIndex() < action.getCallIndex(); | ||
| }; | ||
| MethodAction.globalCallIndex = 0; | ||
| return MethodAction; | ||
| }()); | ||
| exports.MethodAction = MethodAction; | ||
| //# sourceMappingURL=MethodAction.js.map |
| {"version":3,"file":"MethodAction.js","sourceRoot":"","sources":["../src/MethodAction.ts"],"names":[],"mappings":";;AAEA;IAII,sBAAmB,UAAkB,EAAS,IAAW;QAAtC,eAAU,GAAV,UAAU,CAAQ;QAAS,SAAI,GAAJ,IAAI,CAAO;QACrD,IAAI,CAAC,SAAS,GAAG,EAAE,YAAY,CAAC,eAAe,CAAC;IACpD,CAAC;IAEM,mCAAY,GAAnB,UAAoB,UAAkB,EAAE,QAAmB;QAA3D,iBAOC;QANG,IAAM,eAAe,GAAG,IAAI,CAAC,UAAU,KAAK,UAAU,CAAC;QACvD,IAAM,mBAAmB,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,QAAQ,CAAC,MAAM,CAAC;QACjE,IAAI,CAAC,eAAe,IAAI,CAAC,mBAAmB,EAAE;YAC1C,OAAO,KAAK,CAAC;SAChB;QACD,OAAO,QAAQ,CAAC,KAAK,CAAC,UAAC,OAAgB,EAAE,KAAa,IAAK,OAAA,OAAO,CAAC,KAAK,CAAC,KAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAA/B,CAA+B,CAAC,CAAC;IAChG,CAAC;IAEM,mCAAY,GAAnB;QACI,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAEM,0CAAmB,GAA1B,UAA2B,MAAoB;QAC3C,OAAO,IAAI,CAAC,YAAY,EAAE,GAAG,MAAM,CAAC,YAAY,EAAE,CAAC;IACvD,CAAC;IAtBc,4BAAe,GAAW,CAAC,CAAC;IAuB/C,mBAAC;CAAA,AAxBD,IAwBC;AAxBY,oCAAY"} |
| import { MethodStub } from "./stub/MethodStub"; | ||
| export declare class MethodStubCollection { | ||
| private items; | ||
| add(item: MethodStub): void; | ||
| getLastMatchingGroupIndex(args: any): number; | ||
| getFirstMatchingFromGroupAndRemoveIfNotLast(groupIndex: number, args: any[]): MethodStub; | ||
| hasMatchingInAnyGroup(args: any[]): boolean; | ||
| private removeIfNotLast; | ||
| private getFirstMatchingFromGroup; | ||
| private getFirstMatchingIndexFromGroup; | ||
| private getItemsCountInGroup; | ||
| } |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var _ = require("lodash"); | ||
| var MethodStubCollection = (function () { | ||
| function MethodStubCollection() { | ||
| this.items = []; | ||
| } | ||
| MethodStubCollection.prototype.add = function (item) { | ||
| this.items.push(item); | ||
| }; | ||
| MethodStubCollection.prototype.getLastMatchingGroupIndex = function (args) { | ||
| var matchingGroup = _.clone(this.items).reverse().find(function (item) { return item.isApplicable(args); }); | ||
| return matchingGroup ? matchingGroup.getGroupIndex() : -1; | ||
| }; | ||
| MethodStubCollection.prototype.getFirstMatchingFromGroupAndRemoveIfNotLast = function (groupIndex, args) { | ||
| var result = this.getFirstMatchingFromGroup(groupIndex, args); | ||
| this.removeIfNotLast(groupIndex, args); | ||
| return result; | ||
| }; | ||
| MethodStubCollection.prototype.hasMatchingInAnyGroup = function (args) { | ||
| return this.items.some(function (item) { return item.isApplicable(args); }); | ||
| }; | ||
| MethodStubCollection.prototype.removeIfNotLast = function (groupIndex, args) { | ||
| var index = this.getFirstMatchingIndexFromGroup(groupIndex, args); | ||
| if (index > -1 && this.getItemsCountInGroup(groupIndex) > 1) { | ||
| this.items.splice(index, 1); | ||
| } | ||
| }; | ||
| MethodStubCollection.prototype.getFirstMatchingFromGroup = function (groupIndex, args) { | ||
| return this.items.find(function (item) { return item.getGroupIndex() === groupIndex && item.isApplicable(args); }); | ||
| }; | ||
| MethodStubCollection.prototype.getFirstMatchingIndexFromGroup = function (groupIndex, args) { | ||
| return this.items.findIndex(function (item) { return item.getGroupIndex() === groupIndex && item.isApplicable(args); }); | ||
| }; | ||
| MethodStubCollection.prototype.getItemsCountInGroup = function (groupIndex) { | ||
| return this.items.filter(function (item) { return item.getGroupIndex() === groupIndex; }).length; | ||
| }; | ||
| return MethodStubCollection; | ||
| }()); | ||
| exports.MethodStubCollection = MethodStubCollection; | ||
| //# sourceMappingURL=MethodStubCollection.js.map |
| {"version":3,"file":"MethodStubCollection.js","sourceRoot":"","sources":["../src/MethodStubC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CAAC,CAAC,CAAC;SAC/B;IACL,CAAC;IAEO,wDAAyB,GAAjC,UAAkC,UAAkB,EAAE,IAAW;QAC7D,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAC,IAAgB,IAAK,OAAA,IAAI,CAAC,aAAa,EAAE,KAAK,UAAU,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAA9D,CAA8D,CAAC,CAAC;IACjH,CAAC;IAEO,6DAA8B,GAAtC,UAAuC,UAAkB,EAAE,IAAW;QAClE,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,UAAC,IAAgB,IAAK,OAAA,IAAI,CAAC,aAAa,EAAE,KAAK,UAAU,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAA9D,CAA8D,CAAC,CAAC;IACtH,CAAC;IAEO,mDAAoB,GAA5B,UAA6B,UAAkB;QAC3C,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAC,IAAgB,IAAK,OAAA,IAAI,CAAC,aAAa,EAAE,KAAK,UAAU,EAAnC,CAAmC,CAAC,CAAC,MAAM,CAAC;IAC/F,CAAC;IACL,2BAAC;AAAD,CAAC,AAxCD,IAwCC;AAxCY,oDAAoB"} |
| import { MethodToStub } from "./MethodToStub"; | ||
| export declare class MethodStubSetter<T, ResolveType = void, RejectType = Error> { | ||
| private methodToStub; | ||
| private static globalGroupIndex; | ||
| private groupIndex; | ||
| constructor(methodToStub: MethodToStub); | ||
| thenReturn(...rest: T[]): this; | ||
| thenThrow(...rest: Error[]): this; | ||
| thenCall(func: (...args: any[]) => any): this; | ||
| thenResolve(...rest: ResolveType[]): this; | ||
| thenReject(...rest: Error[]): this; | ||
| private thenDoNothing; | ||
| private convertToPropertyIfIsNotAFunction; | ||
| } |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var CallFunctionMethodStub_1 = require("./stub/CallFunctionMethodStub"); | ||
| var RejectPromiseMethodStub_1 = require("./stub/RejectPromiseMethodStub"); | ||
| var ResolvePromiseMethodStub_1 = require("./stub/ResolvePromiseMethodStub"); | ||
| var ReturnValueMethodStub_1 = require("./stub/ReturnValueMethodStub"); | ||
| var ThrowErrorMethodStub_1 = require("./stub/ThrowErrorMethodStub"); | ||
| var MethodStubSetter = (function () { | ||
| function MethodStubSetter(methodToStub) { | ||
| this.methodToStub = methodToStub; | ||
| this.groupIndex = ++MethodStubSetter.globalGroupIndex; | ||
| } | ||
| MethodStubSetter.prototype.thenReturn = function () { | ||
| var _this = this; | ||
| var rest = []; | ||
| for (var _i = 0; _i < arguments.length; _i++) { | ||
| rest[_i] = arguments[_i]; | ||
| } | ||
| this.convertToPropertyIfIsNotAFunction(); | ||
| rest.forEach(function (value) { | ||
| _this.methodToStub.methodStubCollection.add(new ReturnValueMethodStub_1.ReturnValueMethodStub(_this.groupIndex, _this.methodToStub.matchers, value)); | ||
| }); | ||
| return this; | ||
| }; | ||
| MethodStubSetter.prototype.thenThrow = function () { | ||
| var _this = this; | ||
| var rest = []; | ||
| for (var _i = 0; _i < arguments.length; _i++) { | ||
| rest[_i] = arguments[_i]; | ||
| } | ||
| this.convertToPropertyIfIsNotAFunction(); | ||
| rest.forEach(function (error) { | ||
| _this.methodToStub.methodStubCollection.add(new ThrowErrorMethodStub_1.ThrowErrorMethodStub(_this.groupIndex, _this.methodToStub.matchers, error)); | ||
| }); | ||
| return this; | ||
| }; | ||
| MethodStubSetter.prototype.thenCall = function (func) { | ||
| this.convertToPropertyIfIsNotAFunction(); | ||
| this.methodToStub.methodStubCollection.add(new CallFunctionMethodStub_1.CallFunctionMethodStub(this.groupIndex, this.methodToStub.matchers, func)); | ||
| return this; | ||
| }; | ||
| MethodStubSetter.prototype.thenResolve = function () { | ||
| var _this = this; | ||
| var rest = []; | ||
| for (var _i = 0; _i < arguments.length; _i++) { | ||
| rest[_i] = arguments[_i]; | ||
| } | ||
| this.convertToPropertyIfIsNotAFunction(); | ||
| if (rest.length === 0) { | ||
| rest.push(undefined); | ||
| } | ||
| rest.forEach(function (value) { | ||
| _this.methodToStub.methodStubCollection.add(new ResolvePromiseMethodStub_1.ResolvePromiseMethodStub(_this.groupIndex, _this.methodToStub.matchers, value)); | ||
| }); | ||
| return this; | ||
| }; | ||
| MethodStubSetter.prototype.thenReject = function () { | ||
| var _this = this; | ||
| var rest = []; | ||
| for (var _i = 0; _i < arguments.length; _i++) { | ||
| rest[_i] = arguments[_i]; | ||
| } | ||
| this.convertToPropertyIfIsNotAFunction(); | ||
| if (rest.length === 0) { | ||
| rest.push(new Error("mocked '" + this.methodToStub.name + "' rejected")); | ||
| } | ||
| rest.forEach(function (value) { | ||
| _this.methodToStub.methodStubCollection.add(new RejectPromiseMethodStub_1.RejectPromiseMethodStub(_this.groupIndex, _this.methodToStub.matchers, value)); | ||
| }); | ||
| return this; | ||
| }; | ||
| MethodStubSetter.prototype.thenDoNothing = function () { | ||
| var rest = []; | ||
| for (var _i = 0; _i < arguments.length; _i++) { | ||
| rest[_i] = arguments[_i]; | ||
| } | ||
| this.convertToPropertyIfIsNotAFunction(); | ||
| return this; | ||
| }; | ||
| MethodStubSetter.prototype.convertToPropertyIfIsNotAFunction = function () { | ||
| if (!this.methodToStub.methodStubCollection) { | ||
| var info = this.methodToStub("__tsMockitoGetInfo"); | ||
| delete info.mocker.mock[info.key]; | ||
| delete info.mocker.instance[info.key]; | ||
| info.mocker.createPropertyStub(info.key); | ||
| info.mocker.createInstancePropertyDescriptorListener(info.key, {}, undefined); | ||
| info.mocker.createInstanceActionListener(info.key, undefined); | ||
| this.methodToStub = info.mocker.mock[info.key]; | ||
| } | ||
| }; | ||
| MethodStubSetter.globalGroupIndex = 0; | ||
| return MethodStubSetter; | ||
| }()); | ||
| exports.MethodStubSetter = MethodStubSetter; | ||
| //# sourceMappingURL=MethodStubSetter.js.map |
| {"version":3,"file":"MethodStubSetter.js","sourceRoot":"","sources":["../src/MethodStubSetter.ts"],"names":[],"mappings":";;AACA,wEAAqE;AACrE,0EAA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,CAAC,iCAAiC,EAAE,CAAC;QACzC,OAAO,IAAI,CAAC;IAChB,CAAC;IAEO,4DAAiC,GAAzC;QACI,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,oBAAoB,EAAE;YACzC,IAAM,IAAI,GAAI,IAAI,CAAC,YAAoB,CAAC,oBAAoB,CAAC,CAAC;YAC9D,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAClC,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAEtC,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACzC,IAAI,CAAC,MAAM,CAAC,wCAAwC,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC;YAC9E,IAAI,CAAC,MAAM,CAAC,4BAA4B,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;YAC9D,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SAClD;IACL,CAAC;IArEc,iCAAgB,GAAW,CAAC,CAAC;IAsEhD,uBAAC;CAAA,AAvED,IAuEC;AAvEY,4CAAgB"} |
| import { MethodToStub } from "./MethodToStub"; | ||
| export declare class MethodStubVerificator<T> { | ||
| private methodToVerify; | ||
| private methodCallToStringConverter; | ||
| constructor(methodToVerify: MethodToStub); | ||
| called(): void; | ||
| never(): void; | ||
| once(): void; | ||
| twice(): void; | ||
| thrice(): void; | ||
| times(value: number): void; | ||
| atLeast(value: number): void; | ||
| atMost(value: number): void; | ||
| calledBefore(method: any): void; | ||
| calledAfter(method: any): void; | ||
| } |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var MethodCallToStringConverter_1 = require("./utils/MethodCallToStringConverter"); | ||
| var MethodStubVerificator = (function () { | ||
| function MethodStubVerificator(methodToVerify) { | ||
| this.methodToVerify = methodToVerify; | ||
| this.methodCallToStringConverter = new MethodCallToStringConverter_1.MethodCallToStringConverter(); | ||
| } | ||
| MethodStubVerificator.prototype.called = function () { | ||
| this.atLeast(1); | ||
| }; | ||
| MethodStubVerificator.prototype.never = function () { | ||
| this.times(0); | ||
| }; | ||
| MethodStubVerificator.prototype.once = function () { | ||
| this.times(1); | ||
| }; | ||
| MethodStubVerificator.prototype.twice = function () { | ||
| this.times(2); | ||
| }; | ||
| MethodStubVerificator.prototype.thrice = function () { | ||
| this.times(3); | ||
| }; | ||
| MethodStubVerificator.prototype.times = function (value) { | ||
| var allMatchingActions = this.methodToVerify.mocker.getAllMatchingActions(this.methodToVerify.name, this.methodToVerify.matchers); | ||
| if (value !== allMatchingActions.length) { | ||
| var methodToVerifyAsString = this.methodCallToStringConverter.convert(this.methodToVerify); | ||
| throw new Error("Expected \"" + methodToVerifyAsString + "to be called " + value + " time(s). But has been called " + allMatchingActions.length + " time(s)."); | ||
| } | ||
| }; | ||
| MethodStubVerificator.prototype.atLeast = function (value) { | ||
| var allMatchingActions = this.methodToVerify.mocker.getAllMatchingActions(this.methodToVerify.name, this.methodToVerify.matchers); | ||
| if (value > allMatchingActions.length) { | ||
| var methodToVerifyAsString = this.methodCallToStringConverter.convert(this.methodToVerify); | ||
| throw new Error("Expected \"" + methodToVerifyAsString + "to be called at least " + value + " time(s). But has been called " + allMatchingActions.length + " time(s)."); | ||
| } | ||
| }; | ||
| MethodStubVerificator.prototype.atMost = function (value) { | ||
| var allMatchingActions = this.methodToVerify.mocker.getAllMatchingActions(this.methodToVerify.name, this.methodToVerify.matchers); | ||
| if (value < allMatchingActions.length) { | ||
| var methodToVerifyAsString = this.methodCallToStringConverter.convert(this.methodToVerify); | ||
| throw new Error("Expected \"" + methodToVerifyAsString + "to be called at least " + value + " time(s). But has been called " + allMatchingActions.length + " time(s)."); | ||
| } | ||
| }; | ||
| MethodStubVerificator.prototype.calledBefore = function (method) { | ||
| var firstMethodAction = this.methodToVerify.mocker.getFirstMatchingAction(this.methodToVerify.name, this.methodToVerify.matchers); | ||
| var secondMethodAction = method.mocker.getFirstMatchingAction(method.name, method.matchers); | ||
| var mainMethodToVerifyAsString = this.methodCallToStringConverter.convert(this.methodToVerify); | ||
| var secondMethodAsString = this.methodCallToStringConverter.convert(method); | ||
| var errorBeginning = "Expected \"" + mainMethodToVerifyAsString + " to be called before " + secondMethodAsString; | ||
| if (firstMethodAction && secondMethodAction) { | ||
| if (!firstMethodAction.hasBeenCalledBefore(secondMethodAction)) { | ||
| throw new Error(errorBeginning + "but has been called after."); | ||
| } | ||
| } | ||
| else if (firstMethodAction && !secondMethodAction) { | ||
| throw new Error(errorBeginning + "but " + secondMethodAsString + "has never been called."); | ||
| } | ||
| else if (!firstMethodAction && secondMethodAction) { | ||
| throw new Error(errorBeginning + "but " + mainMethodToVerifyAsString + "has never been called."); | ||
| } | ||
| else { | ||
| throw new Error(errorBeginning + "but none of them has been called."); | ||
| } | ||
| }; | ||
| MethodStubVerificator.prototype.calledAfter = function (method) { | ||
| var firstMethodAction = this.methodToVerify.mocker.getFirstMatchingAction(this.methodToVerify.name, this.methodToVerify.matchers); | ||
| var secondMethodAction = method.mocker.getFirstMatchingAction(method.name, method.matchers); | ||
| var mainMethodToVerifyAsString = this.methodCallToStringConverter.convert(this.methodToVerify); | ||
| var secondMethodAsString = this.methodCallToStringConverter.convert(method); | ||
| var errorBeginning = "Expected \"" + mainMethodToVerifyAsString + "to be called after " + secondMethodAsString; | ||
| if (firstMethodAction && secondMethodAction) { | ||
| if (firstMethodAction.hasBeenCalledBefore(secondMethodAction)) { | ||
| throw new Error(errorBeginning + "but has been called before."); | ||
| } | ||
| } | ||
| else if (firstMethodAction && !secondMethodAction) { | ||
| throw new Error(errorBeginning + "but " + secondMethodAsString + "has never been called."); | ||
| } | ||
| else if (!firstMethodAction && secondMethodAction) { | ||
| throw new Error(errorBeginning + "but " + mainMethodToVerifyAsString + "has never been called."); | ||
| } | ||
| else { | ||
| throw new Error(errorBeginning + "but none of them has been called."); | ||
| } | ||
| }; | ||
| return MethodStubVerificator; | ||
| }()); | ||
| exports.MethodStubVerificator = MethodStubVerificator; | ||
| //# sourceMappingURL=MethodStubVerificator.js.map |
| {"version":3,"file":"MethodStubVerificator.js","sourceRoot":"","sources":["../src/MethodStubVerificator.ts"],"names":[],"mappings":";;AACA,mFAAgF;AAEhF;IAGI,+BAAoB,cAA4B;QAA5B,mBAAc,GAAd,cAAc,CAAc;QAFxC,gCAA2B,GAAgC,IAAI,yDAA2B,EAAE,CAAC;IAIrG,CAAC;IAEM,sCAAM,GAAb;QACI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;IAEM,qCAAK,GAAZ;QACI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAEM,oCAAI,GAAX;QACI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAEM,qCAAK,GAAZ;QACI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAEM,sCAAM,GAAb;QACI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAEM,qCAAK,GAAZ,UAAa,KAAa;QACtB,IAAM,kBAAkB,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,qBAAqB,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QACpI,IAAI,KAAK,KAAK,kBAAkB,CAAC,MAAM,EAAE;YACrC,IAAM,sBAAsB,GAAG,IAAI,CAAC,2BAA2B,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YAC7F,MAAM,IAAI,KAAK,CAAC,gBAAa,sBAAsB,qBAAgB,KAAK,sCAAiC,kBAAkB,CAAC,MAAM,cAAW,CAAC,CAAC;SACl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AAC,MAAM,CAAC,CAAC;QAC9E,IAAM,cAAc,GAAG,gBAAa,0BAA0B,2BAAsB,oBAAsB,CAAC;QAE3G,IAAI,iBAAiB,IAAI,kBAAkB,EAAE;YACzC,IAAI,iBAAiB,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,EAAE;gBAC3D,MAAM,IAAI,KAAK,CAAI,cAAc,gCAA6B,CAAC,CAAC;aACnE;SACJ;aAAM,IAAI,iBAAiB,IAAI,CAAC,kBAAkB,EAAE;YACjD,MAAM,IAAI,KAAK,CAAI,cAAc,YAAO,oBAAoB,2BAAwB,CAAC,CAAC;SACzF;aAAM,IAAI,CAAC,iBAAiB,IAAI,kBAAkB,EAAE;YACjD,MAAM,IAAI,KAAK,CAAI,cAAc,YAAO,0BAA0B,2BAAwB,CAAC,CAAC;SAC/F;aAAM;YACH,MAAM,IAAI,KAAK,CAAI,cAAc,sCAAmC,CAAC,CAAC;SACzE;IACL,CAAC;IACL,4BAAC;AAAD,CAAC,AA1FD,IA0FC;AA1FY,sDAAqB"} |
| import { Matcher } from "./matcher/type/Matcher"; | ||
| import { MethodStubCollection } from "./MethodStubCollection"; | ||
| import { Mocker } from "./Mock"; | ||
| export declare class MethodToStub { | ||
| methodStubCollection: MethodStubCollection; | ||
| matchers: Matcher[]; | ||
| mocker: Mocker; | ||
| name: string; | ||
| constructor(methodStubCollection: MethodStubCollection, matchers: Matcher[], mocker: Mocker, name: string); | ||
| } |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var MethodToStub = (function () { | ||
| function MethodToStub(methodStubCollection, matchers, mocker, name) { | ||
| this.methodStubCollection = methodStubCollection; | ||
| this.matchers = matchers; | ||
| this.mocker = mocker; | ||
| this.name = name; | ||
| } | ||
| return MethodToStub; | ||
| }()); | ||
| exports.MethodToStub = MethodToStub; | ||
| //# sourceMappingURL=MethodToStub.js.map |
| {"version":3,"file":"MethodToStub.js","sourceRoot":"","sources":["../src/MethodToStub.ts"],"names":[],"mappings":";;AAIA;IACI,sBAAmB,oBAA0C,EAC1C,QAAmB,EACnB,MAAc,EACd,IAAY;QAHZ,yBAAoB,GAApB,oBAAoB,CAAsB;QAC1C,aAAQ,GAAR,QAAQ,CAAW;QACnB,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAQ;IAC/B,CAAC;IACL,mBAAC;AAAD,CAAC,AAND,IAMC;AANY,oCAAY"} |
| import { Matcher } from "./matcher/type/Matcher"; | ||
| import { MethodAction } from "./MethodAction"; | ||
| import { MethodStub } from "./stub/MethodStub"; | ||
| import { ObjectInspector } from "./utils/ObjectInspector"; | ||
| export declare class Mocker { | ||
| private clazz; | ||
| instance: any; | ||
| mock: any; | ||
| protected objectInspector: ObjectInspector; | ||
| private methodStubCollections; | ||
| private methodActions; | ||
| private mockableFunctionsFinder; | ||
| private objectPropertyCodeRetriever; | ||
| private excludedPropertyNames; | ||
| constructor(clazz: any, instance?: any); | ||
| getMock(): any; | ||
| createCatchAllHandlerForRemainingPropertiesWithoutGetters(): any; | ||
| reset(): void; | ||
| resetCalls(): void; | ||
| getAllMatchingActions(methodName: string, matchers: Array<Matcher>): Array<MethodAction>; | ||
| getFirstMatchingAction(methodName: string, matchers: Array<Matcher>): MethodAction; | ||
| getActionsByName(name: string): MethodAction[]; | ||
| protected processProperties(object: any): void; | ||
| protected createInstancePropertyDescriptorListener(key: string, descriptor: PropertyDescriptor, prototype: any): void; | ||
| protected createInstanceActionListener(key: string, prototype: any): void; | ||
| protected createActionListener(key: string): () => any; | ||
| protected getEmptyMethodStub(key: string, args: any[]): MethodStub; | ||
| private processClassCode; | ||
| private processFunctionsCode; | ||
| private createPropertyStub; | ||
| private createMethodStub; | ||
| private createMethodToStub; | ||
| private getMethodStub; | ||
| } |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var _ = require("lodash"); | ||
| var Matcher_1 = require("./matcher/type/Matcher"); | ||
| var MethodAction_1 = require("./MethodAction"); | ||
| var MethodStubCollection_1 = require("./MethodStubCollection"); | ||
| var MethodToStub_1 = require("./MethodToStub"); | ||
| var ReturnValueMethodStub_1 = require("./stub/ReturnValueMethodStub"); | ||
| var ts_mockito_1 = require("./ts-mockito"); | ||
| var MockableFunctionsFinder_1 = require("./utils/MockableFunctionsFinder"); | ||
| var ObjectInspector_1 = require("./utils/ObjectInspector"); | ||
| var ObjectPropertyCodeRetriever_1 = require("./utils/ObjectPropertyCodeRetriever"); | ||
| var Mocker = (function () { | ||
| function Mocker(clazz, instance) { | ||
| if (instance === void 0) { instance = {}; } | ||
| var _this = this; | ||
| this.clazz = clazz; | ||
| this.instance = instance; | ||
| this.mock = {}; | ||
| this.objectInspector = new ObjectInspector_1.ObjectInspector(); | ||
| this.methodStubCollections = {}; | ||
| this.methodActions = []; | ||
| this.mockableFunctionsFinder = new MockableFunctionsFinder_1.MockableFunctionsFinder(); | ||
| this.objectPropertyCodeRetriever = new ObjectPropertyCodeRetriever_1.ObjectPropertyCodeRetriever(); | ||
| this.excludedPropertyNames = ["hasOwnProperty"]; | ||
| this.mock.__tsmockitoInstance = this.instance; | ||
| this.mock.__tsmockitoMocker = this; | ||
| if (_.isObject(this.clazz) && _.isObject(this.instance)) { | ||
| this.processProperties(this.clazz.prototype); | ||
| this.processClassCode(this.clazz); | ||
| this.processFunctionsCode(this.clazz.prototype); | ||
| } | ||
| if (typeof Proxy !== "undefined" && this.clazz) { | ||
| this.mock.__tsmockitoInstance = new Proxy(this.instance, this.createCatchAllHandlerForRemainingPropertiesWithoutGetters()); | ||
| } | ||
| else if (typeof Proxy !== "undefined" && !this.clazz) { | ||
| this.instance = new Proxy(this.instance, { | ||
| get: function (target, name) { | ||
| if (_this.excludedPropertyNames.indexOf(name.toString()) >= 0) { | ||
| return target[name]; | ||
| } | ||
| var hasMethodStub = name in target; | ||
| if (!hasMethodStub) { | ||
| return _this.createActionListener(name.toString()); | ||
| } | ||
| return target[name]; | ||
| }, | ||
| }); | ||
| this.mock.__tsmockitoInstance = this.instance; | ||
| } | ||
| } | ||
| Mocker.prototype.getMock = function () { | ||
| var _this = this; | ||
| if (typeof Proxy === "undefined") { | ||
| return this.mock; | ||
| } | ||
| if (typeof Proxy !== "undefined" && this.clazz) { | ||
| return new Proxy(this.mock, this.createCatchAllHandlerForRemainingPropertiesWithoutGetters()); | ||
| } | ||
| return new Proxy(this.mock, { | ||
| get: function (target, name) { | ||
| var hasProp = name in target; | ||
| if (hasProp) { | ||
| return target[name]; | ||
| } | ||
| var hasMethodStub = name in target; | ||
| if (!hasMethodStub) { | ||
| _this.createMethodStub(name.toString()); | ||
| _this.createInstanceActionListener(name.toString(), {}); | ||
| } | ||
| return _this.mock[name.toString()]; | ||
| }, | ||
| }); | ||
| }; | ||
| Mocker.prototype.createCatchAllHandlerForRemainingPropertiesWithoutGetters = function () { | ||
| var _this = this; | ||
| return { | ||
| get: function (target, name) { | ||
| var hasMethodStub = name in target; | ||
| if (!hasMethodStub) { | ||
| _this.createPropertyStub(name.toString()); | ||
| _this.createInstancePropertyDescriptorListener(name.toString(), {}, _this.clazz.prototype); | ||
| } | ||
| return target[name]; | ||
| }, | ||
| }; | ||
| }; | ||
| Mocker.prototype.reset = function () { | ||
| this.methodStubCollections = {}; | ||
| this.methodActions = []; | ||
| }; | ||
| Mocker.prototype.resetCalls = function () { | ||
| this.methodActions = []; | ||
| }; | ||
| Mocker.prototype.getAllMatchingActions = function (methodName, matchers) { | ||
| var result = []; | ||
| this.methodActions.forEach(function (item) { | ||
| if (item.isApplicable(methodName, matchers)) { | ||
| result.push(item); | ||
| } | ||
| }); | ||
| return result; | ||
| }; | ||
| Mocker.prototype.getFirstMatchingAction = function (methodName, matchers) { | ||
| return this.getAllMatchingActions(methodName, matchers)[0]; | ||
| }; | ||
| Mocker.prototype.getActionsByName = function (name) { | ||
| return this.methodActions.filter(function (action) { return action.methodName === name; }); | ||
| }; | ||
| Mocker.prototype.processProperties = function (object) { | ||
| var _this = this; | ||
| this.objectInspector.getObjectPrototypes(object).forEach(function (obj) { | ||
| _this.objectInspector.getObjectOwnPropertyNames(obj).forEach(function (name) { | ||
| if (_this.excludedPropertyNames.indexOf(name) >= 0) { | ||
| return; | ||
| } | ||
| var descriptor = Object.getOwnPropertyDescriptor(obj, name); | ||
| if (descriptor.get) { | ||
| _this.createPropertyStub(name); | ||
| _this.createInstancePropertyDescriptorListener(name, descriptor, obj); | ||
| _this.createInstanceActionListener(name, obj); | ||
| } | ||
| else if (typeof descriptor.value === "function") { | ||
| _this.createMethodStub(name); | ||
| _this.createInstanceActionListener(name, obj); | ||
| } | ||
| else { | ||
| } | ||
| }); | ||
| }); | ||
| }; | ||
| Mocker.prototype.createInstancePropertyDescriptorListener = function (key, descriptor, prototype) { | ||
| if (this.instance.hasOwnProperty(key)) { | ||
| return; | ||
| } | ||
| Object.defineProperty(this.instance, key, { | ||
| get: this.createActionListener(key), | ||
| }); | ||
| }; | ||
| Mocker.prototype.createInstanceActionListener = function (key, prototype) { | ||
| if (this.instance.hasOwnProperty(key)) { | ||
| return; | ||
| } | ||
| this.instance[key] = this.createActionListener(key); | ||
| }; | ||
| Mocker.prototype.createActionListener = function (key) { | ||
| var _this = this; | ||
| return function () { | ||
| var args = []; | ||
| for (var _i = 0; _i < arguments.length; _i++) { | ||
| args[_i] = arguments[_i]; | ||
| } | ||
| var action = new MethodAction_1.MethodAction(key, args); | ||
| _this.methodActions.push(action); | ||
| var methodStub = _this.getMethodStub(key, args); | ||
| methodStub.execute(args); | ||
| return methodStub.getValue(); | ||
| }; | ||
| }; | ||
| Mocker.prototype.getEmptyMethodStub = function (key, args) { | ||
| return new ReturnValueMethodStub_1.ReturnValueMethodStub(-1, [], null); | ||
| }; | ||
| Mocker.prototype.processClassCode = function (clazz) { | ||
| var _this = this; | ||
| var classCode = typeof clazz.toString !== "undefined" ? clazz.toString() : ""; | ||
| var functionNames = this.mockableFunctionsFinder.find(classCode); | ||
| functionNames.forEach(function (functionName) { | ||
| _this.createMethodStub(functionName); | ||
| _this.createInstanceActionListener(functionName, _this.clazz.prototype); | ||
| }); | ||
| }; | ||
| Mocker.prototype.processFunctionsCode = function (object) { | ||
| var _this = this; | ||
| this.objectInspector.getObjectPrototypes(object).forEach(function (obj) { | ||
| _this.objectInspector.getObjectOwnPropertyNames(obj).forEach(function (propertyName) { | ||
| var functionNames = _this.mockableFunctionsFinder.find(_this.objectPropertyCodeRetriever.get(obj, propertyName)); | ||
| functionNames.forEach(function (functionName) { | ||
| _this.createMethodStub(functionName); | ||
| _this.createInstanceActionListener(functionName, _this.clazz.prototype); | ||
| }); | ||
| }); | ||
| }); | ||
| }; | ||
| Mocker.prototype.createPropertyStub = function (key) { | ||
| if (this.mock.hasOwnProperty(key)) { | ||
| return; | ||
| } | ||
| Object.defineProperty(this.mock, key, { | ||
| get: this.createMethodToStub(key), | ||
| }); | ||
| }; | ||
| Mocker.prototype.createMethodStub = function (key) { | ||
| if (this.mock.hasOwnProperty(key)) { | ||
| return; | ||
| } | ||
| this.mock[key] = this.createMethodToStub(key); | ||
| }; | ||
| Mocker.prototype.createMethodToStub = function (key) { | ||
| var _this = this; | ||
| return function () { | ||
| var args = []; | ||
| for (var _i = 0; _i < arguments.length; _i++) { | ||
| args[_i] = arguments[_i]; | ||
| } | ||
| if (args.length === 1 && args[0] === "__tsMockitoGetInfo") { | ||
| return { | ||
| key: key, | ||
| mocker: _this, | ||
| }; | ||
| } | ||
| if (!_this.methodStubCollections[key]) { | ||
| _this.methodStubCollections[key] = new MethodStubCollection_1.MethodStubCollection(); | ||
| } | ||
| var matchers = []; | ||
| for (var _a = 0, args_1 = args; _a < args_1.length; _a++) { | ||
| var arg = args_1[_a]; | ||
| if (!(arg instanceof Matcher_1.Matcher)) { | ||
| matchers.push(ts_mockito_1.strictEqual(arg)); | ||
| } | ||
| else { | ||
| matchers.push(arg); | ||
| } | ||
| } | ||
| return new MethodToStub_1.MethodToStub(_this.methodStubCollections[key], matchers, _this, key); | ||
| }; | ||
| }; | ||
| Mocker.prototype.getMethodStub = function (key, args) { | ||
| var methodStub = this.methodStubCollections[key]; | ||
| if (methodStub && methodStub.hasMatchingInAnyGroup(args)) { | ||
| var groupIndex = methodStub.getLastMatchingGroupIndex(args); | ||
| return methodStub.getFirstMatchingFromGroupAndRemoveIfNotLast(groupIndex, args); | ||
| } | ||
| else { | ||
| return this.getEmptyMethodStub(key, args); | ||
| } | ||
| }; | ||
| return Mocker; | ||
| }()); | ||
| exports.Mocker = Mocker; | ||
| //# sourceMappingURL=Mock.js.map |
| {"version":3,"file":"Mock.js","sourceRoot":"","sources":["../src/Mock.ts"],"names":[],"mappings":";;AAAA,0BAA4B;AAC5B,kDAA+C;AAC/C,+CAA4C;AAC5C,+DAA4D;AAC5D,+CAA4C;AAE5C,sEAAmE;AACnE,2CAAyC;AACzC,2EAAwE;AACxE,2DAAwD;AACxD,mFAAgF;AAEhF;IASI,gBAAoB,KAAU,EAAS,QAAkB;QAAlB,yBAAA,EAAA,aAAkB;QAAzD,iBA2BC;QA3BmB,UAAK,GAAL,KAAK,CAAK;QAAS,aAAQ,GAAR,QAAQ,CAAU;QARlD,SAAI,GAAQ,EAAE,CAAC;QACZ,oBAAe,GAAG,IAAI,iCAAe,EAAE,CAAC;QAC1C,0BAAqB,GAAQ,EAAE,CAAC;QAChC,kBAAa,GAAmB,EAAE,CAAC;QACnC,4BAAuB,GAAG,IAAI,iDAAuB,EAAE,CAAC;QACxD,gCAA2B,GAAG,IAAI,yDAA2B,EAAE,CAAC;QAChE,0BAAqB,GAAa,CAAC,gBAAgB,CAAC,CAAC;QAGzD,IAAI,CAAC,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9C,IAAI,CAAC,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;QACnC,IAAI,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YACrD,IAAI,CAAC,iBAAi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B,IAAM,GAAG,aAAA;gBACV,IAAI,CAAC,CAAC,GAAG,YAAY,iBAAO,CAAC,EAAE;oBAC3B,QAAQ,CAAC,IAAI,CAAC,wBAAW,CAAC,GAAG,CAAC,CAAC,CAAC;iBACnC;qBAAM;oBACH,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;iBACtB;aACJ;YAED,OAAO,IAAI,2BAAY,CAAC,KAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,KAAI,EAAE,GAAG,CAAC,CAAC;QAClF,CAAC,CAAC;IACN,CAAC;IAEO,8BAAa,GAArB,UAAsB,GAAW,EAAE,IAAW;QAC1C,IAAM,UAAU,GAAyB,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC;QACzE,IAAI,UAAU,IAAI,UAAU,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAAE;YACtD,IAAM,UAAU,GAAG,UAAU,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC;YAC9D,OAAO,UAAU,CAAC,2CAA2C,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;SACnF;aAAM;YACH,OAAO,IAAI,CAAC,kBAAkB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;SAC7C;IACL,CAAC;IACL,aAAC;AAAD,CAAC,AAxOD,IAwOC;AAxOY,wBAAM"} |
| import { Mocker } from "./Mock"; | ||
| import { MethodStub } from "./stub/MethodStub"; | ||
| export declare class Spy extends Mocker { | ||
| private realMethods; | ||
| constructor(instance: any); | ||
| reset(): void; | ||
| protected getEmptyMethodStub(key: string, args: any[]): MethodStub; | ||
| protected createInstancePropertyDescriptorListener(key: string, descriptor: PropertyDescriptor, prototype: any): void; | ||
| protected createInstanceActionListener(key: string, prototype: any): void; | ||
| } |
| "use strict"; | ||
| var __extends = (this && this.__extends) || (function () { | ||
| var extendStatics = Object.setPrototypeOf || | ||
| ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
| function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
| return function (d, b) { | ||
| extendStatics(d, b); | ||
| function __() { this.constructor = d; } | ||
| d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
| }; | ||
| })(); | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var _ = require("lodash"); | ||
| var Mock_1 = require("./Mock"); | ||
| var RealMethod_1 = require("./spy/RealMethod"); | ||
| var CallThroughMethodStub_1 = require("./stub/CallThroughMethodStub"); | ||
| var Spy = (function (_super) { | ||
| __extends(Spy, _super); | ||
| function Spy(instance) { | ||
| var _this = _super.call(this, instance.constructor, instance) || this; | ||
| if (_.isObject(instance)) { | ||
| _this.processProperties(instance); | ||
| } | ||
| return _this; | ||
| } | ||
| Spy.prototype.reset = function () { | ||
| var _this = this; | ||
| _.forEach(this.realMethods, function (method, key) { | ||
| if (method.instance) { | ||
| Object.defineProperty(_this.instance, key, method.descriptor); | ||
| } | ||
| else { | ||
| delete _this.instance[key]; | ||
| } | ||
| }); | ||
| _super.prototype.reset.call(this); | ||
| }; | ||
| Spy.prototype.getEmptyMethodStub = function (key, args) { | ||
| var realMethod = this.realMethods[key]; | ||
| if (realMethod) { | ||
| var method = realMethod.descriptor.get || realMethod.descriptor.value; | ||
| return new CallThroughMethodStub_1.CallThroughMethodStub(this.instance, method); | ||
| } | ||
| return _super.prototype.getEmptyMethodStub.call(this, key, args); | ||
| }; | ||
| Spy.prototype.createInstancePropertyDescriptorListener = function (key, descriptor, prototype) { | ||
| if (!this.realMethods) { | ||
| this.realMethods = {}; | ||
| } | ||
| if (this.realMethods[key]) { | ||
| return; | ||
| } | ||
| this.realMethods[key] = new RealMethod_1.RealMethod(descriptor, prototype === this.instance); | ||
| Object.defineProperty(this.instance, key, { | ||
| get: this.createActionListener(key), | ||
| configurable: true, | ||
| }); | ||
| }; | ||
| Spy.prototype.createInstanceActionListener = function (key, prototype) { | ||
| if (!this.realMethods) { | ||
| this.realMethods = {}; | ||
| } | ||
| if (this.realMethods[key]) { | ||
| return; | ||
| } | ||
| var descriptor = Object.getOwnPropertyDescriptor(prototype, key); | ||
| this.realMethods[key] = new RealMethod_1.RealMethod(descriptor, prototype === this.instance); | ||
| this.instance[key] = this.createActionListener(key); | ||
| }; | ||
| return Spy; | ||
| }(Mock_1.Mocker)); | ||
| exports.Spy = Spy; | ||
| //# sourceMappingURL=Spy.js.map |
| {"version":3,"file":"Spy.js","sourceRoot":"","sources":["../src/Spy.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0BAA4B;AAC5B,+BAA8B;AAC9B,+CAA4C;AAC5C,sEAAmE;AAGnE;IAAyB,uBAAM;IAG3B,aAAY,QAAa;QAAzB,YACI,kBAAM,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,SAKxC;QAHG,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;YACtB,KAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;SACpC;;IACL,CAAC;IAEM,mBAAK,GAAZ;QAAA,iBAUC;QATG,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,UAAC,MAAM,EAAE,GAAG;YACpC,IAAI,MAAM,CAAC,QAAQ,EAAE;gBACjB,MAAM,CAAC,cAAc,CAAC,KAAI,CAAC,QAAQ,EAAE,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;aAChE;iBAAM;gBACH,OAAO,KAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;aAC7B;QACL,CAAC,CAAC,CAAC;QAEH,iBAAM,KAAK,WAAE,CAAC;IAClB,CAAC;IAES,gCAAkB,GAA5B,UAA6B,GAAW,EAAE,IAAW;QACjD,IAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAEzC,IAAI,UAAU,EAAE;YACZ,IAAM,MAAM,GAAG,UAAU,CAAC,UAAU,CAAC,GAAG,IAAI,UAAU,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;AAAD,CAAC,AAjED,CAAyB,aAAM,GAiE9B;AAjEY,kBAAG"} |
| export declare class RealMethod { | ||
| descriptor: PropertyDescriptor; | ||
| instance: boolean; | ||
| constructor(descriptor: PropertyDescriptor, instance: boolean); | ||
| } |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var RealMethod = (function () { | ||
| function RealMethod(descriptor, instance) { | ||
| this.descriptor = descriptor; | ||
| this.instance = instance; | ||
| } | ||
| return RealMethod; | ||
| }()); | ||
| exports.RealMethod = RealMethod; | ||
| //# sourceMappingURL=RealMethod.js.map |
| {"version":3,"file":"RealMethod.js","sourceRoot":"","sources":["../../src/spy/RealMethod.ts"],"names":[],"mappings":";;AAAA;IACI,oBAAmB,UAA8B,EAC9B,QAAiB;QADjB,eAAU,GAAV,UAAU,CAAoB;QAC9B,aAAQ,GAAR,QAAQ,CAAS;IAAG,CAAC;IAC5C,iBAAC;AAAD,CAAC,AAHD,IAGC;AAHY,gCAAU"} |
| export declare abstract class AbstractMethodStub { | ||
| protected groupIndex: number; | ||
| getGroupIndex(): number; | ||
| } |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var AbstractMethodStub = (function () { | ||
| function AbstractMethodStub() { | ||
| } | ||
| AbstractMethodStub.prototype.getGroupIndex = function () { | ||
| return this.groupIndex; | ||
| }; | ||
| return AbstractMethodStub; | ||
| }()); | ||
| exports.AbstractMethodStub = AbstractMethodStub; | ||
| //# sourceMappingURL=AbstractMethodStub.js.map |
| {"version":3,"file":"AbstractMethodStub.js","sourceRoot":"","sources":["../../src/stub/AbstractMethodStub.ts"],"names":[],"mappings":";;AAAA;IAAA;IAMA,CAAC;IAHU,0CAAa,GAApB;QACI,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IACL,yBAAC;AAAD,CAAC,AAND,IAMC;AANqB,gDAAkB"} |
| import { Matcher } from "../matcher/type/Matcher"; | ||
| import { AbstractMethodStub } from "./AbstractMethodStub"; | ||
| import { MethodStub } from "./MethodStub"; | ||
| export declare class CallFunctionMethodStub extends AbstractMethodStub implements MethodStub { | ||
| protected groupIndex: number; | ||
| private matchers; | ||
| private func; | ||
| private validator; | ||
| private functionResult; | ||
| constructor(groupIndex: number, matchers: Array<Matcher>, func: any); | ||
| isApplicable(args: any[]): boolean; | ||
| execute(args: any[]): void; | ||
| getValue(): any; | ||
| } |
| "use strict"; | ||
| var __extends = (this && this.__extends) || (function () { | ||
| var extendStatics = Object.setPrototypeOf || | ||
| ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
| function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
| return function (d, b) { | ||
| extendStatics(d, b); | ||
| function __() { this.constructor = d; } | ||
| d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
| }; | ||
| })(); | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var ArgsToMatchersValidator_1 = require("../matcher/ArgsToMatchersValidator"); | ||
| var AbstractMethodStub_1 = require("./AbstractMethodStub"); | ||
| var CallFunctionMethodStub = (function (_super) { | ||
| __extends(CallFunctionMethodStub, _super); | ||
| function CallFunctionMethodStub(groupIndex, matchers, func) { | ||
| var _this = _super.call(this) || this; | ||
| _this.groupIndex = groupIndex; | ||
| _this.matchers = matchers; | ||
| _this.func = func; | ||
| _this.validator = new ArgsToMatchersValidator_1.ArgsToMatchersValidator(); | ||
| return _this; | ||
| } | ||
| CallFunctionMethodStub.prototype.isApplicable = function (args) { | ||
| return this.validator.validate(this.matchers, args); | ||
| }; | ||
| CallFunctionMethodStub.prototype.execute = function (args) { | ||
| this.functionResult = this.func.apply(this, args); | ||
| }; | ||
| CallFunctionMethodStub.prototype.getValue = function () { | ||
| return this.functionResult; | ||
| }; | ||
| return CallFunctionMethodStub; | ||
| }(AbstractMethodStub_1.AbstractMethodStub)); | ||
| exports.CallFunctionMethodStub = CallFunctionMethodStub; | ||
| //# sourceMappingURL=CallFunctionMethodStub.js.map |
| {"version":3,"file":"CallFunctionMethodStub.js","sourceRoot":"","sources":["../../src/stub/CallFunctionMethodStub.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8EAA2E;AAE3E,2DAAwD;AAGxD;IAA4C,0CAAkB;IAI1D,gCAAsB,UAAkB,EAAU,QAAwB,EAAU,IAAS;QAA7F,YACI,iBAAO,SACV;QAFqB,gBAAU,GAAV,UAAU,CAAQ;QAAU,cAAQ,GAAR,QAAQ,CAAgB;QAAU,UAAI,GAAJ,IAAI,CAAK;QAHrF,eAAS,GAA4B,IAAI,iDAAuB,EAAE,CAAC;;IAK3E,CAAC;IAEM,6CAAY,GAAnB,UAAoB,IAAW;QAC3B,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACxD,CAAC;IAEM,wCAAO,GAAd,UAAe,IAAW;QACtB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,IAAI,OAAT,IAAI,EAAS,IAAI,CAAC,CAAC;IAC7C,CAAC;IAEM,yCAAQ,GAAf;QACI,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IACL,6BAAC;AAAD,CAAC,AAnBD,CAA4C,uCAAkB,GAmB7D;AAnBY,wDAAsB"} |
| import { MethodStub } from "./MethodStub"; | ||
| export declare class CallThroughMethodStub implements MethodStub { | ||
| private instance; | ||
| private method; | ||
| private result; | ||
| constructor(instance: any, method: Function); | ||
| getGroupIndex(): number; | ||
| isApplicable(args: any[]): boolean; | ||
| execute(args: any[]): void; | ||
| getValue(): any; | ||
| } |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var CallThroughMethodStub = (function () { | ||
| function CallThroughMethodStub(instance, method) { | ||
| this.instance = instance; | ||
| this.method = method; | ||
| } | ||
| CallThroughMethodStub.prototype.getGroupIndex = function () { | ||
| return -1; | ||
| }; | ||
| CallThroughMethodStub.prototype.isApplicable = function (args) { | ||
| return false; | ||
| }; | ||
| CallThroughMethodStub.prototype.execute = function (args) { | ||
| this.result = this.method.apply(this.instance, args); | ||
| }; | ||
| CallThroughMethodStub.prototype.getValue = function () { | ||
| return this.result; | ||
| }; | ||
| return CallThroughMethodStub; | ||
| }()); | ||
| exports.CallThroughMethodStub = CallThroughMethodStub; | ||
| //# sourceMappingURL=CallThroughMethodStub.js.map |
| {"version":3,"file":"CallThroughMethodStub.js","sourceRoot":"","sources":["../../src/stub/CallThroughMethodStub.ts"],"names":[],"mappings":";;AAEA;IAGI,+BAAoB,QAAa,EAAU,MAAgB;QAAvC,aAAQ,GAAR,QAAQ,CAAK;QAAU,WAAM,GAAN,MAAM,CAAU;IAC3D,CAAC;IAEM,6CAAa,GAApB;QACI,OAAO,CAAC,CAAC,CAAC;IACd,CAAC;IAEM,4CAAY,GAAnB,UAAoB,IAAW;QAC3B,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,uCAAO,GAAd,UAAe,IAAW;QACtB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACzD,CAAC;IAEM,wCAAQ,GAAf;QACI,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IACL,4BAAC;AAAD,CAAC,AArBD,IAqBC;AArBY,sDAAqB"} |
| export interface MethodStub { | ||
| isApplicable(args: any[]): boolean; | ||
| execute(args: any[]): void; | ||
| getValue(): any; | ||
| getGroupIndex(): number; | ||
| } |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| //# sourceMappingURL=MethodStub.js.map |
| {"version":3,"file":"MethodStub.js","sourceRoot":"","sources":["../../src/stub/MethodStub.ts"],"names":[],"mappings":""} |
| import { Matcher } from "../matcher/type/Matcher"; | ||
| import { AbstractMethodStub } from "./AbstractMethodStub"; | ||
| import { MethodStub } from "./MethodStub"; | ||
| export declare class RejectPromiseMethodStub extends AbstractMethodStub implements MethodStub { | ||
| protected groupIndex: number; | ||
| private matchers; | ||
| private value; | ||
| private validator; | ||
| constructor(groupIndex: number, matchers: Array<Matcher>, value: any); | ||
| isApplicable(args: any[]): boolean; | ||
| execute(args: any[]): void; | ||
| getValue(): any; | ||
| } |
| "use strict"; | ||
| var __extends = (this && this.__extends) || (function () { | ||
| var extendStatics = Object.setPrototypeOf || | ||
| ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
| function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
| return function (d, b) { | ||
| extendStatics(d, b); | ||
| function __() { this.constructor = d; } | ||
| d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
| }; | ||
| })(); | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var ArgsToMatchersValidator_1 = require("../matcher/ArgsToMatchersValidator"); | ||
| var AbstractMethodStub_1 = require("./AbstractMethodStub"); | ||
| var RejectPromiseMethodStub = (function (_super) { | ||
| __extends(RejectPromiseMethodStub, _super); | ||
| function RejectPromiseMethodStub(groupIndex, matchers, value) { | ||
| var _this = _super.call(this) || this; | ||
| _this.groupIndex = groupIndex; | ||
| _this.matchers = matchers; | ||
| _this.value = value; | ||
| _this.validator = new ArgsToMatchersValidator_1.ArgsToMatchersValidator(); | ||
| return _this; | ||
| } | ||
| RejectPromiseMethodStub.prototype.isApplicable = function (args) { | ||
| return this.validator.validate(this.matchers, args); | ||
| }; | ||
| RejectPromiseMethodStub.prototype.execute = function (args) { | ||
| }; | ||
| RejectPromiseMethodStub.prototype.getValue = function () { | ||
| return Promise.reject(this.value); | ||
| }; | ||
| return RejectPromiseMethodStub; | ||
| }(AbstractMethodStub_1.AbstractMethodStub)); | ||
| exports.RejectPromiseMethodStub = RejectPromiseMethodStub; | ||
| //# sourceMappingURL=RejectPromiseMethodStub.js.map |
| {"version":3,"file":"RejectPromiseMethodStub.js","sourceRoot":"","sources":["../../src/stub/RejectPromiseMethodStub.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8EAA2E;AAE3E,2DAAwD;AAGxD;IAA6C,2CAAkB;IAG3D,iCAAsB,UAAkB,EAAU,QAAwB,EAAU,KAAU;QAA9F,YACI,iBAAO,SACV;QAFqB,gBAAU,GAAV,UAAU,CAAQ;QAAU,cAAQ,GAAR,QAAQ,CAAgB;QAAU,WAAK,GAAL,KAAK,CAAK;QAFtF,eAAS,GAA4B,IAAI,iDAAuB,EAAE,CAAC;;IAI3E,CAAC;IAEM,8CAAY,GAAnB,UAAoB,IAAW;QAC3B,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACxD,CAAC;IAEM,yCAAO,GAAd,UAAe,IAAW;IAE1B,CAAC;IAEM,0CAAQ,GAAf;QACI,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;IACL,8BAAC;AAAD,CAAC,AAlBD,CAA6C,uCAAkB,GAkB9D;AAlBY,0DAAuB"} |
| import { Matcher } from "../matcher/type/Matcher"; | ||
| import { AbstractMethodStub } from "./AbstractMethodStub"; | ||
| import { MethodStub } from "./MethodStub"; | ||
| export declare class ResolvePromiseMethodStub extends AbstractMethodStub implements MethodStub { | ||
| protected groupIndex: number; | ||
| private matchers; | ||
| private value; | ||
| private validator; | ||
| constructor(groupIndex: number, matchers: Array<Matcher>, value: any); | ||
| isApplicable(args: any[]): boolean; | ||
| execute(args: any[]): void; | ||
| getValue(): any; | ||
| } |
| "use strict"; | ||
| var __extends = (this && this.__extends) || (function () { | ||
| var extendStatics = Object.setPrototypeOf || | ||
| ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
| function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
| return function (d, b) { | ||
| extendStatics(d, b); | ||
| function __() { this.constructor = d; } | ||
| d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
| }; | ||
| })(); | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var ArgsToMatchersValidator_1 = require("../matcher/ArgsToMatchersValidator"); | ||
| var AbstractMethodStub_1 = require("./AbstractMethodStub"); | ||
| var ResolvePromiseMethodStub = (function (_super) { | ||
| __extends(ResolvePromiseMethodStub, _super); | ||
| function ResolvePromiseMethodStub(groupIndex, matchers, value) { | ||
| var _this = _super.call(this) || this; | ||
| _this.groupIndex = groupIndex; | ||
| _this.matchers = matchers; | ||
| _this.value = value; | ||
| _this.validator = new ArgsToMatchersValidator_1.ArgsToMatchersValidator(); | ||
| return _this; | ||
| } | ||
| ResolvePromiseMethodStub.prototype.isApplicable = function (args) { | ||
| return this.validator.validate(this.matchers, args); | ||
| }; | ||
| ResolvePromiseMethodStub.prototype.execute = function (args) { | ||
| }; | ||
| ResolvePromiseMethodStub.prototype.getValue = function () { | ||
| return Promise.resolve(this.value); | ||
| }; | ||
| return ResolvePromiseMethodStub; | ||
| }(AbstractMethodStub_1.AbstractMethodStub)); | ||
| exports.ResolvePromiseMethodStub = ResolvePromiseMethodStub; | ||
| //# sourceMappingURL=ResolvePromiseMethodStub.js.map |
| {"version":3,"file":"ResolvePromiseMethodStub.js","sourceRoot":"","sources":["../../src/stub/ResolvePromiseMethodStub.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8EAA2E;AAE3E,2DAAwD;AAGxD;IAA8C,4CAAkB;IAG5D,kCAAsB,UAAkB,EAAU,QAAwB,EAAU,KAAU;QAA9F,YACI,iBAAO,SACV;QAFqB,gBAAU,GAAV,UAAU,CAAQ;QAAU,cAAQ,GAAR,QAAQ,CAAgB;QAAU,WAAK,GAAL,KAAK,CAAK;QAFtF,eAAS,GAA4B,IAAI,iDAAuB,EAAE,CAAC;;IAI3E,CAAC;IAEM,+CAAY,GAAnB,UAAoB,IAAW;QAC3B,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACxD,CAAC;IAEM,0CAAO,GAAd,UAAe,IAAW;IAE1B,CAAC;IAEM,2CAAQ,GAAf;QACI,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IACL,+BAAC;AAAD,CAAC,AAlBD,CAA8C,uCAAkB,GAkB/D;AAlBY,4DAAwB"} |
| import { Matcher } from "../matcher/type/Matcher"; | ||
| import { AbstractMethodStub } from "./AbstractMethodStub"; | ||
| import { MethodStub } from "./MethodStub"; | ||
| export declare class ReturnValueMethodStub extends AbstractMethodStub implements MethodStub { | ||
| protected groupIndex: number; | ||
| private matchers; | ||
| private returns; | ||
| private validator; | ||
| constructor(groupIndex: number, matchers: Array<Matcher>, returns: any); | ||
| isApplicable(args: any[]): boolean; | ||
| execute(args: any[]): void; | ||
| getValue(): any; | ||
| } |
| "use strict"; | ||
| var __extends = (this && this.__extends) || (function () { | ||
| var extendStatics = Object.setPrototypeOf || | ||
| ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
| function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
| return function (d, b) { | ||
| extendStatics(d, b); | ||
| function __() { this.constructor = d; } | ||
| d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
| }; | ||
| })(); | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var ArgsToMatchersValidator_1 = require("../matcher/ArgsToMatchersValidator"); | ||
| var AbstractMethodStub_1 = require("./AbstractMethodStub"); | ||
| var ReturnValueMethodStub = (function (_super) { | ||
| __extends(ReturnValueMethodStub, _super); | ||
| function ReturnValueMethodStub(groupIndex, matchers, returns) { | ||
| var _this = _super.call(this) || this; | ||
| _this.groupIndex = groupIndex; | ||
| _this.matchers = matchers; | ||
| _this.returns = returns; | ||
| _this.validator = new ArgsToMatchersValidator_1.ArgsToMatchersValidator(); | ||
| return _this; | ||
| } | ||
| ReturnValueMethodStub.prototype.isApplicable = function (args) { | ||
| return this.validator.validate(this.matchers, args); | ||
| }; | ||
| ReturnValueMethodStub.prototype.execute = function (args) { | ||
| }; | ||
| ReturnValueMethodStub.prototype.getValue = function () { | ||
| return this.returns; | ||
| }; | ||
| return ReturnValueMethodStub; | ||
| }(AbstractMethodStub_1.AbstractMethodStub)); | ||
| exports.ReturnValueMethodStub = ReturnValueMethodStub; | ||
| //# sourceMappingURL=ReturnValueMethodStub.js.map |
| {"version":3,"file":"ReturnValueMethodStub.js","sourceRoot":"","sources":["../../src/stub/ReturnValueMethodStub.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8EAA2E;AAE3E,2DAAwD;AAGxD;IAA2C,yCAAkB;IAGzD,+BAAsB,UAAkB,EAAU,QAAwB,EAAU,OAAY;QAAhG,YACI,iBAAO,SACV;QAFqB,gBAAU,GAAV,UAAU,CAAQ;QAAU,cAAQ,GAAR,QAAQ,CAAgB;QAAU,aAAO,GAAP,OAAO,CAAK;QAFxF,eAAS,GAA4B,IAAI,iDAAuB,EAAE,CAAC;;IAI3E,CAAC;IAEM,4CAAY,GAAnB,UAAoB,IAAW;QAC3B,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACxD,CAAC;IAEM,uCAAO,GAAd,UAAe,IAAW;IAE1B,CAAC;IAEM,wCAAQ,GAAf;QACI,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IACL,4BAAC;AAAD,CAAC,AAlBD,CAA2C,uCAAkB,GAkB5D;AAlBY,sDAAqB"} |
| import { Matcher } from "../matcher/type/Matcher"; | ||
| import { AbstractMethodStub } from "./AbstractMethodStub"; | ||
| import { MethodStub } from "./MethodStub"; | ||
| export declare class ThrowErrorMethodStub extends AbstractMethodStub implements MethodStub { | ||
| protected groupIndex: number; | ||
| private matchers; | ||
| private error; | ||
| private validator; | ||
| constructor(groupIndex: number, matchers: Array<Matcher>, error: Error); | ||
| isApplicable(args: any[]): boolean; | ||
| execute(args: any[]): void; | ||
| getValue(): any; | ||
| } |
| "use strict"; | ||
| var __extends = (this && this.__extends) || (function () { | ||
| var extendStatics = Object.setPrototypeOf || | ||
| ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
| function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
| return function (d, b) { | ||
| extendStatics(d, b); | ||
| function __() { this.constructor = d; } | ||
| d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
| }; | ||
| })(); | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var ArgsToMatchersValidator_1 = require("../matcher/ArgsToMatchersValidator"); | ||
| var AbstractMethodStub_1 = require("./AbstractMethodStub"); | ||
| var ThrowErrorMethodStub = (function (_super) { | ||
| __extends(ThrowErrorMethodStub, _super); | ||
| function ThrowErrorMethodStub(groupIndex, matchers, error) { | ||
| var _this = _super.call(this) || this; | ||
| _this.groupIndex = groupIndex; | ||
| _this.matchers = matchers; | ||
| _this.error = error; | ||
| _this.validator = new ArgsToMatchersValidator_1.ArgsToMatchersValidator(); | ||
| return _this; | ||
| } | ||
| ThrowErrorMethodStub.prototype.isApplicable = function (args) { | ||
| return this.validator.validate(this.matchers, args); | ||
| }; | ||
| ThrowErrorMethodStub.prototype.execute = function (args) { | ||
| throw this.error; | ||
| }; | ||
| ThrowErrorMethodStub.prototype.getValue = function () { | ||
| return null; | ||
| }; | ||
| return ThrowErrorMethodStub; | ||
| }(AbstractMethodStub_1.AbstractMethodStub)); | ||
| exports.ThrowErrorMethodStub = ThrowErrorMethodStub; | ||
| //# sourceMappingURL=ThrowErrorMethodStub.js.map |
| {"version":3,"file":"ThrowErrorMethodStub.js","sourceRoot":"","sources":["../../src/stub/ThrowErrorMethodStub.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8EAA2E;AAE3E,2DAAwD;AAGxD;IAA0C,wCAAkB;IAGxD,8BAAsB,UAAkB,EAAU,QAAwB,EAAU,KAAY;QAAhG,YACI,iBAAO,SACV;QAFqB,gBAAU,GAAV,UAAU,CAAQ;QAAU,cAAQ,GAAR,QAAQ,CAAgB;QAAU,WAAK,GAAL,KAAK,CAAO;QAFxF,eAAS,GAA4B,IAAI,iDAAuB,EAAE,CAAC;;IAI3E,CAAC;IAEM,2CAAY,GAAnB,UAAoB,IAAW;QAC3B,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACxD,CAAC;IAEM,sCAAO,GAAd,UAAe,IAAW;QACtB,MAAM,IAAI,CAAC,KAAK,CAAC;IACrB,CAAC;IAEM,uCAAQ,GAAf;QACI,OAAO,IAAI,CAAC;IAChB,CAAC;IACL,2BAAC;AAAD,CAAC,AAlBD,CAA0C,uCAAkB,GAkB3D;AAlBY,oDAAoB"} |
| import { ArgCaptor1, ArgCaptor10, ArgCaptor2, ArgCaptor3, ArgCaptor4, ArgCaptor5, ArgCaptor6, ArgCaptor7, ArgCaptor8, ArgCaptor9 } from "./capture/ArgCaptor"; | ||
| import { MethodStubSetter } from "./MethodStubSetter"; | ||
| import { MethodStubVerificator } from "./MethodStubVerificator"; | ||
| export declare function spy<T>(instanceToSpy: T): T; | ||
| export declare function mock<T>(clazz: (new (...args: any[]) => T) | (Function & { | ||
| prototype: T; | ||
| })): T; | ||
| export declare function mock<T>(clazz?: any): T; | ||
| export declare function verify<T>(method: T): MethodStubVerificator<T>; | ||
| export declare function when<T>(method: Promise<T>): MethodStubSetter<Promise<T>, T, Error>; | ||
| export declare function when<T>(method: T): MethodStubSetter<T>; | ||
| export declare function instance<T>(mockedValue: T): T; | ||
| export declare function capture<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(method: (a: T0, b: T1, c: T2, d: T3, e: T4, f: T5, g: T6, h: T7, i: T8, j: T9) => any): ArgCaptor10<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>; | ||
| export declare function capture<T0, T1, T2, T3, T4, T5, T6, T7, T8>(method: (a: T0, b: T1, c: T2, d: T3, e: T4, f: T5, g: T6, h: T7, i: T8) => any): ArgCaptor9<T0, T1, T2, T3, T4, T5, T6, T7, T8>; | ||
| export declare function capture<T0, T1, T2, T3, T4, T5, T6, T7>(method: (a: T0, b: T1, c: T2, d: T3, e: T4, f: T5, g: T6, h: T7) => any): ArgCaptor8<T0, T1, T2, T3, T4, T5, T6, T7>; | ||
| export declare function capture<T0, T1, T2, T3, T4, T5, T6>(method: (a: T0, b: T1, c: T2, d: T3, e: T4, f: T5, g: T6) => any): ArgCaptor7<T0, T1, T2, T3, T4, T5, T6>; | ||
| export declare function capture<T0, T1, T2, T3, T4, T5>(method: (a: T0, b: T1, c: T2, d: T3, e: T4, f: T5) => any): ArgCaptor6<T0, T1, T2, T3, T4, T5>; | ||
| export declare function capture<T0, T1, T2, T3, T4>(method: (a: T0, b: T1, c: T2, d: T3, e: T4) => any): ArgCaptor5<T0, T1, T2, T3, T4>; | ||
| export declare function capture<T0, T1, T2, T3>(method: (a: T0, b: T1, c: T2, d: T3) => any): ArgCaptor4<T0, T1, T2, T3>; | ||
| export declare function capture<T0, T1, T2>(method: (a: T0, b: T1, c: T2) => any): ArgCaptor3<T0, T1, T2>; | ||
| export declare function capture<T0, T1>(method: (a: T0, b: T1) => any): ArgCaptor2<T0, T1>; | ||
| export declare function capture<T0>(method: (a: T0) => any): ArgCaptor1<T0>; | ||
| export declare function reset<T>(...mockedValues: T[]): void; | ||
| export declare function resetCalls<T>(...mockedValues: T[]): void; | ||
| export declare function anyOfClass<T>(expectedClass: new (...args: any[]) => T): any; | ||
| export declare function anyFunction(): any; | ||
| export declare function anyNumber(): any; | ||
| export declare function anyString(): any; | ||
| export declare function anything(): any; | ||
| export declare function between(min: number, max: number): any; | ||
| export declare function deepEqual<T>(expectedValue: T): T; | ||
| export declare function notNull(): any; | ||
| export declare function strictEqual(expectedValue: any): any; | ||
| export declare function match(expectedValue: RegExp | string): any; | ||
| export declare function objectContaining(expectedValue: Object): any; | ||
| declare const _default: { | ||
| spy: typeof spy; | ||
| mock: typeof mock; | ||
| verify: typeof verify; | ||
| when: typeof when; | ||
| instance: typeof instance; | ||
| capture: typeof capture; | ||
| reset: typeof reset; | ||
| resetCalls: typeof resetCalls; | ||
| anyOfClass: typeof anyOfClass; | ||
| anyFunction: typeof anyFunction; | ||
| anyNumber: typeof anyNumber; | ||
| anyString: typeof anyString; | ||
| anything: typeof anything; | ||
| between: typeof between; | ||
| deepEqual: typeof deepEqual; | ||
| notNull: typeof notNull; | ||
| strictEqual: typeof strictEqual; | ||
| match: typeof match; | ||
| objectContaining: typeof objectContaining; | ||
| }; | ||
| export default _default; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var ArgCaptor_1 = require("./capture/ArgCaptor"); | ||
| var AnyFunctionMatcher_1 = require("./matcher/type/AnyFunctionMatcher"); | ||
| var AnyNumberMatcher_1 = require("./matcher/type/AnyNumberMatcher"); | ||
| var AnyOfClassMatcher_1 = require("./matcher/type/AnyOfClassMatcher"); | ||
| var AnyStringMatcher_1 = require("./matcher/type/AnyStringMatcher"); | ||
| var AnythingMatcher_1 = require("./matcher/type/AnythingMatcher"); | ||
| var BetweenMatcher_1 = require("./matcher/type/BetweenMatcher"); | ||
| var DeepEqualMatcher_1 = require("./matcher/type/DeepEqualMatcher"); | ||
| var MatchingStringMatcher_1 = require("./matcher/type/MatchingStringMatcher"); | ||
| var NotNullMatcher_1 = require("./matcher/type/NotNullMatcher"); | ||
| var ObjectContainingMatcher_1 = require("./matcher/type/ObjectContainingMatcher"); | ||
| var StrictEqualMatcher_1 = require("./matcher/type/StrictEqualMatcher"); | ||
| var MethodStubSetter_1 = require("./MethodStubSetter"); | ||
| var MethodStubVerificator_1 = require("./MethodStubVerificator"); | ||
| var MethodToStub_1 = require("./MethodToStub"); | ||
| var Mock_1 = require("./Mock"); | ||
| var Spy_1 = require("./Spy"); | ||
| function spy(instanceToSpy) { | ||
| return new Spy_1.Spy(instanceToSpy).getMock(); | ||
| } | ||
| exports.spy = spy; | ||
| function mock(clazz) { | ||
| return new Mock_1.Mocker(clazz).getMock(); | ||
| } | ||
| exports.mock = mock; | ||
| function verify(method) { | ||
| return new MethodStubVerificator_1.MethodStubVerificator(method); | ||
| } | ||
| exports.verify = verify; | ||
| function when(method) { | ||
| return new MethodStubSetter_1.MethodStubSetter(method); | ||
| } | ||
| exports.when = when; | ||
| function instance(mockedValue) { | ||
| var tsmockitoInstance = mockedValue.__tsmockitoInstance; | ||
| return tsmockitoInstance; | ||
| } | ||
| exports.instance = instance; | ||
| function capture(method) { | ||
| var methodStub = method(); | ||
| if (methodStub instanceof MethodToStub_1.MethodToStub) { | ||
| var actions = methodStub.mocker.getActionsByName(methodStub.name); | ||
| return new ArgCaptor_1.ArgCaptor(actions); | ||
| } | ||
| else { | ||
| throw Error("Cannot capture from not mocked object."); | ||
| } | ||
| } | ||
| exports.capture = capture; | ||
| function reset() { | ||
| var mockedValues = []; | ||
| for (var _i = 0; _i < arguments.length; _i++) { | ||
| mockedValues[_i] = arguments[_i]; | ||
| } | ||
| mockedValues.forEach(function (mockedValue) { return mockedValue.__tsmockitoMocker.reset(); }); | ||
| } | ||
| exports.reset = reset; | ||
| function resetCalls() { | ||
| var mockedValues = []; | ||
| for (var _i = 0; _i < arguments.length; _i++) { | ||
| mockedValues[_i] = arguments[_i]; | ||
| } | ||
| mockedValues.forEach(function (mockedValue) { return mockedValue.__tsmockitoMocker.resetCalls(); }); | ||
| } | ||
| exports.resetCalls = resetCalls; | ||
| function anyOfClass(expectedClass) { | ||
| return new AnyOfClassMatcher_1.AnyOfClassMatcher(expectedClass); | ||
| } | ||
| exports.anyOfClass = anyOfClass; | ||
| function anyFunction() { | ||
| return new AnyFunctionMatcher_1.AnyFunctionMatcher(); | ||
| } | ||
| exports.anyFunction = anyFunction; | ||
| function anyNumber() { | ||
| return new AnyNumberMatcher_1.AnyNumberMatcher(); | ||
| } | ||
| exports.anyNumber = anyNumber; | ||
| function anyString() { | ||
| return new AnyStringMatcher_1.AnyStringMatcher(); | ||
| } | ||
| exports.anyString = anyString; | ||
| function anything() { | ||
| return new AnythingMatcher_1.AnythingMatcher(); | ||
| } | ||
| exports.anything = anything; | ||
| function between(min, max) { | ||
| return new BetweenMatcher_1.BetweenMatcher(min, max); | ||
| } | ||
| exports.between = between; | ||
| function deepEqual(expectedValue) { | ||
| return new DeepEqualMatcher_1.DeepEqualMatcher(expectedValue); | ||
| } | ||
| exports.deepEqual = deepEqual; | ||
| function notNull() { | ||
| return new NotNullMatcher_1.NotNullMatcher(); | ||
| } | ||
| exports.notNull = notNull; | ||
| function strictEqual(expectedValue) { | ||
| return new StrictEqualMatcher_1.StrictEqualMatcher(expectedValue); | ||
| } | ||
| exports.strictEqual = strictEqual; | ||
| function match(expectedValue) { | ||
| return new MatchingStringMatcher_1.MatchingStringMatcher(expectedValue); | ||
| } | ||
| exports.match = match; | ||
| function objectContaining(expectedValue) { | ||
| return new ObjectContainingMatcher_1.ObjectContainingMatcher(expectedValue); | ||
| } | ||
| exports.objectContaining = objectContaining; | ||
| exports.default = { | ||
| spy: spy, | ||
| mock: mock, | ||
| verify: verify, | ||
| when: when, | ||
| instance: instance, | ||
| capture: capture, | ||
| reset: reset, | ||
| resetCalls: resetCalls, | ||
| anyOfClass: anyOfClass, | ||
| anyFunction: anyFunction, | ||
| anyNumber: anyNumber, | ||
| anyString: anyString, | ||
| anything: anything, | ||
| between: between, | ||
| deepEqual: deepEqual, | ||
| notNull: notNull, | ||
| strictEqual: strictEqual, | ||
| match: match, | ||
| objectContaining: objectContaining, | ||
| }; | ||
| //# sourceMappingURL=ts-mockito.js.map |
| {"version":3,"file":"ts-mockito.js","sourceRoot":"","sources":["../src/ts-mockito.ts"],"names":[],"mappings":";;AAAA,iDAY6B;AAC7B,wEAAqE;AACrE,oEAAiE;AACjE,sE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CAEC;AAGD,kBAAe;IACX,GAAG,KAAA;IACH,IAAI,MAAA;IACJ,MAAM,QAAA;IACN,IAAI,MAAA;IACJ,QAAQ,UAAA;IACR,OAAO,SAAA;IACP,KAAK,OAAA;IACL,UAAU,YAAA;IACV,UAAU,YAAA;IACV,WAAW,aAAA;IACX,SAAS,WAAA;IACT,SAAS,WAAA;IACT,QAAQ,UAAA;IACR,OAAO,SAAA;IACP,SAAS,WAAA;IACT,OAAO,SAAA;IACP,WAAW,aAAA;IACX,KAAK,OAAA;IACL,gBAAgB,kBAAA;CACnB,CAAC"} |
| import { MethodToStub } from "../MethodToStub"; | ||
| export declare class MethodCallToStringConverter { | ||
| convert(method: MethodToStub): string; | ||
| } |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var MethodCallToStringConverter = (function () { | ||
| function MethodCallToStringConverter() { | ||
| } | ||
| MethodCallToStringConverter.prototype.convert = function (method) { | ||
| var stringifiedMatchers = method.matchers.map(function (matcher) { return matcher.toString(); }).join(", "); | ||
| return method.name + "(" + stringifiedMatchers + ")\" "; | ||
| }; | ||
| return MethodCallToStringConverter; | ||
| }()); | ||
| exports.MethodCallToStringConverter = MethodCallToStringConverter; | ||
| //# sourceMappingURL=MethodCallToStringConverter.js.map |
| {"version":3,"file":"MethodCallToStringConverter.js","sourceRoot":"","sources":["../../src/utils/MethodCallToStringConverter.ts"],"names":[],"mappings":";;AAGA;IAAA;IAKA,CAAC;IAJU,6CAAO,GAAd,UAAe,MAAoB;QAC/B,IAAM,mBAAmB,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAC,OAAgB,IAAK,OAAA,OAAO,CAAC,QAAQ,EAAE,EAAlB,CAAkB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrG,OAAU,MAAM,CAAC,IAAI,SAAI,mBAAmB,SAAK,CAAC;IACtD,CAAC;IACL,kCAAC;AAAD,CAAC,AALD,IAKC;AALY,kEAA2B"} |
| export declare class MockableFunctionsFinder { | ||
| private functionNameRegex; | ||
| private cleanFunctionNameRegex; | ||
| private excludedFunctionNames; | ||
| find(code: string): string[]; | ||
| private isMockable; | ||
| } |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var MockableFunctionsFinder = (function () { | ||
| function MockableFunctionsFinder() { | ||
| this.functionNameRegex = /[.\s]([^.\s]+?)(?:\(|\s+=\s+(?:function\s*(?:[^.\s]+?\s*)?)?\()/g; | ||
| this.cleanFunctionNameRegex = /^[.\s]([^.\s]+?)[\s(]/; | ||
| this.excludedFunctionNames = ["hasOwnProperty", "function"]; | ||
| } | ||
| MockableFunctionsFinder.prototype.find = function (code) { | ||
| var _this = this; | ||
| return (code.match(this.functionNameRegex) || []) | ||
| .map(function (match) { return match.match(_this.cleanFunctionNameRegex)[1]; }) | ||
| .filter(function (functionName) { return _this.isMockable(functionName); }); | ||
| }; | ||
| MockableFunctionsFinder.prototype.isMockable = function (name) { | ||
| return this.excludedFunctionNames.indexOf(name) < 0; | ||
| }; | ||
| return MockableFunctionsFinder; | ||
| }()); | ||
| exports.MockableFunctionsFinder = MockableFunctionsFinder; | ||
| //# sourceMappingURL=MockableFunctionsFinder.js.map |
| {"version":3,"file":"MockableFunctionsFinder.js","sourceRoot":"","sources":["../../src/utils/MockableFunctionsFinder.ts"],"names":[],"mappings":";;AAUA;IAAA;QACY,sBAAiB,GAAG,kEAAkE,CAAC;QACvF,2BAAsB,GAAG,uBAAuB,CAAC;QACjD,0BAAqB,GAAa,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;IAW7E,CAAC;IATU,sCAAI,GAAX,UAAY,IAAY;QAAxB,iBAIC;QAHG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC;aAC5C,GAAG,CAAC,UAAC,KAAa,IAAK,OAAA,KAAK,CAAC,KAAK,CAAC,KAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,EAA3C,CAA2C,CAAC;aACnE,MAAM,CAAC,UAAC,YAAoB,IAAK,OAAA,KAAI,CAAC,UAAU,CAAC,YAAY,CAAC,EAA7B,CAA6B,CAAC,CAAC;IACzE,CAAC;IAEO,4CAAU,GAAlB,UAAmB,IAAY;QAC3B,OAAO,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACxD,CAAC;IACL,8BAAC;AAAD,CAAC,AAdD,IAcC;AAdY,0DAAuB"} |
| export declare class ObjectInspector { | ||
| getObjectPrototypes(prototype: any): any[]; | ||
| getObjectOwnPropertyNames(object: any): string[]; | ||
| } |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var _ = require("lodash"); | ||
| var ObjectInspector = (function () { | ||
| function ObjectInspector() { | ||
| } | ||
| ObjectInspector.prototype.getObjectPrototypes = function (prototype) { | ||
| var prototypes = []; | ||
| while (_.isObject(prototype) && (prototype !== Object.prototype && prototype !== Function.prototype)) { | ||
| prototypes.push(prototype); | ||
| prototype = Object.getPrototypeOf(prototype); | ||
| } | ||
| return prototypes; | ||
| }; | ||
| ObjectInspector.prototype.getObjectOwnPropertyNames = function (object) { | ||
| return _.isObject(object) ? Object.getOwnPropertyNames(object) : []; | ||
| }; | ||
| return ObjectInspector; | ||
| }()); | ||
| exports.ObjectInspector = ObjectInspector; | ||
| //# sourceMappingURL=ObjectInspector.js.map |
| {"version":3,"file":"ObjectInspector.js","sourceRoot":"","sources":["../../src/utils/ObjectInspector.ts"],"names":[],"mappings":";;AAAA,0BAA4B;AAE5B;IAAA;IAaA,CAAC;IAZU,6CAAmB,GAA1B,UAA2B,SAAc;QACrC,IAAM,UAAU,GAAU,EAAE,CAAC;QAC7B,OAAO,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,KAAK,MAAM,CAAC,SAAS,IAAI,SAAS,KAAK,QAAQ,CAAC,SAAS,CAAC,EAAE;YAClG,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC3B,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;SAChD;QACD,OAAO,UAAU,CAAC;IACtB,CAAC;IAEM,mDAAyB,GAAhC,UAAiC,MAAW;QACxC,OAAO,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACxE,CAAC;IACL,sBAAC;AAAD,CAAC,AAbD,IAaC;AAbY,0CAAe"} |
| export declare class ObjectPropertyCodeRetriever { | ||
| get(object: any, propertyName: string): string; | ||
| } |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var ObjectPropertyCodeRetriever = (function () { | ||
| function ObjectPropertyCodeRetriever() { | ||
| } | ||
| ObjectPropertyCodeRetriever.prototype.get = function (object, propertyName) { | ||
| var descriptor = Object.getOwnPropertyDescriptor(object, propertyName); | ||
| if (!descriptor) { | ||
| return ""; | ||
| } | ||
| var accessorsCodes = []; | ||
| if (descriptor.get) { | ||
| accessorsCodes.push(descriptor.get.toString()); | ||
| } | ||
| if (descriptor.set) { | ||
| accessorsCodes.push(descriptor.set.toString()); | ||
| } | ||
| return accessorsCodes.join(" ") || String(object[propertyName]); | ||
| }; | ||
| return ObjectPropertyCodeRetriever; | ||
| }()); | ||
| exports.ObjectPropertyCodeRetriever = ObjectPropertyCodeRetriever; | ||
| //# sourceMappingURL=ObjectPropertyCodeRetriever.js.map |
| {"version":3,"file":"ObjectPropertyCodeRetriever.js","sourceRoot":"","sources":["../../src/utils/ObjectPropertyCodeRetriever.ts"],"names":[],"mappings":";;AAAA;IAAA;IAgBA,CAAC;IAfU,yCAAG,GAAV,UAAW,MAAW,EAAE,YAAoB;QACxC,IAAM,UAAU,GAAG,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QACzE,IAAI,CAAC,UAAU,EAAE;YAEb,OAAO,EAAE,CAAC;SACb;QACD,IAAM,cAAc,GAAG,EAAE,CAAC;QAC1B,IAAI,UAAU,CAAC,GAAG,EAAE;YAChB,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;SAClD;QACD,IAAI,UAAU,CAAC,GAAG,EAAE;YAChB,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;SAClD;QACD,OAAO,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;IACpE,CAAC;IACL,kCAAC;AAAD,CAAC,AAhBD,IAgBC;AAhBY,kEAA2B"} |
| MIT License | ||
| Copyright (c) 2016 NagRock | ||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
| { | ||
| "name": "ts-mockito", | ||
| "version": "2.6.1", | ||
| "description": "Mocking library for TypeScript", | ||
| "main": "lib/ts-mockito.js", | ||
| "typings": "lib/ts-mockito", | ||
| "scripts": { | ||
| "compile": "yarn test:compile-check && yarn rimraf 'lib/*' && ./node_modules/.bin/tsc -p ./src", | ||
| "test": "npm run test:jest && npm run test:karma", | ||
| "test:watch": "npm run test:jest:watch", | ||
| "test:coverage": "jest --coverage --maxWorkers=4", | ||
| "test:jest": "jest", | ||
| "test:jest:watch": "jest --watch", | ||
| "test:karma": "./node_modules/.bin/karma start karma.conf.js --single-run", | ||
| "test:karma:watch": "./node_modules/.bin/karma start karma.conf.js", | ||
| "test:compile-check": "tsc --noEmit -p tsconfig.json", | ||
| "lint": "tslint -c tslint.json 'src/**/*.ts' 'test/**/*.ts'" | ||
| }, | ||
| "author": "kuster.maciej@gmail.com", | ||
| "license": "MIT", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/NagRock/ts-mockito" | ||
| }, | ||
| "keywords": [ | ||
| "mock", | ||
| "typescript", | ||
| "tests", | ||
| "fake", | ||
| "stub", | ||
| "spy", | ||
| "javascript" | ||
| ], | ||
| "devDependencies": { | ||
| "@types/jasmine": "^2.6.0", | ||
| "@types/lodash": "^4.14.104", | ||
| "@types/node": "^8.0.46", | ||
| "babel-polyfill": "^6.26.0", | ||
| "jasmine-core": "^2.8.0", | ||
| "jest": "^23.5.0", | ||
| "karma": "^1.7.1", | ||
| "karma-chrome-launcher": "^2.2.0", | ||
| "karma-cli": "^1.0.1", | ||
| "karma-jasmine": "^1.1.0", | ||
| "karma-mocha-reporter": "^2.2.5", | ||
| "karma-phantomjs-launcher": "^1.0.4", | ||
| "karma-typescript": "^3.0.8", | ||
| "karma-typescript-preprocessor": "^0.3.1", | ||
| "phantomjs-prebuilt": "^2.1.16", | ||
| "puppeteer": "^0.12.0", | ||
| "rimraf": "^3.0.0", | ||
| "ts-helpers": "^1.1.2", | ||
| "ts-jest": "^23.0.1", | ||
| "tslint": "^5.7.0", | ||
| "typescript": "^2.7.2" | ||
| }, | ||
| "dependencies": { | ||
| "lodash": "^4.17.5" | ||
| }, | ||
| "resolutions": { | ||
| "write-file-atomic": "2.4.1" | ||
| }, | ||
| "jest": { | ||
| "testEnvironment": "node", | ||
| "transform": { | ||
| "^.+\\.ts$": "<rootDir>/node_modules/ts-jest/preprocessor.js" | ||
| }, | ||
| "testRegex": "(/__tests__/.*|\\.(spec))\\.(ts|js)$", | ||
| "moduleFileExtensions": [ | ||
| "ts", | ||
| "js", | ||
| "json" | ||
| ], | ||
| "collectCoverageFrom": [ | ||
| "src/**/*.ts" | ||
| ], | ||
| "coverageReporters": [ | ||
| "lcov" | ||
| ] | ||
| } | ||
| } |
| # ts-mockito [](https://travis-ci.org/NagRock/ts-mockito) [](https://codecov.io/gh/NagRock/ts-mockito) | ||
| Mocking library for TypeScript inspired by http://mockito.org/ | ||
| ## 1.x to 2.x migration guide | ||
| [1.x to 2.x migration guide](https://github.com/NagRock/ts-mockito/wiki/ts-mockito-1.x-to-2.x-migration-guide) | ||
| ## Main features | ||
| * Strongly typed | ||
| * IDE autocomplete | ||
| * Mock creation (`mock`) (also abstract classes) [#example](#basics) | ||
| * Spying on real objects (`spy`) [#example](#spying-on-real-objects) | ||
| * Changing mock behavior (`when`) via: | ||
| * `thenReturn` - return value [#example](#stubbing-method-calls) | ||
| * `thenThrow` - throw an error [#example](#throwing-errors) | ||
| * `thenCall` - call custom method [#example](#custom-function) | ||
| * `thenResolve` - resolve promise [#example](#resolving--rejecting-promises) | ||
| * `thenReject` - rejects promise [#example](#resolving--rejecting-promises) | ||
| * Checking if methods were called with given arguments (`verify`) | ||
| * `anything`, `notNull`, `anyString`, `anyOfClass` etc. - for more flexible comparision | ||
| * `once`, `twice`, `times`, `atLeast` etc. - allows call count verification [#example](#call-count-verification) | ||
| * `calledBefore`, `calledAfter` - allows call order verification [#example](#call-order-verification) | ||
| * Resetting mock (`reset`, `resetCalls`) [#example](#resetting-mock-calls), [#example](#resetting-mock) | ||
| * Capturing arguments passed to method (`capture`) [#example](#capturing-method-arguments) | ||
| * Recording multiple behaviors [#example](#recording-multiple-behaviors) | ||
| * Readable error messages (ex. `'Expected "convertNumberToString(strictEqual(3))" to be called 2 time(s). But has been called 1 time(s).'`) | ||
| ## Installation | ||
| `npm install ts-mockito --save-dev` | ||
| ## Usage | ||
| ### Basics | ||
| ``` typescript | ||
| // Creating mock | ||
| let mockedFoo:Foo = mock(Foo); | ||
| // Getting instance from mock | ||
| let foo:Foo = instance(mockedFoo); | ||
| // Using instance in source code | ||
| foo.getBar(3); | ||
| foo.getBar(5); | ||
| // Explicit, readable verification | ||
| verify(mockedFoo.getBar(3)).called(); | ||
| verify(mockedFoo.getBar(5)).called(); | ||
| ``` | ||
| ### Stubbing method calls | ||
| ``` typescript | ||
| // Creating mock | ||
| let mockedFoo:Foo = mock(Foo); | ||
| // stub method before execution | ||
| when(mockedFoo.getBar(3)).thenReturn('three'); | ||
| // Getting instance | ||
| let foo:Foo = instance(mockedFoo); | ||
| // prints three | ||
| console.log(foo.getBar(3)); | ||
| // prints null, because "getBar(999)" was not stubbed | ||
| console.log(foo.getBar(999)); | ||
| ``` | ||
| ### Stubbing getter value | ||
| ``` typescript | ||
| // Creating mock | ||
| let mockedFoo:Foo = mock(Foo); | ||
| // stub getter before execution | ||
| when(mockedFoo.sampleGetter).thenReturn('three'); | ||
| // Getting instance | ||
| let foo:Foo = instance(mockedFoo); | ||
| // prints three | ||
| console.log(foo.sampleGetter); | ||
| ``` | ||
| ### Stubbing property values that have no getters | ||
| Syntax is the same as with getter values. | ||
| Please note, that stubbing properties that don't have getters only works if [Proxy](http://www.ecma-international.org/ecma-262/6.0/#sec-proxy-objects) object is available (ES6). | ||
| ### Call count verification | ||
| ``` typescript | ||
| // Creating mock | ||
| let mockedFoo:Foo = mock(Foo); | ||
| // Getting instance | ||
| let foo:Foo = instance(mockedFoo); | ||
| // Some calls | ||
| foo.getBar(1); | ||
| foo.getBar(2); | ||
| foo.getBar(2); | ||
| foo.getBar(3); | ||
| // Call count verification | ||
| verify(mockedFoo.getBar(1)).once(); // was called with arg === 1 only once | ||
| verify(mockedFoo.getBar(2)).twice(); // was called with arg === 2 exactly two times | ||
| verify(mockedFoo.getBar(between(2, 3))).thrice(); // was called with arg between 2-3 exactly three times | ||
| verify(mockedFoo.getBar(anyNumber()).times(4); // was called with any number arg exactly four times | ||
| verify(mockedFoo.getBar(2)).atLeast(2); // was called with arg === 2 min two times | ||
| verify(mockedFoo.getBar(1)).atMost(1); // was called with arg === 1 max one time | ||
| verify(mockedFoo.getBar(4)).never(); // was never called with arg === 4 | ||
| ``` | ||
| ### Call order verification | ||
| ``` typescript | ||
| // Creating mock | ||
| let mockedFoo:Foo = mock(Foo); | ||
| let mockedBar:Bar = mock(Bar); | ||
| // Getting instance | ||
| let foo:Foo = instance(mockedFoo); | ||
| let bar:Bar = instance(mockedBar); | ||
| // Some calls | ||
| foo.getBar(1); | ||
| bar.getFoo(2); | ||
| // Call order verification | ||
| verify(mockedFoo.getBar(1)).calledBefore(mockedBar.getFoo(2)); // foo.getBar(1) has been called before bar.getFoo(2) | ||
| verify(mockedBar.getFoo(2)).calledAfter(mockedFoo.getBar(1)); // bar.getFoo(2) has been called before foo.getBar(1) | ||
| verify(mockedFoo.getBar(1)).calledBefore(mockedBar.getFoo(999999)); // throws error (mockedBar.getFoo(999999) has never been called) | ||
| ``` | ||
| ### Throwing errors | ||
| ``` typescript | ||
| let mockedFoo:Foo = mock(Foo); | ||
| when(mockedFoo.getBar(10)).thenThrow(new Error('fatal error')); | ||
| let foo:Foo = instance(mockedFoo); | ||
| try { | ||
| foo.getBar(10); | ||
| } catch (error:Error) { | ||
| console.log(error.message); // 'fatal error' | ||
| } | ||
| ``` | ||
| ### Custom function | ||
| You can also stub method with your own implementation | ||
| ``` typescript | ||
| let mockedFoo:Foo = mock(Foo); | ||
| let foo:Foo = instance(mockedFoo); | ||
| when(mockedFoo.sumTwoNumbers(anyNumber(), anyNumber())).thenCall((arg1:number, arg2:number) => { | ||
| return arg1 * arg2; | ||
| }); | ||
| // prints '50' because we've changed sum method implementation to multiply! | ||
| console.log(foo.sumTwoNumbers(5, 10)); | ||
| ``` | ||
| ### Resolving / rejecting promises | ||
| You can also stub method to resolve / reject promise | ||
| ``` typescript | ||
| let mockedFoo:Foo = mock(Foo); | ||
| when(mockedFoo.fetchData("a")).thenResolve({id: "a", value: "Hello world"}); | ||
| when(mockedFoo.fetchData("b")).thenReject(new Error("b does not exist")); | ||
| ``` | ||
| ### Resetting mock calls | ||
| You can reset just mock call counter | ||
| ``` typescript | ||
| // Creating mock | ||
| let mockedFoo:Foo = mock(Foo); | ||
| // Getting instance | ||
| let foo:Foo = instance(mockedFoo); | ||
| // Some calls | ||
| foo.getBar(1); | ||
| foo.getBar(1); | ||
| verify(mockedFoo.getBar(1)).twice(); // getBar with arg "1" has been called twice | ||
| // Reset mock | ||
| resetCalls(mockedFoo); | ||
| // Call count verification | ||
| verify(mockedFoo.getBar(1)).never(); // has never been called after reset | ||
| ``` | ||
| You can also reset calls of multiple mocks at once `resetCalls(firstMock, secondMock, thirdMock)` | ||
| ### Resetting mock | ||
| Or reset mock call counter with all stubs | ||
| ``` typescript | ||
| // Creating mock | ||
| let mockedFoo:Foo = mock(Foo); | ||
| when(mockedFoo.getBar(1)).thenReturn("one"). | ||
| // Getting instance | ||
| let foo:Foo = instance(mockedFoo); | ||
| // Some calls | ||
| console.log(foo.getBar(1)); // "one" - as defined in stub | ||
| console.log(foo.getBar(1)); // "one" - as defined in stub | ||
| verify(mockedFoo.getBar(1)).twice(); // getBar with arg "1" has been called twice | ||
| // Reset mock | ||
| reset(mockedFoo); | ||
| // Call count verification | ||
| verify(mockedFoo.getBar(1)).never(); // has never been called after reset | ||
| console.log(foo.getBar(1)); // null - previously added stub has been removed | ||
| ``` | ||
| You can also reset multiple mocks at once `reset(firstMock, secondMock, thirdMock)` | ||
| ### Capturing method arguments | ||
| ``` typescript | ||
| let mockedFoo:Foo = mock(Foo); | ||
| let foo:Foo = instance(mockedFoo); | ||
| // Call method | ||
| foo.sumTwoNumbers(1, 2); | ||
| // Check first arg captor values | ||
| const [firstArg, secondArg] = capture(mockedFoo.sumTwoNumbers).last(); | ||
| console.log(firstArg); // prints 1 | ||
| console.log(secondArg); // prints 2 | ||
| ``` | ||
| You can also get other calls using `first()`, `second()`, `byCallIndex(3)` and more... | ||
| ### Recording multiple behaviors | ||
| You can set multiple returning values for same matching values | ||
| ``` typescript | ||
| const mockedFoo:Foo = mock(Foo); | ||
| when(mockedFoo.getBar(anyNumber())).thenReturn('one').thenReturn('two').thenReturn('three'); | ||
| const foo:Foo = instance(mockedFoo); | ||
| console.log(foo.getBar(1)); // one | ||
| console.log(foo.getBar(1)); // two | ||
| console.log(foo.getBar(1)); // three | ||
| console.log(foo.getBar(1)); // three - last defined behavior will be repeated infinitely | ||
| ``` | ||
| Another example with specific values | ||
| ``` typescript | ||
| let mockedFoo:Foo = mock(Foo); | ||
| when(mockedFoo.getBar(1)).thenReturn('one').thenReturn('another one'); | ||
| when(mockedFoo.getBar(2)).thenReturn('two'); | ||
| let foo:Foo = instance(mockedFoo); | ||
| console.log(foo.getBar(1)); // one | ||
| console.log(foo.getBar(2)); // two | ||
| console.log(foo.getBar(1)); // another one | ||
| console.log(foo.getBar(1)); // another one - this is last defined behavior for arg '1' so it will be repeated | ||
| console.log(foo.getBar(2)); // two | ||
| console.log(foo.getBar(2)); // two - this is last defined behavior for arg '2' so it will be repeated | ||
| ``` | ||
| Short notation: | ||
| ``` typescript | ||
| const mockedFoo:Foo = mock(Foo); | ||
| // You can specify return values as multiple thenReturn args | ||
| when(mockedFoo.getBar(anyNumber())).thenReturn('one', 'two', 'three'); | ||
| const foo:Foo = instance(mockedFoo); | ||
| console.log(foo.getBar(1)); // one | ||
| console.log(foo.getBar(1)); // two | ||
| console.log(foo.getBar(1)); // three | ||
| console.log(foo.getBar(1)); // three - last defined behavior will be repeated infinity | ||
| ``` | ||
| Possible errors: | ||
| ``` typescript | ||
| const mockedFoo:Foo = mock(Foo); | ||
| // When multiple matchers, matches same result: | ||
| when(mockedFoo.getBar(anyNumber())).thenReturn('one'); | ||
| when(mockedFoo.getBar(3)).thenReturn('one'); | ||
| const foo:Foo = instance(mockedFoo); | ||
| foo.getBar(3); // MultipleMatchersMatchSameStubError will be thrown, two matchers match same method call | ||
| ``` | ||
| ### Mocking interfaces | ||
| You can mock interfaces too, just instead of passing type to `mock` function, set `mock` function generic type | ||
| Mocking interfaces requires `Proxy` implementation | ||
| ``` typescript | ||
| let mockedFoo:Foo = mock<FooInterface>(); // instead of mock(FooInterface) | ||
| const foo: SampleGeneric<FooInterface> = instance(mockedFoo); | ||
| ``` | ||
| ### Mocking types | ||
| You can mock abstract classes | ||
| ``` typescript | ||
| const mockedFoo: SampleAbstractClass = mock(SampleAbstractClass); | ||
| const foo: SampleAbstractClass = instance(mockedFoo); | ||
| ``` | ||
| You can also mock generic classes, but note that generic type is just needed by mock type definition | ||
| ``` typescript | ||
| const mockedFoo: SampleGeneric<SampleInterface> = mock(SampleGeneric); | ||
| const foo: SampleGeneric<SampleInterface> = instance(mockedFoo); | ||
| ``` | ||
| ### Spying on real objects | ||
| You can partially mock an existing instance: | ||
| ``` typescript | ||
| const foo: Foo = new Foo(); | ||
| const spiedFoo = spy(foo); | ||
| when(spiedFoo.getBar(3)).thenReturn('one'); | ||
| console.log(foo.getBar(3)); // 'one' | ||
| console.log(foo.getBaz()); // call to a real method | ||
| ``` | ||
| You can spy on plain objects too: | ||
| ``` typescript | ||
| const foo = { bar: () => 42 }; | ||
| const spiedFoo = spy(foo); | ||
| foo.bar(); | ||
| console.log(capture(spiedFoo.bar).last()); // [42] | ||
| ``` | ||
| ### Thanks | ||
| * Szczepan Faber (https://www.linkedin.com/in/szczepiq) | ||
| * Sebastian Konkol (https://www.linkedin.com/in/sebastiankonkol) | ||
| * Clickmeeting (http://clickmeeting.com) | ||
| * Michał Stocki (https://github.com/michalstocki) | ||
| * Łukasz Bendykowski (https://github.com/viman) | ||
| * Andrey Ermakov (https://github.com/dreef3) | ||
| * Markus Ende (https://github.com/Markus-Ende) | ||
| * Thomas Hilzendegen (https://github.com/thomashilzendegen) | ||
| * Johan Blumenberg (https://github.com/johanblumenberg) |
| { | ||
| "compilerOptions": { | ||
| "outDir": "./lib", | ||
| "module": "commonjs", | ||
| "moduleResolution": "node", | ||
| "target": "es5", | ||
| "removeComments": true, | ||
| "sourceMap": true, | ||
| "declaration": true, | ||
| "lib": [ | ||
| "es5", | ||
| "es6", | ||
| "dom" | ||
| ], | ||
| "types": [ | ||
| "node", | ||
| "lodash", | ||
| "jasmine" | ||
| ] | ||
| } | ||
| } |
@@ -82,3 +82,3 @@ 'use strict'; | ||
| get packageJson() { | ||
| return require('package.json'); | ||
| return require('../../../../package.json'); | ||
| } | ||
@@ -85,0 +85,0 @@ get channel() { |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"applicationEnvironment.js","sourceRoot":"","sources":["../../../../src/client/common/application/applicationEnvironment.ts"],"names":[],"mappings":"AAGA,YAAY,CAAC;;;;;;;;;;;;AAEb,yCAA+C;AAC/C,6BAA6B;AAC7B,mCAA+B;AAC/B,iCAAiC;AACjC,2CAA2C;AAE3C,6CAAqD;AACrD,oCAAuD;AACvD,gDAA2C;AAI3C,IAAa,sBAAsB,GAAnC,MAAa,sBAAsB;IAC/B,YAC+C,QAA0B,EAChC,SAAqB,EAChB,OAAwB;QAFvB,aAAQ,GAAR,QAAQ,CAAkB;QAChC,cAAS,GAAT,SAAS,CAAY;QAChB,YAAO,GAAP,OAAO,CAAiB;IACnE,CAAC;IAEJ,IAAW,gBAAgB;QACvB,MAAM,gBAAgB,GAAG,IAAI,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,MAAM,CAAC;QAClF,QAAQ,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;YAC1B,KAAK,iBAAM,CAAC,GAAG;gBACX,OAAO,IAAI,CAAC,IAA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AAA,cAAK,EAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAEhD,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC;IACvG,CAAC;IACD,IAAW,SAAS;QAChB,OAAO,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC;IAChC,CAAC;CACJ,CAAA;AAtFY,sBAAsB;IADlC,IAAA,sBAAU,GAAE;IAGJ,WAAA,IAAA,kBAAM,EAAC,wBAAgB,CAAC,CAAA;IACxB,WAAA,IAAA,kBAAM,EAAC,kBAAU,CAAC,CAAA;IAClB,WAAA,IAAA,kBAAM,EAAC,uBAAe,CAAC,CAAA;GAJnB,sBAAsB,CAsFlC;AAtFY,wDAAsB"} |
@@ -91,3 +91,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| public get packageJson(): any { | ||
| return require('package.json'); | ||
| return require('../../../../package.json'); | ||
| } | ||
@@ -94,0 +94,0 @@ public get channel(): Channel { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display