UNPKG

playable

Version:

Video player based on HTML5Video

39 lines 2.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); require("jsdom-global"); var chai_1 = require("chai"); var detect_stream_type_1 = require("./detect-stream-type"); var constants_1 = require("../../../constants"); describe('Stream type auto detection', function () { var testURL = 'http://mocked-domain.com/some/internalPath/'; var formatsToTest = [ { type: constants_1.MediaStreamType.MP4, fileName: 'video.mp4' }, { type: constants_1.MediaStreamType.WEBM, fileName: 'video.webm' }, { type: constants_1.MediaStreamType.HLS, fileName: 'video.m3u8' }, { type: constants_1.MediaStreamType.DASH, fileName: 'video.mpd' }, ]; formatsToTest.forEach(function (formatToTest) { it("should detect ".concat(formatToTest.type, " URLs"), function () { var URL = testURL + formatToTest.fileName; (0, chai_1.expect)((0, detect_stream_type_1.getStreamType)(URL)).to.equal(formatToTest.type); }); }); describe('when receive ULR', function () { var mp4URL = testURL + 'video.mp4'; var queryParam = '?data=true'; var fragment = '#sectionOnPage'; it('should detect type even if it has query params', function () { (0, chai_1.expect)((0, detect_stream_type_1.getStreamType)(mp4URL + queryParam)).to.equal(constants_1.MediaStreamType.MP4); }); it('should detect type even if it has fragments', function () { (0, chai_1.expect)((0, detect_stream_type_1.getStreamType)(mp4URL + fragment)).to.equal(constants_1.MediaStreamType.MP4); }); it('should detect type even if it has fragments and params', function () { (0, chai_1.expect)((0, detect_stream_type_1.getStreamType)(mp4URL + queryParam + fragment)).to.equal(constants_1.MediaStreamType.MP4); }); }); it("should throw error if can't parse url", function () { (0, chai_1.expect)((0, detect_stream_type_1.getStreamType)('test.url')).to.equal(false); }); }); //# sourceMappingURL=detect-stream-type.spec.js.map