UNPKG

opds-web-client

Version:
44 lines (43 loc) 1.57 kB
"use strict"; 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() { var _this = _super.apply(this, arguments) || this; _this.resolve = true; _this.testData = "test"; return _this; } 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.getAuthCredentials = function () { return { provider: "test", credentials: "credentials" }; }; return MockDataFetcher; }(DataFetcher_1.default)); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = MockDataFetcher; ; MockDataFetcher.prototype.setAuthCredentials = sinon_1.stub(); MockDataFetcher.prototype.clearAuthCredentials = sinon_1.stub();