ts-mock-imports
Version:
Intuitive mocking for Typescript class imports
44 lines • 1.77 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.OtherManager = void 0;
var manager_1 = require("./manager");
var OtherManager = (function (_super) {
__extends(OtherManager, _super);
function OtherManager(module, importName, replaceWith) {
var _this = _super.call(this, module, importName) || this;
_this.module = module;
_this.importName = importName;
if (replaceWith) {
_this.replace(replaceWith);
}
return _this;
}
OtherManager.prototype.set = function (replaceWith) {
this.replace(replaceWith);
};
OtherManager.prototype.getValue = function () {
return this.replaceWith;
};
OtherManager.prototype.replace = function (replaceWith) {
this.replaceWith = replaceWith;
this.module[this.importName] = replaceWith;
};
return OtherManager;
}(manager_1.Manager));
exports.OtherManager = OtherManager;
//# sourceMappingURL=other-manager.js.map