UNPKG

safe-mock

Version:

Type Safe Mocking Library written for Typescript and Javascript

34 lines (33 loc) 1.32 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var LookupResult = /** @class */ (function () { function LookupResult(returnFound, _whyNoReturnValueMatched, _returnValue) { this.returnFound = returnFound; this._whyNoReturnValueMatched = _whyNoReturnValueMatched; this._returnValue = _returnValue; } LookupResult.noReturnValueMatched = function (whyNoReturnValueMatched) { return new LookupResult(false, whyNoReturnValueMatched); }; LookupResult.returnValueFound = function (returnValue) { return new LookupResult(true, undefined, returnValue); }; Object.defineProperty(LookupResult.prototype, "whyNoReturnValueMatched", { get: function () { if (this.returnFound) { throw new Error('Return Found. No WhyNoReturnValueMatched available!'); } return this._whyNoReturnValueMatched; }, enumerable: true, configurable: true }); LookupResult.prototype.performMockedReturnValue = function () { if (!this.returnFound) { throw new Error('No Return Found. No Return available!'); } return this._returnValue.performMockedReturnValue(); }; return LookupResult; }()); exports.default = LookupResult;