opds-web-client
Version:
43 lines (42 loc) • 1.5 kB
JavaScript
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var sinon_1 = require("sinon");
var DataFetcher_1 = require("../DataFetcher");
var MockDataFetcher = (function (_super) {
__extends(MockDataFetcher, _super);
function MockDataFetcher() {
_super.apply(this, arguments);
this.resolve = true;
this.testData = "test";
}
MockDataFetcher.prototype.fetchOPDSData = function (url) {
return this.fetch(url);
};
MockDataFetcher.prototype.fetchSearchDescriptionData = function (url) {
return this.fetch(url);
};
MockDataFetcher.prototype.fetch = function (url) {
var _this = this;
return new Promise(function (resolve, reject) {
if (_this.resolve) {
resolve(_this.testData);
}
else {
reject("test error");
}
});
};
MockDataFetcher.prototype.getBasicAuthCredentials = function () {
return "credentials";
};
return MockDataFetcher;
}(DataFetcher_1.default));
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = MockDataFetcher;
;
MockDataFetcher.prototype.setBasicAuthCredentials = sinon_1.stub();
MockDataFetcher.prototype.clearBasicAuthCredentials = sinon_1.stub();
;