@baizey/dependency-injection
Version:
A simple typescript dependency injection
56 lines (55 loc) • 2.3 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.ShouldBeMockedDependencyError = void 0;
var types_1 = require("./types");
var ShouldBeMockedDependencyError = /** @class */ (function (_super) {
__extends(ShouldBeMockedDependencyError, _super);
function ShouldBeMockedDependencyError(lifetime, property, access) {
var _this = _super.call(this, "".concat(access, " ").concat(lifetime, ".").concat(property, " has been accessed, but it has a throw exception mocking strategy")) || this;
Object.defineProperty(_this, "type", {
enumerable: true,
configurable: true,
writable: true,
value: types_1.DependencyErrorType.ShouldBeMocked
});
Object.defineProperty(_this, "lifetime", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(_this, "property", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(_this, "access", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
_this.lifetime = lifetime;
_this.property = property;
_this.access = access;
return _this;
}
return ShouldBeMockedDependencyError;
}(Error));
exports.ShouldBeMockedDependencyError = ShouldBeMockedDependencyError;