UNPKG

flagpole

Version:

Simple and fast DOM integration, headless or headful browser, and REST API testing framework.

69 lines 3.13 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getRequestAdapter = exports.createResponse = void 0; const htmlresponse_1 = require("./html/htmlresponse"); const resourceresponse_1 = require("./resourceresponse"); const browserresponse_1 = require("./puppeteer/browserresponse"); const cssresponse_1 = require("./css/cssresponse"); const imageresponse_1 = require("./imageresponse"); const jsonresponse_1 = require("./json/jsonresponse"); const scriptresponse_1 = require("./scriptresponse"); const videoresponse_1 = require("./media/videoresponse"); const extjsresponse_1 = require("./puppeteer/extjsresponse"); const xmlresponse_1 = require("./xml/xmlresponse"); const rssresponse_1 = require("./xml/rssresponse"); const atomresponse_1 = require("./xml/atomresponse"); const headersresponse_1 = require("./headersresponse"); const hlsresponse_1 = require("./media/hlsresponse"); const ffproberesponse_1 = require("./media/ffproberesponse"); const mediastreamvalidatorresponse_1 = require("./media/mediastreamvalidatorresponse"); const needle_1 = require("./adapters/needle"); const ffprobe_1 = require("./adapters/ffprobe"); const mediastreamvalidator_1 = require("./adapters/mediastreamvalidator"); const image_1 = require("./adapters/image"); const typeToClassMap = { html: htmlresponse_1.HtmlResponse, browser: browserresponse_1.BrowserResponse, extjs: extjsresponse_1.ExtJSResponse, stylesheet: cssresponse_1.CssResponse, image: imageresponse_1.ImageResponse, json: jsonresponse_1.JsonResponse, script: scriptresponse_1.ScriptResponse, xml: xmlresponse_1.XmlResponse, rss: rssresponse_1.RssResponse, atom: atomresponse_1.AtomResponse, headers: headersresponse_1.HeadersResponse, video: videoresponse_1.VideoResponse, hls: hlsresponse_1.HLSResponse, ffprobe: ffproberesponse_1.FfprobeResponse, resource: resourceresponse_1.ResourceResponse, audio: resourceresponse_1.ResourceResponse, mediastreamvalidator: mediastreamvalidatorresponse_1.MediaStreamValidatorResponse, }; const typeToFetchAdapter = { html: needle_1.fetchWithNeedle, json: needle_1.fetchWithNeedle, script: needle_1.fetchWithNeedle, stylesheet: needle_1.fetchWithNeedle, xml: needle_1.fetchWithNeedle, rss: needle_1.fetchWithNeedle, atom: needle_1.fetchWithNeedle, headers: needle_1.fetchWithNeedle, video: needle_1.fetchWithNeedle, audio: needle_1.fetchWithNeedle, hls: needle_1.fetchWithNeedle, resource: needle_1.fetchWithNeedle, ffprobe: ffprobe_1.fetchWithFfprobe, mediastreamvalidator: mediastreamvalidator_1.fetchWithMediaStreamValidator, image: image_1.fetchImageWithNeedle, }; function createResponse(scenario) { const className = typeToClassMap[scenario.responseType] || resourceresponse_1.ResourceResponse; return new className(scenario); } exports.createResponse = createResponse; const getRequestAdapter = (scenario) => { return typeToFetchAdapter[scenario.responseType]; }; exports.getRequestAdapter = getRequestAdapter; //# sourceMappingURL=scenario-type-map.js.map