diff --git a/.eslintrc b/.eslintrc index ed1ceb0af8..efe15b8783 100644 --- a/.eslintrc +++ b/.eslintrc @@ -21,6 +21,7 @@ "no-use-before-define": 0, "strict": 0, "no-loop-func": 0, + "no-multi-spaces": "error", "quotes": [ "error", "single", diff --git a/src/core/errors/Errors.js b/src/core/errors/Errors.js index f14488d4c4..375c0c1932 100644 --- a/src/core/errors/Errors.js +++ b/src/core/errors/Errors.js @@ -29,12 +29,13 @@ * POSSIBILITY OF SUCH DAMAGE. */ import ErrorsBase from './ErrorsBase'; + /** * Errors declaration * @class */ class Errors extends ErrorsBase { - constructor () { + constructor() { super(); /** @@ -100,53 +101,53 @@ class Errors extends ErrorsBase { /** * Error code returned when Protected contents are not supported */ - this.CAPABILITY_MEDIAKEYS_ERROR_CODE = 24; + this.CAPABILITY_MEDIAKEYS_ERROR_CODE = 24; /** * Error code returned when loading the manifest failed */ - this.DOWNLOAD_ERROR_ID_MANIFEST_CODE = 25; + this.DOWNLOAD_ERROR_ID_MANIFEST_CODE = 25; /** * Error code returned when loading the sidx failed */ - this.DOWNLOAD_ERROR_ID_SIDX_CODE = 26; + this.DOWNLOAD_ERROR_ID_SIDX_CODE = 26; /** * Error code returned when loading the media content failed */ - this.DOWNLOAD_ERROR_ID_CONTENT_CODE = 27; + this.DOWNLOAD_ERROR_ID_CONTENT_CODE = 27; /** * Error code returned when loading the init segment failed */ - this.DOWNLOAD_ERROR_ID_INITIALIZATION_CODE = 28; + this.DOWNLOAD_ERROR_ID_INITIALIZATION_CODE = 28; /** * Error code returned when loading the XLink content failed */ - this.DOWNLOAD_ERROR_ID_XLINK_CODE = 29; + this.DOWNLOAD_ERROR_ID_XLINK_CODE = 29; /** * Error code returned when parsing the MPD resulted in a logical error */ - this.MANIFEST_ERROR_ID_PARSE_CODE = 31; + this.MANIFEST_ERROR_ID_PARSE_CODE = 31; /** * Error code returned when no stream (period) has been detected in the manifest */ - this.MANIFEST_ERROR_ID_NOSTREAMS_CODE = 32; + this.MANIFEST_ERROR_ID_NOSTREAMS_CODE = 32; /** * Error code returned when something wrong has happened during parsing and appending subtitles (TTML or VTT) */ - this.TIMED_TEXT_ERROR_ID_PARSE_CODE = 33; + this.TIMED_TEXT_ERROR_ID_PARSE_CODE = 33; /** * Error code returned when a 'muxed' media type has been detected in the manifest. This type is not supported */ - this.MANIFEST_ERROR_ID_MULTIPLEXED_CODE = 34; + this.MANIFEST_ERROR_ID_MULTIPLEXED_CODE = 34; /** * Error code returned when a media source type is not supported diff --git a/src/dash/parser/DashParser.js b/src/dash/parser/DashParser.js index cc417c7b14..9a75400c7a 100644 --- a/src/dash/parser/DashParser.js +++ b/src/dash/parser/DashParser.js @@ -58,18 +58,18 @@ function DashParser(config) { new DateTimeMatcher(), new NumericMatcher(), new LangMatcher(), - new StringMatcher() // last in list to take precedence over NumericMatcher + new StringMatcher()// last in list to take precedence over NumericMatcher ]; converter = new X2JS({ - escapeMode: false, - attributePrefix: '', - arrayAccessForm: 'property', - emptyNodeForm: 'object', - stripWhitespaces: false, + escapeMode: false, + attributePrefix: '', + arrayAccessForm: 'property', + emptyNodeForm: 'object', + stripWhitespaces: false, enableToStringFunc: true, - ignoreRoot: false, - matchers: matchers + ignoreRoot: false, + matchers: matchers }); objectIron = ObjectIron(context).create({ diff --git a/src/mss/MssFragmentMoofProcessor.js b/src/mss/MssFragmentMoofProcessor.js index 61dfd20942..8887210019 100644 --- a/src/mss/MssFragmentMoofProcessor.js +++ b/src/mss/MssFragmentMoofProcessor.js @@ -151,8 +151,7 @@ function MssFragmentMoofProcessor(config) { } } return; - } - else { + } else { // In case of live streams, update segment timeline according to DVR window if (manifest.timeShiftBufferDepth && manifest.timeShiftBufferDepth > 0) { // Get timestamp of the last segment @@ -173,7 +172,7 @@ function MssFragmentMoofProcessor(config) { // logger.debug('Remove segment - t = ' + (segment.t / timescale)); segments.splice(0, 1); segment = segments[0]; - endTime = (segment.t + segment.d) / timescale; + endTime = (segment.t + segment.d) / timescale; } } diff --git a/src/streaming/XlinkLoader.js b/src/streaming/XlinkLoader.js index 814def45f9..4fba7ba66d 100644 --- a/src/streaming/XlinkLoader.js +++ b/src/streaming/XlinkLoader.js @@ -42,7 +42,7 @@ function XlinkLoader(config) { config = config || {}; const RESOLVE_TO_ZERO = 'urn:mpeg:dash:resolve-to-zero:2013'; - const context = this.context; + const context = this.context; const eventBus = EventBus(context).getInstance(); let urlLoader = URLLoader(context).create({ diff --git a/src/streaming/controllers/CatchupController.js b/src/streaming/controllers/CatchupController.js index cc8f586d86..2627945d1b 100644 --- a/src/streaming/controllers/CatchupController.js +++ b/src/streaming/controllers/CatchupController.js @@ -179,10 +179,10 @@ function CatchupController() { */ function _onPlaybackProgression() { if ( - playbackController.getIsDynamic() && - mediaPlayerModel.getCatchupModeEnabled() && - ((mediaPlayerModel.getCatchupPlaybackRates().max > 0) || (mediaPlayerModel.getCatchupPlaybackRates().min < 0)) && - !playbackController.isPaused() && + playbackController.getIsDynamic() && + mediaPlayerModel.getCatchupModeEnabled() && + ((mediaPlayerModel.getCatchupPlaybackRates().max > 0) || (mediaPlayerModel.getCatchupPlaybackRates().min < 0)) && + !playbackController.isPaused() && !playbackController.isSeeking() && _shouldStartCatchUp() ) { _startPlaybackCatchUp(); @@ -234,7 +234,7 @@ function CatchupController() { const minPlaybackRateChange = isSafari ? 0.25 : 0.02 / (0.5 / liveCatchupPlaybackRates.max); // Obtain newRate and apply to video model. Don't change playbackrate for small variations (don't overload element with playbackrate changes) - if (newRate && Math.abs(currentPlaybackRate - newRate) >= minPlaybackRateChange) { // non-null + if (newRate && Math.abs(currentPlaybackRate - newRate) >= minPlaybackRateChange) { // non-null logger.debug(`[CatchupController]: Setting playback rate to ${newRate}`); videoModel.setPlaybackRate(newRate); } @@ -382,7 +382,7 @@ function CatchupController() { if (bufferLevel < playbackBufferMin) { // Buffer in danger, slow down const cpr = Math.abs(liveCatchUpPlaybackRates.min); // Absolute value as negative delta value will be used. - const deltaBuffer = bufferLevel - playbackBufferMin; // -ve value + const deltaBuffer = bufferLevel - playbackBufferMin; // -ve value const d = deltaBuffer * 5; // Playback rate must be between (1 - cpr) - (1 + cpr) diff --git a/src/streaming/metrics/utils/DVBErrorsTranslator.js b/src/streaming/metrics/utils/DVBErrorsTranslator.js index 39b1fc1972..00e2ef52be 100644 --- a/src/streaming/metrics/utils/DVBErrorsTranslator.js +++ b/src/streaming/metrics/utils/DVBErrorsTranslator.js @@ -89,10 +89,10 @@ function DVBErrorsTranslator(config) { } function handleHttpMetric(vo) { - if ((vo.responsecode === 0) || // connection failure - unknown + if ((vo.responsecode === 0) || // connection failure - unknown (vo.responsecode == null) || // Generated on .catch() and when uninitialized (vo.responsecode >= 400) || // HTTP error status code - (vo.responsecode < 100) || // unknown status codes + (vo.responsecode < 100) || // unknown status codes (vo.responsecode >= 600)) { // unknown status codes report({ errorcode: vo.responsecode || DVBErrors.CONNECTION_ERROR, diff --git a/src/streaming/metrics/vo/DVBErrors.js b/src/streaming/metrics/vo/DVBErrors.js index 8643a84f4c..ba4a4c6015 100644 --- a/src/streaming/metrics/vo/DVBErrors.js +++ b/src/streaming/metrics/vo/DVBErrors.js @@ -85,13 +85,13 @@ class DVBErrors { } DVBErrors.SSL_CONNECTION_FAILED_PREFIX = 'SSL'; -DVBErrors.DNS_RESOLUTION_FAILED = 'C00'; -DVBErrors.HOST_UNREACHABLE = 'C01'; -DVBErrors.CONNECTION_REFUSED = 'C02'; -DVBErrors.CONNECTION_ERROR = 'C03'; -DVBErrors.CORRUPT_MEDIA_ISOBMFF = 'M00'; -DVBErrors.CORRUPT_MEDIA_OTHER = 'M01'; -DVBErrors.BASE_URL_CHANGED = 'F00'; -DVBErrors.BECAME_REPORTER = 'S00'; +DVBErrors.DNS_RESOLUTION_FAILED = 'C00'; +DVBErrors.HOST_UNREACHABLE = 'C01'; +DVBErrors.CONNECTION_REFUSED = 'C02'; +DVBErrors.CONNECTION_ERROR = 'C03'; +DVBErrors.CORRUPT_MEDIA_ISOBMFF = 'M00'; +DVBErrors.CORRUPT_MEDIA_OTHER = 'M01'; +DVBErrors.BASE_URL_CHANGED = 'F00'; +DVBErrors.BECAME_REPORTER = 'S00'; export default DVBErrors; diff --git a/src/streaming/models/ManifestModel.js b/src/streaming/models/ManifestModel.js index 841d72694c..ae6061c825 100644 --- a/src/streaming/models/ManifestModel.js +++ b/src/streaming/models/ManifestModel.js @@ -47,7 +47,7 @@ function ManifestModel() { function setValue(value) { manifest = value; if (value) { - eventBus.trigger(Events.MANIFEST_LOADED, { data: value }); + eventBus.trigger(Events.MANIFEST_LOADED, { data: value }); } } diff --git a/src/streaming/protection/Protection.js b/src/streaming/protection/Protection.js index 8b3044d991..1481419f21 100644 --- a/src/streaming/protection/Protection.js +++ b/src/streaming/protection/Protection.js @@ -119,7 +119,7 @@ function Protection() { protectionKeyController.setConfig({ debug: config.debug, BASE64: config.BASE64, settings: config.settings }); protectionKeyController.initialize(); - let protectionModel = _getProtectionModel(config); + let protectionModel = _getProtectionModel(config); if (!controller && protectionModel) {//TODO add ability to set external controller if still needed at all? controller = ProtectionController(context).create({ @@ -131,7 +131,7 @@ function Protection() { BASE64: config.BASE64, constants: config.constants, cmcdModel: config.cmcdModel, - customParametersModel : config.customParametersModel, + customParametersModel: config.customParametersModel, settings: config.settings }); config.capabilities.setEncryptedMediaSupported(true); @@ -149,13 +149,28 @@ function Protection() { if ((!videoElement || videoElement.onencrypted !== undefined) && (!videoElement || videoElement.mediaKeys !== undefined)) { logger.info('EME detected on this user agent! (ProtectionModel_21Jan2015)'); - return ProtectionModel_21Jan2015(context).create({ debug: debug, eventBus: eventBus, events: config.events }); + return ProtectionModel_21Jan2015(context).create({ + debug: debug, + eventBus: eventBus, + events: config.events + }); } else if (_getAPI(videoElement, APIS_ProtectionModel_3Feb2014)) { logger.info('EME detected on this user agent! (ProtectionModel_3Feb2014)'); - return ProtectionModel_3Feb2014(context).create({ debug: debug, eventBus: eventBus, events: config.events, api: _getAPI(videoElement, APIS_ProtectionModel_3Feb2014) }); + return ProtectionModel_3Feb2014(context).create({ + debug: debug, + eventBus: eventBus, + events: config.events, + api: _getAPI(videoElement, APIS_ProtectionModel_3Feb2014) + }); } else if (_getAPI(videoElement, APIS_ProtectionModel_01b)) { logger.info('EME detected on this user agent! (ProtectionModel_01b)'); - return ProtectionModel_01b(context).create({ debug: debug, eventBus: eventBus, errHandler: errHandler, events: config.events, api: _getAPI(videoElement, APIS_ProtectionModel_01b) }); + return ProtectionModel_01b(context).create({ + debug: debug, + eventBus: eventBus, + errHandler: errHandler, + events: config.events, + api: _getAPI(videoElement, APIS_ProtectionModel_01b) + }); } else { logger.warn('No supported version of EME detected on this user agent! - Attempts to play encrypted content will fail!'); return null; diff --git a/src/streaming/protection/ProtectionEvents.js b/src/streaming/protection/ProtectionEvents.js index 90fc691f0c..dd5789213b 100644 --- a/src/streaming/protection/ProtectionEvents.js +++ b/src/streaming/protection/ProtectionEvents.js @@ -29,16 +29,17 @@ * POSSIBILITY OF SUCH DAMAGE. */ import EventsBase from '../../core/events/EventsBase'; + /** * @class - */ + */ class ProtectionEvents extends EventsBase { /** * @description Public facing external events to be used when including protection package. * All public events will be aggregated into the MediaPlayerEvents Class and can be accessed * via MediaPlayer.events. public_ is the prefix that we use to move event names to MediaPlayerEvents. */ - constructor () { + constructor() { super(); /** @@ -164,7 +165,7 @@ class ProtectionEvents extends EventsBase { * a protection set has completed * @ignore */ - this.TEARDOWN_COMPLETE = 'protectionTeardownComplete'; + this.TEARDOWN_COMPLETE = 'protectionTeardownComplete'; /** * Event ID for events delivered when a HTMLMediaElement has been diff --git a/src/streaming/rules/abr/BolaRule.js b/src/streaming/rules/abr/BolaRule.js index cbc80d7b09..f00455b91f 100644 --- a/src/streaming/rules/abr/BolaRule.js +++ b/src/streaming/rules/abr/BolaRule.js @@ -34,7 +34,7 @@ import MetricsConstants from '../../constants/MetricsConstants'; import SwitchRequest from '../SwitchRequest'; import FactoryMaker from '../../../core/FactoryMaker'; -import { HTTPRequest } from '../../vo/metrics/HTTPRequest'; +import {HTTPRequest} from '../../vo/metrics/HTTPRequest'; import EventBus from '../../../core/EventBus'; import Events from '../../../core/events/Events'; import Debug from '../../../core/Debug'; @@ -45,9 +45,9 @@ import Constants from '../../constants/Constants'; // BOLA_STATE_STARTUP : Set placeholder buffer such that we download fragments at most recently measured throughput. // BOLA_STATE_STEADY : Buffer primed, we switch to steady operation. // TODO: add BOLA_STATE_SEEK and tune BOLA behavior on seeking -const BOLA_STATE_ONE_BITRATE = 0; -const BOLA_STATE_STARTUP = 1; -const BOLA_STATE_STEADY = 2; +const BOLA_STATE_ONE_BITRATE = 0; +const BOLA_STATE_STARTUP = 1; +const BOLA_STATE_STEADY = 2; const MINIMUM_BUFFER_S = 10; // BOLA should never add artificial delays if buffer is less than MINIMUM_BUFFER_S. const MINIMUM_BUFFER_PER_BITRATE_LEVEL_S = 2; @@ -107,7 +107,7 @@ function BolaRule(config) { const Vp = MINIMUM_BUFFER_S / gp; // note that expressions for gp and Vp assume utilities[0] === 1, which is true because of normalization - return {gp: gp, Vp: Vp}; + return { gp: gp, Vp: Vp }; } function getInitialBolaState(rulesContext) { diff --git a/src/streaming/rules/abr/lolp/LearningAbrController.js b/src/streaming/rules/abr/lolp/LearningAbrController.js index 552e93122d..2b20ae071e 100644 --- a/src/streaming/rules/abr/lolp/LearningAbrController.js +++ b/src/streaming/rules/abr/lolp/LearningAbrController.js @@ -354,7 +354,7 @@ function LearningAbrController() { } // Dynamic Weights Selector (step 2/2: find weights) let weightVector = dynamicWeightsSelector.findWeightVector(somElements, currentLatency, currentBuffer, rebuffer, currentThroughput, playbackRate); - if (weightVector !== null && weightVector !== -1) { // null: something went wrong, -1: constraints not met + if (weightVector !== null && weightVector !== -1) { // null: something went wrong, -1: constraints not met weights = weightVector; } } diff --git a/src/streaming/rules/abr/lolp/LoLpQoEEvaluator.js b/src/streaming/rules/abr/lolp/LoLpQoEEvaluator.js index deec2e60d1..0eef8d0b6f 100644 --- a/src/streaming/rules/abr/lolp/LoLpQoEEvaluator.js +++ b/src/streaming/rules/abr/lolp/LoLpQoEEvaluator.js @@ -83,8 +83,7 @@ function LoLpQoeEvaluator() { // set some safe value, else consider throwing error if (!fragmentDuration) { qoeInfo.weights.bitrateReward = 1; - } - else { + } else { qoeInfo.weights.bitrateReward = fragmentDuration; } @@ -96,8 +95,7 @@ function LoLpQoeEvaluator() { // set some safe value, else consider throwing error if (!maxBitrateKbps) { qoeInfo.weights.rebufferPenalty = 1000; - } - else { + } else { qoeInfo.weights.rebufferPenalty = maxBitrateKbps; } @@ -107,7 +105,7 @@ function LoLpQoeEvaluator() { qoeInfo.weights.latencyPenalty.push({ threshold: 100000000, penalty: (maxBitrateKbps * 0.1) }); // Set weight: playbackSpeedPenalty - if (!minBitrateKbps) qoeInfo.weights.playbackSpeedPenalty = 200; // set some safe value, else consider throwing error + if (!minBitrateKbps) qoeInfo.weights.playbackSpeedPenalty = 200; // set some safe value, else consider throwing error else qoeInfo.weights.playbackSpeedPenalty = minBitrateKbps; return qoeInfo; diff --git a/src/streaming/rules/abr/lolp/LoLpRule.js b/src/streaming/rules/abr/lolp/LoLpRule.js index 282bc842ec..52b0e7112a 100644 --- a/src/streaming/rules/abr/lolp/LoLpRule.js +++ b/src/streaming/rules/abr/lolp/LoLpRule.js @@ -103,11 +103,11 @@ function LoLPRule(config) { } // QoE parameters - let bitrateList = mediaInfo.bitrateList; // [{bandwidth: 200000, width: 640, height: 360}, ...] + let bitrateList = mediaInfo.bitrateList; // [{bandwidth: 200000, width: 640, height: 360}, ...] let segmentDuration = rulesContext.getRepresentationInfo().fragmentDuration; - let minBitrateKbps = bitrateList[0].bandwidth / 1000.0; // min bitrate level - let maxBitrateKbps = bitrateList[bitrateList.length - 1].bandwidth / 1000.0; // max bitrate level - for (let i = 0; i < bitrateList.length; i++) { // in case bitrateList is not sorted as expected + let minBitrateKbps = bitrateList[0].bandwidth / 1000.0; // min bitrate level + let maxBitrateKbps = bitrateList[bitrateList.length - 1].bandwidth / 1000.0; // max bitrate level + for (let i = 0; i < bitrateList.length; i++) { // in case bitrateList is not sorted as expected let b = bitrateList[i].bandwidth / 1000.0; if (b > maxBitrateKbps) maxBitrateKbps = b; diff --git a/src/streaming/rules/abr/lolp/QoeInfo.js b/src/streaming/rules/abr/lolp/QoeInfo.js index b512ee9147..48bcba38ba 100644 --- a/src/streaming/rules/abr/lolp/QoeInfo.js +++ b/src/streaming/rules/abr/lolp/QoeInfo.js @@ -51,11 +51,11 @@ class QoeInfo { this.weights.playbackSpeedPenalty = null; // Weighted Sum for each Qoe factor - this.bitrateWSum = 0; // kbps - this.bitrateSwitchWSum = 0; // kbps - this.rebufferWSum = 0; // seconds - this.latencyWSum = 0; // seconds - this.playbackSpeedWSum = 0; // e.g. 0.95, 1.0, 1.05 + this.bitrateWSum = 0;// kbps + this.bitrateSwitchWSum = 0;// kbps + this.rebufferWSum = 0;// seconds + this.latencyWSum = 0;// seconds + this.playbackSpeedWSum = 0;// e.g. 0.95, 1.0, 1.05 // Store total Qoe value based on current Weighted Sum values this.totalQoe = 0; diff --git a/src/streaming/utils/CustomTimeRanges.js b/src/streaming/utils/CustomTimeRanges.js index f58e9d4233..50b9e7ef3a 100644 --- a/src/streaming/utils/CustomTimeRanges.js +++ b/src/streaming/utils/CustomTimeRanges.js @@ -1,49 +1,49 @@ /** -* The copyright in this software is being made available under the BSD License, -* included below. This software may be subject to other third party and contributor -* rights, including patent rights, and no such rights are granted under this license. -* -* Copyright (c) 2013, Dash Industry Forum. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, -* are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright notice, this -* list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright notice, -* this list of conditions and the following disclaimer in the documentation and/or -* other materials provided with the distribution. -* * Neither the name of Dash Industry Forum nor the names of its -* contributors may be used to endorse or promote products derived from this software -* without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -* POSSIBILITY OF SUCH DAMAGE. -*/ + * The copyright in this software is being made available under the BSD License, + * included below. This software may be subject to other third party and contributor + * rights, including patent rights, and no such rights are granted under this license. + * + * Copyright (c) 2013, Dash Industry Forum. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * * Neither the name of Dash Industry Forum nor the names of its + * contributors may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ import FactoryMaker from '../../core/FactoryMaker'; -import { checkInteger } from '../utils/SupervisorTools'; +import {checkInteger} from '../utils/SupervisorTools'; function CustomTimeRanges(/*config*/) { let customTimeRangeArray = []; let length = 0; function add(start, end) { - let i = 0; + let i; - for (i = 0; (i < this.customTimeRangeArray.length) && (start > this.customTimeRangeArray[i].start); i++); + for (i = 0; (i < this.customTimeRangeArray.length) && (start > this.customTimeRangeArray[i].start); i++) ; - this.customTimeRangeArray.splice(i, 0, {start: start,end: end}); + this.customTimeRangeArray.splice(i, 0, { start: start, end: end }); for (i = 0; i < this.customTimeRangeArray.length - 1; i++) { - if (this.mergeRanges(i,i + 1)) { + if (this.mergeRanges(i, i + 1)) { i--; } } @@ -66,23 +66,23 @@ function CustomTimeRanges(/*config*/) { // or // |--------------Range i-------| //|--------------Range to remove ---------------| - this.customTimeRangeArray.splice(i,1); + this.customTimeRangeArray.splice(i, 1); i--; } else if (start > this.customTimeRangeArray[i].start && end < this.customTimeRangeArray[i].end) { //|-----------------Range i----------------| // |-------Range to remove -----| - this.customTimeRangeArray.splice(i + 1, 0, {start: end,end: this.customTimeRangeArray[i].end}); + this.customTimeRangeArray.splice(i + 1, 0, { start: end, end: this.customTimeRangeArray[i].end }); this.customTimeRangeArray[i].end = start; break; - } else if ( start > this.customTimeRangeArray[i].start && start < this.customTimeRangeArray[i].end) { + } else if (start > this.customTimeRangeArray[i].start && start < this.customTimeRangeArray[i].end) { //|-----------Range i----------| // |---------Range to remove --------| // or //|-----------------Range i----------------| // |-------Range to remove -----| this.customTimeRangeArray[i].end = start; - } else if ( end > this.customTimeRangeArray[i].start && end < this.customTimeRangeArray[i].end) { + } else if (end > this.customTimeRangeArray[i].start && end < this.customTimeRangeArray[i].end) { // |-----------Range i----------| //|---------Range to remove --------| // or @@ -99,28 +99,28 @@ function CustomTimeRanges(/*config*/) { let range1 = this.customTimeRangeArray[rangeIndex1]; let range2 = this.customTimeRangeArray[rangeIndex2]; - if (range1.start <= range2.start && range2.start <= range1.end && range1.end <= range2.end) { + if (range1.start <= range2.start && range2.start <= range1.end && range1.end <= range2.end) { //|-----------Range1----------| // |-----------Range2----------| range1.end = range2.end; - this.customTimeRangeArray.splice(rangeIndex2,1); + this.customTimeRangeArray.splice(rangeIndex2, 1); return true; } else if (range2.start <= range1.start && range1.start <= range2.end && range2.end <= range1.end) { // |-----------Range1----------| //|-----------Range2----------| range1.start = range2.start; - this.customTimeRangeArray.splice(rangeIndex2,1); + this.customTimeRangeArray.splice(rangeIndex2, 1); return true; } else if (range2.start <= range1.start && range1.start <= range2.end && range1.end <= range2.end) { // |--------Range1-------| //|---------------Range2--------------| - this.customTimeRangeArray.splice(rangeIndex1,1); + this.customTimeRangeArray.splice(rangeIndex1, 1); return true; } else if (range1.start <= range2.start && range2.start <= range1.end && range2.end <= range1.end) { //|-----------------Range1--------------| // |-----------Range2----------| - this.customTimeRangeArray.splice(rangeIndex2,1); + this.customTimeRangeArray.splice(rangeIndex2, 1); return true; } return false; @@ -157,5 +157,6 @@ function CustomTimeRanges(/*config*/) { end: end }; } + CustomTimeRanges.__dashjs_factory_name = 'CustomTimeRanges'; export default FactoryMaker.getClassFactory(CustomTimeRanges); diff --git a/test/unit/dash.DashAdapter.js b/test/unit/dash.DashAdapter.js index 64186d6e50..fa0a0305f0 100644 --- a/test/unit/dash.DashAdapter.js +++ b/test/unit/dash.DashAdapter.js @@ -71,7 +71,10 @@ const manifest_with_supplemental_properties = { Period_asArray: [{ AdaptationSet_asArray: [{ id: 0, mimeType: Constants.VIDEO, - SupplementalProperty_asArray: [{schemeIdUri: 'test:scheme', value: 'value1'},{schemeIdUri: 'test:scheme', value: 'value2'}] + SupplementalProperty_asArray: [{ + schemeIdUri: 'test:scheme', + value: 'value1' + }, { schemeIdUri: 'test:scheme', value: 'value2' }] }] }] }; @@ -86,17 +89,17 @@ const manifest_with_supplemental_properties_on_repr = { { id: 10, bandwidth: 128000, [DashConstants.SUPPLEMENTAL_PROPERTY_ASARRAY]: [ - {schemeIdUri: 'test:scheme', value: 'value1'}, - {schemeIdUri: 'test:scheme', value: 'value2'}, - {schemeIdUri: 'test:scheme', value: 'value3'} + { schemeIdUri: 'test:scheme', value: 'value1' }, + { schemeIdUri: 'test:scheme', value: 'value2' }, + { schemeIdUri: 'test:scheme', value: 'value3' } ] }, { id: 11, bandwidth: 160000, [DashConstants.SUPPLEMENTAL_PROPERTY_ASARRAY]: [ - {schemeIdUri: 'test:scheme', value: 'value1'}, - {schemeIdUri: 'test:scheme', value: 'value2'}, - {schemeIdUri: 'test:scheme', value: 'value3'} + { schemeIdUri: 'test:scheme', value: 'value1' }, + { schemeIdUri: 'test:scheme', value: 'value2' }, + { schemeIdUri: 'test:scheme', value: 'value3' } ] } ] @@ -113,8 +116,8 @@ const manifest_with_supplemental_properties_on_only_one_repr = { { id: 10, bandwidth: 128000, [DashConstants.SUPPLEMENTAL_PROPERTY_ASARRAY]: [ - {schemeIdUri: 'test:scheme', value: 'value1'}, - {schemeIdUri: 'test:scheme', value: 'value2'} + { schemeIdUri: 'test:scheme', value: 'value1' }, + { schemeIdUri: 'test:scheme', value: 'value2' } ] }, { @@ -134,8 +137,8 @@ const manifest_with_audioChanCfg = { AdaptationSet_asArray: [{ id: 0, mimeType: Constants.AUDIO, [DashConstants.AUDIOCHANNELCONFIGURATION_ASARRAY]: [ - {schemeIdUri: 'urn:mpeg:mpegB:cicp:ChannelConfiguration', value: '6'}, - {schemeIdUri: 'tag:dolby.com,2014:dash:audio_channel_configuration:2011', value: '0xF801'} + { schemeIdUri: 'urn:mpeg:mpegB:cicp:ChannelConfiguration', value: '6' }, + { schemeIdUri: 'tag:dolby.com,2014:dash:audio_channel_configuration:2011', value: '0xF801' } ] }] }] @@ -146,27 +149,27 @@ const manifest_with_audioChanCfg_Repr = { Period_asArray: [{ AdaptationSet_asArray: [{ id: 0, mimeType: Constants.AUDIO, - [DashConstants.REPRESENTATION_ASARRAY]:[ + [DashConstants.REPRESENTATION_ASARRAY]: [ { id: 11, bandwidth: 128000, [DashConstants.AUDIOCHANNELCONFIGURATION_ASARRAY]: [ - {schemeIdUri: 'urn:mpeg:mpegB:cicp:ChannelConfiguration', value: '6'}, - {schemeIdUri: 'urn:mpeg:dash:23003:3:audio_channel_configuration:2011', value: '6'}, - {schemeIdUri: 'tag:dolby.com,2014:dash:audio_channel_configuration:2011', value: '0xF801'} + { schemeIdUri: 'urn:mpeg:mpegB:cicp:ChannelConfiguration', value: '6' }, + { schemeIdUri: 'urn:mpeg:dash:23003:3:audio_channel_configuration:2011', value: '6' }, + { schemeIdUri: 'tag:dolby.com,2014:dash:audio_channel_configuration:2011', value: '0xF801' } ] - },{ + }, { id: 12, bandwidth: 96000, [DashConstants.AUDIOCHANNELCONFIGURATION_ASARRAY]: [ - {schemeIdUri: 'urn:mpeg:mpegB:cicp:ChannelConfiguration', value: '21'}, - {schemeIdUri: 'urn:mpeg:mpegB:cicp:ChannelConfiguration', value: '2'}, - {schemeIdUri: 'urn:mpeg:dash:23003:3:audio_channel_configuration:2011', value: '2'}, - {schemeIdUri: 'tag:dolby.com,2014:dash:audio_channel_configuration:2011', value: '0xA000'} + { schemeIdUri: 'urn:mpeg:mpegB:cicp:ChannelConfiguration', value: '21' }, + { schemeIdUri: 'urn:mpeg:mpegB:cicp:ChannelConfiguration', value: '2' }, + { schemeIdUri: 'urn:mpeg:dash:23003:3:audio_channel_configuration:2011', value: '2' }, + { schemeIdUri: 'tag:dolby.com,2014:dash:audio_channel_configuration:2011', value: '0xA000' } ] } ], [DashConstants.VIEWPOINT_ASARRAY]: [ - {schemeIdUri: 'urn:scheme:viewpoint', value: 'VP1'}, - {schemeIdUri: 'urn:scheme:viewpoint', value: 'VP2'} + { schemeIdUri: 'urn:scheme:viewpoint', value: 'VP1' }, + { schemeIdUri: 'urn:scheme:viewpoint', value: 'VP2' } ] }] }] @@ -187,21 +190,21 @@ describe('DashAdapter', function () { dashAdapter.reset(); const eventsArray = dashAdapter.getEventsFor(); - expect(eventsArray).to.be.instanceOf(Array); // jshint ignore:line - expect(eventsArray).to.be.empty; // jshint ignore:line + expect(eventsArray).to.be.instanceOf(Array); + expect(eventsArray).to.be.empty; }); it('should return an empty array when getAllMediaInfoForType is called and voPeriods is an empty array', function () { const mediaInfoArray = dashAdapter.getAllMediaInfoForType(); - expect(mediaInfoArray).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray).to.be.empty; // jshint ignore:line + expect(mediaInfoArray).to.be.instanceOf(Array); + expect(mediaInfoArray).to.be.empty; }); it('should return null when updatePeriods is called and newManifest is undefined', function () { const returnValue = dashAdapter.updatePeriods(); - expect(returnValue).to.be.null; // jshint ignore:line + expect(returnValue).to.be.null; }); it('should throw an error when updatePeriods is called and newManifest parameter is defined, while setConfig has not been called', function () { @@ -211,43 +214,43 @@ describe('DashAdapter', function () { it('should return null when getMediaInfoForType is called and voPeriods is an empty array', function () { const mediaInfo = dashAdapter.getMediaInfoForType(); - expect(mediaInfo).to.be.null; // jshint ignore:line + expect(mediaInfo).to.be.null; }); it('should return null when getEvent is called and no parameter is set', function () { const event = dashAdapter.getEvent(); - expect(event).to.be.null; // jshint ignore:line + expect(event).to.be.null; }); it('should return null when getEvent is called and an empty eventBox parameter is set and eventStreams is undefined', function () { const event = dashAdapter.getEvent({}); - expect(event).to.be.null; // jshint ignore:line + expect(event).to.be.null; }); it('should return null when getEvent is called and an empty eventBox and eventStreams parameters are set', function () { const event = dashAdapter.getEvent({}, []); - expect(event).to.be.null; // jshint ignore:line + expect(event).to.be.null; }); it('should return null when getEvent is called and no media start time is set', function () { const event = dashAdapter.getEvent({ scheme_id_uri: 'id', value: 'value' }, { 'id/value': {} }); - expect(event).to.be.null; // jshint ignore:line + expect(event).to.be.null; }); it('should return null when getEvent is called and no representation is set', function () { const event = dashAdapter.getEvent({ scheme_id_uri: 'id', value: 'value' }, { 'id/value': {} }, 0); - expect(event).to.be.null; // jshint ignore:line + expect(event).to.be.null; }); it('should return null when getEvent is called and no period is set in the representation', function () { const event = dashAdapter.getEvent({ scheme_id_uri: 'id', value: 'value' }, { 'id/value': {} }, 0, {}); - expect(event).to.be.null; // jshint ignore:line + expect(event).to.be.null; }); it('should return an empty event object when getEvent is called and parameters are set', function () { @@ -335,65 +338,65 @@ describe('DashAdapter', function () { it('should return undefined when getRealAdaptation is called and streamInfo parameter is null or undefined', function () { const realAdaptation = dashAdapter.getRealAdaptation(null, voHelper.getDummyMediaInfo(Constants.VIDEO)); - expect(realAdaptation).to.be.undefined; // jshint ignore:line + expect(realAdaptation).to.be.undefined; }); it('should return undefined when getRealAdaptation is called and mediaInfo parameter is null or undefined', function () { const realAdaptation = dashAdapter.getRealAdaptation(voHelper.getDummyStreamInfo(), null); - expect(realAdaptation).to.be.undefined; // jshint ignore:line + expect(realAdaptation).to.be.undefined; }); it('should return empty array when getProducerReferenceTimes is called and streamInfo parameter is null or undefined', () => { const producerReferenceTimes = dashAdapter.getProducerReferenceTimes(null, voHelper.getDummyMediaInfo()); - expect(producerReferenceTimes).to.be.instanceOf(Array); // jshint ignore:line - expect(producerReferenceTimes).to.be.empty; // jshint ignore:line + expect(producerReferenceTimes).to.be.instanceOf(Array); + expect(producerReferenceTimes).to.be.empty; }); it('should return empty array when getProducerReferenceTimes is called and mediaInfo parameter is null or undefined', () => { const producerReferenceTimes = dashAdapter.getProducerReferenceTimes(voHelper.getDummyStreamInfo(), null); - expect(producerReferenceTimes).to.be.instanceOf(Array); // jshint ignore:line - expect(producerReferenceTimes).to.be.empty; // jshint ignore:line + expect(producerReferenceTimes).to.be.instanceOf(Array); + expect(producerReferenceTimes).to.be.empty; }); it('should return empty array when getUTCTimingSources is called and no period is defined', function () { const timingSources = dashAdapter.getUTCTimingSources(); - expect(timingSources).to.be.instanceOf(Array); // jshint ignore:line - expect(timingSources).to.be.empty; // jshint ignore:line + expect(timingSources).to.be.instanceOf(Array); + expect(timingSources).to.be.empty; }); it('should return null when getSuggestedPresentationDelay is called and no period is defined', function () { const suggestedPresentationDelay = dashAdapter.getSuggestedPresentationDelay(); - expect(suggestedPresentationDelay).to.be.null; // jshint ignore:line + expect(suggestedPresentationDelay).to.be.null; }); it('should return false when getIsDynamic is called and no period is defined', function () { const isDynamic = dashAdapter.getIsDynamic(); - expect(isDynamic).to.be.false; // jshint ignore:line + expect(isDynamic).to.be.false; }); it('should return Number.MAX_SAFE_INTEGER || Number.MAX_VALUE when getDuration is called and no period is defined', function () { const duration = dashAdapter.getDuration(); - expect(duration).to.equal(Number.MAX_SAFE_INTEGER || Number.MAX_VALUE); // jshint ignore:line + expect(duration).to.equal(Number.MAX_SAFE_INTEGER || Number.MAX_VALUE); }); it('should return null when getAvailabilityStartTime is called and no period is defined', function () { const availabilityStartTime = dashAdapter.getAvailabilityStartTime(); - expect(availabilityStartTime).to.be.null; // jshint ignore:line + expect(availabilityStartTime).to.be.null; }); it('should return empty array when getRegularPeriods is called and no period is defined', function () { const regularPeriods = dashAdapter.getRegularPeriods(); - expect(regularPeriods).to.be.instanceOf(Array); // jshint ignore:line - expect(regularPeriods).to.be.empty; // jshint ignore:line + expect(regularPeriods).to.be.instanceOf(Array); + expect(regularPeriods).to.be.empty; }); }); @@ -409,22 +412,22 @@ describe('DashAdapter', function () { it('should return null when convertRepresentationToRepresentationInfo is called and voRepresentation parameter is null or undefined', function () { const representationInfo = dashAdapter.convertRepresentationToRepresentationInfo(); - expect(representationInfo).to.be.null; // jshint ignore:line + expect(representationInfo).to.be.null; }); it('should return correct representationInfo when convertRepresentationToRepresentationInfo is called and voRepresentation parameter is well defined', function () { const voRepresentation = voHelper.getDummyRepresentation(Constants.VIDEO, 0); const representationInfo = dashAdapter.convertRepresentationToRepresentationInfo(voRepresentation); - expect(representationInfo).not.to.be.null; // jshint ignore:line - expect(representationInfo.quality).to.equal(0); // jshint ignore:line + expect(representationInfo).not.to.be.null; + expect(representationInfo.quality).to.equal(0); }); it('should return undefined when getVoRepresentations is called and mediaInfo parameter is null or undefined', function () { const voRepresentations = dashAdapter.getVoRepresentations(); - expect(voRepresentations).to.be.instanceOf(Array); // jshint ignore:line - expect(voRepresentations).to.be.empty; // jshint ignore:line + expect(voRepresentations).to.be.instanceOf(Array); + expect(voRepresentations).to.be.empty; }); it('should return the first adaptation when getAdaptationForType is called and streamInfo is undefined', () => { @@ -441,21 +444,21 @@ describe('DashAdapter', function () { dashAdapter.updatePeriods(manifest_with_video); const adaptation = dashAdapter.getAdaptationForType(0, Constants.VIDEO); - expect(adaptation.id).to.equal(0); // jshint ignore:line + expect(adaptation.id).to.equal(0); }); it('should return an empty array getStreamsInfo externalManifest is an empty object and maxStreamsInfo is undefined', function () { const streamInfos = dashAdapter.getStreamsInfo({}); - expect(streamInfos).to.be.instanceOf(Array); // jshint ignore:line - expect(streamInfos).to.be.empty; // jshint ignore:line + expect(streamInfos).to.be.instanceOf(Array); + expect(streamInfos).to.be.empty; }); it('should return an empty array getStreamsInfo externalManifest is not an empty object and maxStreamsInfo is defined', function () { const streamInfos = dashAdapter.getStreamsInfo(manifest_with_audio, 10); - expect(streamInfos).to.be.instanceOf(Array); // jshint ignore:line - expect(streamInfos.length).to.equal(1); // jshint ignore:line + expect(streamInfos).to.be.instanceOf(Array); + expect(streamInfos.length).to.equal(1); }); describe('updatePeriods previously called', function () { @@ -470,7 +473,7 @@ describe('DashAdapter', function () { it('should return null when getMediaInfoForType is called and voPeriods is not an empty array, but streamInfo is undefined', function () { const mediaInfo = dashAdapter.getMediaInfoForType(); - expect(mediaInfo).to.be.null; // jshint ignore:line + expect(mediaInfo).to.be.null; }); it('should return null when getMediaInfoForType is called and voPeriods is not an empty array, and streamInfo is defined but not in the current manifest', function () { @@ -479,7 +482,7 @@ describe('DashAdapter', function () { streamInfo.index = 0; const mediaInfo = dashAdapter.getMediaInfoForType(streamInfo, Constants.AUDIO); - expect(mediaInfo).to.be.null; // jshint ignore:line + expect(mediaInfo).to.be.null; }); it('should return null when getMediaInfoForType is called and voPeriods is not an empty array, and streamInfo is defined', function () { @@ -489,31 +492,31 @@ describe('DashAdapter', function () { streamInfo.index = 0; const mediaInfo = dashAdapter.getMediaInfoForType(streamInfo, Constants.AUDIO); - expect(mediaInfo).not.to.be.null; // jshint ignore:line + expect(mediaInfo).not.to.be.null; }); it('should return null when getBandwidthForRepresentation is called and representationId and periodId are undefined', () => { const bdwth = dashAdapter.getBandwidthForRepresentation(); - expect(bdwth).to.be.null; // jshint ignore:line + expect(bdwth).to.be.null; }); it('should return -1 when getIndexForRepresentation is called and representationId and periodIdx are undefined', () => { const index = dashAdapter.getIndexForRepresentation(); - expect(index).to.be.equal(-1); // jshint ignore:line + expect(index).to.be.equal(-1); }); it('should return -1 when getMaxIndexForBufferType is called and bufferType and periodIdx are undefined', () => { const index = dashAdapter.getMaxIndexForBufferType(); - expect(index).to.be.equal(-1); // jshint ignore:line + expect(index).to.be.equal(-1); }); it('should return undefined when getRealAdaptation is called and streamInfo parameter is null or undefined', function () { const realAdaptation = dashAdapter.getRealAdaptation(null, voHelper.getDummyMediaInfo(Constants.VIDEO)); - expect(realAdaptation).to.be.undefined; // jshint ignore:line + expect(realAdaptation).to.be.undefined; }); it('should return the correct adaptation when getAdaptationForType is called', () => { @@ -529,28 +532,28 @@ describe('DashAdapter', function () { track.representationCount = 0; track.lang = 'deu'; track.roles = ['main']; - track.rolesWithSchemeIdUri = [{schemeIdUri:'aScheme', value:'main'}]; + track.rolesWithSchemeIdUri = [{ schemeIdUri: 'aScheme', value: 'main' }]; track.codec = 'audio/mp4;codecs="mp4a.40.2"'; track.mimeType = 'audio/mp4'; dashAdapter.setCurrentMediaInfo(streamInfo.id, Constants.AUDIO, track); const adaptation = dashAdapter.getAdaptationForType(0, Constants.AUDIO, streamInfo); - expect(adaptation.lang).to.equal('eng'); // jshint ignore:line + expect(adaptation.lang).to.equal('eng'); }); it('should return an empty array when getEventsFor is called and info parameter is undefined', function () { const eventsArray = dashAdapter.getEventsFor(); - expect(eventsArray).to.be.instanceOf(Array); // jshint ignore:line - expect(eventsArray).to.be.empty; // jshint ignore:line + expect(eventsArray).to.be.instanceOf(Array); + expect(eventsArray).to.be.empty; }); it('should return an empty array when getAllMediaInfoForType is called and voPeriods is not an empty array', function () { const mediaInfoArray = dashAdapter.getAllMediaInfoForType(); - expect(mediaInfoArray).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray).to.be.empty; // jshint ignore:line + expect(mediaInfoArray).to.be.instanceOf(Array); + expect(mediaInfoArray).to.be.empty; }); it('should return an empty array when getAllMediaInfoForType is called and voPeriods is not an empty array, and streamInfo parameter is set', function () { @@ -559,15 +562,15 @@ describe('DashAdapter', function () { index: 0 }, Constants.AUDIO); - expect(mediaInfoArray).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray).to.not.be.empty; // jshint ignore:line + expect(mediaInfoArray).to.be.instanceOf(Array); + expect(mediaInfoArray).to.not.be.empty; }); it('should return an empty array when getAllMediaInfoForType is called and externalManifest is set', function () { const mediaInfoArray = dashAdapter.getAllMediaInfoForType(null, null, manifest_with_audio); - expect(mediaInfoArray).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray).to.be.empty; // jshint ignore:line + expect(mediaInfoArray).to.be.instanceOf(Array); + expect(mediaInfoArray).to.be.empty; }); it('should return an empty array when getAllMediaInfoForType is called and, text type and externalManifest are set', function () { @@ -576,27 +579,27 @@ describe('DashAdapter', function () { index: 0 }, Constants.TEXT, manifest_with_video_with_embedded_subtitles); - expect(mediaInfoArray).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray.length).equals(2); // jshint ignore:line + expect(mediaInfoArray).to.be.instanceOf(Array); + expect(mediaInfoArray.length).equals(2); }); it('should read service description attributes', function () { const streamInfos = dashAdapter.getStreamsInfo(manifest_with_ll_service_description, 10); - expect(streamInfos).to.be.instanceOf(Array); // jshint ignore:line - expect(streamInfos.length).equals(1); // jshint ignore:line + expect(streamInfos).to.be.instanceOf(Array); + expect(streamInfos.length).equals(1); - expect(streamInfos[0].manifestInfo).not.to.be.null; // jshint ignore:line - expect(streamInfos[0].manifestInfo.serviceDescriptions).to.be.instanceOf(Array); // jshint ignore:line - expect(streamInfos[0].manifestInfo.serviceDescriptions.length).equals(1); // jshint ignore:line + expect(streamInfos[0].manifestInfo).not.to.be.null; + expect(streamInfos[0].manifestInfo.serviceDescriptions).to.be.instanceOf(Array); + expect(streamInfos[0].manifestInfo.serviceDescriptions.length).equals(1); - expect(streamInfos[0].manifestInfo.serviceDescriptions[0].schemeIdUri).equals('urn:dvb:dash:lowlatency:scope:2019'); // jshint ignore:line - expect(streamInfos[0].manifestInfo.serviceDescriptions[0].latency.target).equals(3000); // jshint ignore:line - expect(streamInfos[0].manifestInfo.serviceDescriptions[0].latency.max).equals(5000); // jshint ignore:line - expect(streamInfos[0].manifestInfo.serviceDescriptions[0].latency.min).equals(2000); // jshint ignore:line - expect(streamInfos[0].manifestInfo.serviceDescriptions[0].latency.referenceId).equals(7); // jshint ignore:line - expect(streamInfos[0].manifestInfo.serviceDescriptions[0].playbackRate.max).equals(1.5); // jshint ignore:line - expect(streamInfos[0].manifestInfo.serviceDescriptions[0].playbackRate.min).equals(0.5); // jshint ignore:line + expect(streamInfos[0].manifestInfo.serviceDescriptions[0].schemeIdUri).equals('urn:dvb:dash:lowlatency:scope:2019'); + expect(streamInfos[0].manifestInfo.serviceDescriptions[0].latency.target).equals(3000); + expect(streamInfos[0].manifestInfo.serviceDescriptions[0].latency.max).equals(5000); + expect(streamInfos[0].manifestInfo.serviceDescriptions[0].latency.min).equals(2000); + expect(streamInfos[0].manifestInfo.serviceDescriptions[0].latency.referenceId).equals(7); + expect(streamInfos[0].manifestInfo.serviceDescriptions[0].playbackRate.max).equals(1.5); + expect(streamInfos[0].manifestInfo.serviceDescriptions[0].playbackRate.min).equals(0.5); }); describe('mediainfo populated from manifest', function () { @@ -606,14 +609,14 @@ describe('DashAdapter', function () { index: 0 }, Constants.VIDEO, manifest_without_supplemental_properties); - expect(mediaInfoArray).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray.length).equals(1); // jshint ignore:line + expect(mediaInfoArray).to.be.instanceOf(Array); + expect(mediaInfoArray.length).equals(1); - expect(mediaInfoArray[0].supplementalProperties).not.to.be.null; // jshint ignore:line - expect(Object.keys(mediaInfoArray[0].supplementalProperties).length).equals(0); // jshint ignore:line + expect(mediaInfoArray[0].supplementalProperties).not.to.be.null; + expect(Object.keys(mediaInfoArray[0].supplementalProperties).length).equals(0); - expect(mediaInfoArray[0].supplementalPropertiesAsArray).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray[0].supplementalPropertiesAsArray.length).equals(0); // jshint ignore:line + expect(mediaInfoArray[0].supplementalPropertiesAsArray).to.be.instanceOf(Array); + expect(mediaInfoArray[0].supplementalPropertiesAsArray.length).equals(0); }); it('supplemental properties should be filled if correctly defined', function () { @@ -622,16 +625,16 @@ describe('DashAdapter', function () { index: 0 }, Constants.VIDEO, manifest_with_supplemental_properties); - expect(mediaInfoArray).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray.length).equals(1); // jshint ignore:line + expect(mediaInfoArray).to.be.instanceOf(Array); + expect(mediaInfoArray.length).equals(1); - expect(mediaInfoArray[0].codec).to.be.null; // jshint ignore:line + expect(mediaInfoArray[0].codec).to.be.null; - expect(mediaInfoArray[0].supplementalProperties).not.to.be.null; // jshint ignore:line - expect(Object.keys(mediaInfoArray[0].supplementalProperties).length).equals(1); // jshint ignore:line + expect(mediaInfoArray[0].supplementalProperties).not.to.be.null; + expect(Object.keys(mediaInfoArray[0].supplementalProperties).length).equals(1); - expect(mediaInfoArray[0].supplementalPropertiesAsArray).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray[0].supplementalPropertiesAsArray.length).equals(2); // jshint ignore:line + expect(mediaInfoArray[0].supplementalPropertiesAsArray).to.be.instanceOf(Array); + expect(mediaInfoArray[0].supplementalPropertiesAsArray.length).equals(2); }); it('supplemental properties should be filled if set on all representations', function () { @@ -640,17 +643,17 @@ describe('DashAdapter', function () { index: 0 }, Constants.VIDEO, manifest_with_supplemental_properties_on_repr); - expect(mediaInfoArray).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray.length).equals(1); // jshint ignore:line + expect(mediaInfoArray).to.be.instanceOf(Array); + expect(mediaInfoArray.length).equals(1); - expect(mediaInfoArray[0].representationCount).equals(2); // jshint ignore:line - expect(mediaInfoArray[0].codec).not.to.be.null; // jshint ignore:line + expect(mediaInfoArray[0].representationCount).equals(2); + expect(mediaInfoArray[0].codec).not.to.be.null; - expect(mediaInfoArray[0].supplementalProperties).not.to.be.null; // jshint ignore:line - expect(Object.keys(mediaInfoArray[0].supplementalProperties).length).equals(1); // jshint ignore:line + expect(mediaInfoArray[0].supplementalProperties).not.to.be.null; + expect(Object.keys(mediaInfoArray[0].supplementalProperties).length).equals(1); - expect(mediaInfoArray[0].supplementalPropertiesAsArray).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray[0].supplementalPropertiesAsArray.length).equals(3); // jshint ignore:line + expect(mediaInfoArray[0].supplementalPropertiesAsArray).to.be.instanceOf(Array); + expect(mediaInfoArray[0].supplementalPropertiesAsArray.length).equals(3); }); it('supplemental properties should not be filled if not set on all representations', function () { @@ -659,16 +662,16 @@ describe('DashAdapter', function () { index: 0 }, Constants.VIDEO, manifest_with_supplemental_properties_on_only_one_repr); - expect(mediaInfoArray).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray.length).equals(1); // jshint ignore:line + expect(mediaInfoArray).to.be.instanceOf(Array); + expect(mediaInfoArray.length).equals(1); - expect(mediaInfoArray[0].representationCount).equals(3); // jshint ignore:line + expect(mediaInfoArray[0].representationCount).equals(3); - expect(mediaInfoArray[0].supplementalProperties).not.to.be.null; // jshint ignore:line - expect(Object.keys(mediaInfoArray[0].supplementalProperties).length).equals(0); // jshint ignore:line + expect(mediaInfoArray[0].supplementalProperties).not.to.be.null; + expect(Object.keys(mediaInfoArray[0].supplementalProperties).length).equals(0); - expect(mediaInfoArray[0].supplementalPropertiesAsArray).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray[0].supplementalPropertiesAsArray.length).equals(0); // jshint ignore:line + expect(mediaInfoArray[0].supplementalPropertiesAsArray).to.be.instanceOf(Array); + expect(mediaInfoArray[0].supplementalPropertiesAsArray.length).equals(0); }); it('audio channel config should be filled', function () { @@ -677,17 +680,17 @@ describe('DashAdapter', function () { index: 0 }, Constants.AUDIO, manifest_with_audioChanCfg); - expect(mediaInfoArray).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray.length).equals(1); // jshint ignore:line + expect(mediaInfoArray).to.be.instanceOf(Array); + expect(mediaInfoArray.length).equals(1); - expect(mediaInfoArray[0].audioChannelConfiguration).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray[0].audioChannelConfiguration.length).equals(2); // jshint ignore:line - expect(mediaInfoArray[0].audioChannelConfiguration[0]).equals('6'); // jshint ignore:line + expect(mediaInfoArray[0].audioChannelConfiguration).to.be.instanceOf(Array); + expect(mediaInfoArray[0].audioChannelConfiguration.length).equals(2); + expect(mediaInfoArray[0].audioChannelConfiguration[0]).equals('6'); - expect(mediaInfoArray[0].audioChannelConfigurationsWithSchemeIdUri).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray[0].audioChannelConfigurationsWithSchemeIdUri.length).equals(2); // jshint ignore:line - expect(mediaInfoArray[0].audioChannelConfigurationsWithSchemeIdUri[0]).to.be.instanceOf(DescriptorType); // jshint ignore:line - expect(mediaInfoArray[0].audioChannelConfigurationsWithSchemeIdUri[1].value).equals('0xF801'); // jshint ignore:line + expect(mediaInfoArray[0].audioChannelConfigurationsWithSchemeIdUri).to.be.instanceOf(Array); + expect(mediaInfoArray[0].audioChannelConfigurationsWithSchemeIdUri.length).equals(2); + expect(mediaInfoArray[0].audioChannelConfigurationsWithSchemeIdUri[0]).to.be.instanceOf(DescriptorType); + expect(mediaInfoArray[0].audioChannelConfigurationsWithSchemeIdUri[1].value).equals('0xF801'); }); it('audio channel config should be filled when present on Representation', function () { @@ -696,18 +699,18 @@ describe('DashAdapter', function () { index: 0 }, Constants.AUDIO, manifest_with_audioChanCfg_Repr); - expect(mediaInfoArray).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray.length).equals(1); // jshint ignore:line + expect(mediaInfoArray).to.be.instanceOf(Array); + expect(mediaInfoArray.length).equals(1); // Note: MediaInfo picks those AudioChannelConfig descriptor present on that Representation with lowest bandwidth - expect(mediaInfoArray[0].audioChannelConfiguration).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray[0].audioChannelConfiguration.length).equals(4); // jshint ignore:line - expect(mediaInfoArray[0].audioChannelConfiguration[0]).equals('21'); // jshint ignore:line - - expect(mediaInfoArray[0].audioChannelConfigurationsWithSchemeIdUri).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray[0].audioChannelConfigurationsWithSchemeIdUri.length).equals(4); // jshint ignore:line - expect(mediaInfoArray[0].audioChannelConfigurationsWithSchemeIdUri[0]).to.be.instanceOf(DescriptorType); // jshint ignore:line - expect(mediaInfoArray[0].audioChannelConfigurationsWithSchemeIdUri[3].value).equals('0xA000'); // jshint ignore:line + expect(mediaInfoArray[0].audioChannelConfiguration).to.be.instanceOf(Array); + expect(mediaInfoArray[0].audioChannelConfiguration.length).equals(4); + expect(mediaInfoArray[0].audioChannelConfiguration[0]).equals('21'); + + expect(mediaInfoArray[0].audioChannelConfigurationsWithSchemeIdUri).to.be.instanceOf(Array); + expect(mediaInfoArray[0].audioChannelConfigurationsWithSchemeIdUri.length).equals(4); + expect(mediaInfoArray[0].audioChannelConfigurationsWithSchemeIdUri[0]).to.be.instanceOf(DescriptorType); + expect(mediaInfoArray[0].audioChannelConfigurationsWithSchemeIdUri[3].value).equals('0xA000'); }); it('role, accessibility and viewpoint should be empty if not defined', function () { @@ -716,21 +719,22 @@ describe('DashAdapter', function () { index: 0 }, Constants.AUDIO, manifest_with_audioChanCfg); - expect(mediaInfoArray).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray.length).equals(1); // jshint ignore:line - - expect(mediaInfoArray[0].roles).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray[0].roles.length).equals(0); // jshint ignore:line - expect(mediaInfoArray[0].accessibility).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray[0].accessibility.length).equals(0); // jshint ignore:line - expect(mediaInfoArray[0].viewpoint).to.be.undefined; // jshint ignore:line - - expect(mediaInfoArray[0].rolesWithSchemeIdUri).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray[0].rolesWithSchemeIdUri.length).equals(0); // jshint ignore:line - expect(mediaInfoArray[0].accessibilitiesWithSchemeIdUri).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray[0].accessibilitiesWithSchemeIdUri.length).equals(0); // jshint ignore:lineexpect(mediaInfoArray[0].accessibilitiesWithSchemeIdUri).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray[0].viewpointsWithSchemeIdUri).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray[0].viewpointsWithSchemeIdUri.length).equals(0); // jshint ignore:line + expect(mediaInfoArray).to.be.instanceOf(Array); + expect(mediaInfoArray.length).equals(1); + + expect(mediaInfoArray[0].roles).to.be.instanceOf(Array); + expect(mediaInfoArray[0].roles.length).equals(0); + expect(mediaInfoArray[0].accessibility).to.be.instanceOf(Array); + expect(mediaInfoArray[0].accessibility.length).equals(0); + expect(mediaInfoArray[0].viewpoint).to.be.undefined; + + expect(mediaInfoArray[0].rolesWithSchemeIdUri).to.be.instanceOf(Array); + expect(mediaInfoArray[0].rolesWithSchemeIdUri.length).equals(0); + expect(mediaInfoArray[0].accessibilitiesWithSchemeIdUri).to.be.instanceOf(Array); + expect(mediaInfoArray[0].accessibilitiesWithSchemeIdUri.length).equals(0); + expect(mediaInfoArray[0].accessibilitiesWithSchemeIdUri).to.be.instanceOf(Array); + expect(mediaInfoArray[0].viewpointsWithSchemeIdUri).to.be.instanceOf(Array); + expect(mediaInfoArray[0].viewpointsWithSchemeIdUri.length).equals(0); }); it('role should be filled', function () { @@ -739,17 +743,17 @@ describe('DashAdapter', function () { index: 0 }, Constants.AUDIO, manifest_with_audio); - expect(mediaInfoArray).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray.length).equals(2); // jshint ignore:line + expect(mediaInfoArray).to.be.instanceOf(Array); + expect(mediaInfoArray.length).equals(2); - expect(mediaInfoArray[0].roles).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray[0].roles.length).equals(1); // jshint ignore:line - expect(mediaInfoArray[0].roles[0]).equals('main'); // jshint ignore:line + expect(mediaInfoArray[0].roles).to.be.instanceOf(Array); + expect(mediaInfoArray[0].roles.length).equals(1); + expect(mediaInfoArray[0].roles[0]).equals('main'); - expect(mediaInfoArray[0].rolesWithSchemeIdUri).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray[0].rolesWithSchemeIdUri.length).equals(1); // jshint ignore:line - expect(mediaInfoArray[0].rolesWithSchemeIdUri[0]).to.be.instanceOf(DescriptorType); // jshint ignore:line - expect(mediaInfoArray[0].rolesWithSchemeIdUri[0].value).equals('main'); // jshint ignore:line + expect(mediaInfoArray[0].rolesWithSchemeIdUri).to.be.instanceOf(Array); + expect(mediaInfoArray[0].rolesWithSchemeIdUri.length).equals(1); + expect(mediaInfoArray[0].rolesWithSchemeIdUri[0]).to.be.instanceOf(DescriptorType); + expect(mediaInfoArray[0].rolesWithSchemeIdUri[0].value).equals('main'); }); it('accessibility should be filled', function () { @@ -758,26 +762,26 @@ describe('DashAdapter', function () { index: 0 }, Constants.VIDEO, manifest_with_video_with_embedded_subtitles); - expect(mediaInfoArray).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray.length).equals(2); // jshint ignore:line + expect(mediaInfoArray).to.be.instanceOf(Array); + expect(mediaInfoArray.length).equals(2); - expect(mediaInfoArray[0].roles).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray[0].roles.length).equals(0); // jshint ignore:line + expect(mediaInfoArray[0].roles).to.be.instanceOf(Array); + expect(mediaInfoArray[0].roles.length).equals(0); - expect(mediaInfoArray[0].accessibility).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray[0].accessibility.length).equals(1); // jshint ignore:line - expect(mediaInfoArray[0].accessibility[0]).equals('cea-608:CC1=eng;CC3=swe'); // jshint ignore:line - expect(mediaInfoArray[1].accessibility.length).equals(0); // jshint ignore:line + expect(mediaInfoArray[0].accessibility).to.be.instanceOf(Array); + expect(mediaInfoArray[0].accessibility.length).equals(1); + expect(mediaInfoArray[0].accessibility[0]).equals('cea-608:CC1=eng;CC3=swe'); + expect(mediaInfoArray[1].accessibility.length).equals(0); - expect(mediaInfoArray[0].rolesWithSchemeIdUri).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray[0].rolesWithSchemeIdUri.length).equals(0); // jshint ignore:line + expect(mediaInfoArray[0].rolesWithSchemeIdUri).to.be.instanceOf(Array); + expect(mediaInfoArray[0].rolesWithSchemeIdUri.length).equals(0); - expect(mediaInfoArray[0].accessibilitiesWithSchemeIdUri).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray[0].accessibilitiesWithSchemeIdUri.length).equals(1); // jshint ignore:line - expect(mediaInfoArray[0].accessibilitiesWithSchemeIdUri[0]).to.be.instanceOf(DescriptorType); // jshint ignore:line - expect(mediaInfoArray[0].accessibilitiesWithSchemeIdUri[0].schemeIdUri).equals('urn:scte:dash:cc:cea-608:2015'); // jshint ignore:line - expect(mediaInfoArray[0].accessibilitiesWithSchemeIdUri[0].value).equals('CC1=eng;CC3=swe'); // jshint ignore:line - expect(mediaInfoArray[1].accessibilitiesWithSchemeIdUri.length).equals(0); // jshint ignore:line + expect(mediaInfoArray[0].accessibilitiesWithSchemeIdUri).to.be.instanceOf(Array); + expect(mediaInfoArray[0].accessibilitiesWithSchemeIdUri.length).equals(1); + expect(mediaInfoArray[0].accessibilitiesWithSchemeIdUri[0]).to.be.instanceOf(DescriptorType); + expect(mediaInfoArray[0].accessibilitiesWithSchemeIdUri[0].schemeIdUri).equals('urn:scte:dash:cc:cea-608:2015'); + expect(mediaInfoArray[0].accessibilitiesWithSchemeIdUri[0].value).equals('CC1=eng;CC3=swe'); + expect(mediaInfoArray[1].accessibilitiesWithSchemeIdUri.length).equals(0); }); it('viewpoint should be filled', function () { @@ -786,23 +790,23 @@ describe('DashAdapter', function () { index: 0 }, Constants.AUDIO, manifest_with_audioChanCfg_Repr); - expect(mediaInfoArray).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray.length).equals(1); // jshint ignore:line + expect(mediaInfoArray).to.be.instanceOf(Array); + expect(mediaInfoArray.length).equals(1); - expect(mediaInfoArray[0].viewpoint).equals('VP1'); // jshint ignore:line + expect(mediaInfoArray[0].viewpoint).equals('VP1'); - expect(mediaInfoArray[0].viewpointsWithSchemeIdUri).to.be.instanceOf(Array); // jshint ignore:line - expect(mediaInfoArray[0].viewpointsWithSchemeIdUri.length).equals(2); // jshint ignore:line + expect(mediaInfoArray[0].viewpointsWithSchemeIdUri).to.be.instanceOf(Array); + expect(mediaInfoArray[0].viewpointsWithSchemeIdUri.length).equals(2); - expect(mediaInfoArray[0].viewpointsWithSchemeIdUri[0]).to.be.instanceOf(DescriptorType); // jshint ignore:line - expect(mediaInfoArray[0].viewpointsWithSchemeIdUri[0].schemeIdUri).equals('urn:scheme:viewpoint'); // jshint ignore:line - expect(mediaInfoArray[0].viewpointsWithSchemeIdUri[0].value).equals('VP1'); // jshint ignore:line - expect(mediaInfoArray[0].viewpointsWithSchemeIdUri[0].id).to.be.null; // jshint ignore:line + expect(mediaInfoArray[0].viewpointsWithSchemeIdUri[0]).to.be.instanceOf(DescriptorType); + expect(mediaInfoArray[0].viewpointsWithSchemeIdUri[0].schemeIdUri).equals('urn:scheme:viewpoint'); + expect(mediaInfoArray[0].viewpointsWithSchemeIdUri[0].value).equals('VP1'); + expect(mediaInfoArray[0].viewpointsWithSchemeIdUri[0].id).to.be.null; - expect(mediaInfoArray[0].viewpointsWithSchemeIdUri[1]).to.be.instanceOf(DescriptorType); // jshint ignore:line - expect(mediaInfoArray[0].viewpointsWithSchemeIdUri[1].schemeIdUri).equals('urn:scheme:viewpoint'); // jshint ignore:line - expect(mediaInfoArray[0].viewpointsWithSchemeIdUri[1].value).equals('VP2'); // jshint ignore:line - expect(mediaInfoArray[0].viewpointsWithSchemeIdUri[1].id).to.be.null; // jshint ignore:line + expect(mediaInfoArray[0].viewpointsWithSchemeIdUri[1]).to.be.instanceOf(DescriptorType); + expect(mediaInfoArray[0].viewpointsWithSchemeIdUri[1].schemeIdUri).equals('urn:scheme:viewpoint'); + expect(mediaInfoArray[0].viewpointsWithSchemeIdUri[1].value).equals('VP2'); + expect(mediaInfoArray[0].viewpointsWithSchemeIdUri[1].id).to.be.null; }); }); @@ -813,14 +817,14 @@ describe('DashAdapter', function () { // example patch location element with ttl const patchLocationElementTTL = { - __children: [{'#text': 'foobar'}], + __children: [{ '#text': 'foobar' }], '__text': 'foobar', ttl: 60 * 5 // 5 minute validity period }; // example patch location element that never expires const patchLocationElementEvergreen = { - __children: [{'#text': 'foobar'}], + __children: [{ '#text': 'foobar' }], '__text': 'foobar' }; @@ -849,7 +853,7 @@ describe('DashAdapter', function () { }; let patchLocation = dashAdapter.getPatchLocation(manifest); - expect(patchLocation).to.be.empty; // jshint ignore:line + expect(patchLocation).to.be.empty; }); it('should provide patch location if present and never expires', function () { @@ -872,7 +876,7 @@ describe('DashAdapter', function () { }; let patchLocation = dashAdapter.getPatchLocation(manifest); - expect(patchLocation).to.be.empty; // jshint ignore:line + expect(patchLocation).to.be.empty; }); it('should not provide patch location if present in manifest without publish time', function () { @@ -882,7 +886,7 @@ describe('DashAdapter', function () { }; let patchLocation = dashAdapter.getPatchLocation(manifest); - expect(patchLocation).to.be.empty; // jshint ignore:line + expect(patchLocation).to.be.empty; }); }); @@ -895,7 +899,7 @@ describe('DashAdapter', function () { }; let isValid = dashAdapter.isPatchValid(manifest); - expect(isValid).to.be.false; // jshint ignore:line + expect(isValid).to.be.false; }); it('considers patch invalid if no manifest given', function () { @@ -908,7 +912,7 @@ describe('DashAdapter', function () { }; let isValid = dashAdapter.isPatchValid(undefined, patch); - expect(isValid).to.be.false; // jshint ignore:line + expect(isValid).to.be.false; }); it('considers patch invalid if manifest has no id', function () { @@ -924,7 +928,7 @@ describe('DashAdapter', function () { }; let isValid = dashAdapter.isPatchValid(manifest, patch); - expect(isValid).to.be.false; // jshint ignore:line + expect(isValid).to.be.false; }); it('considers patch invalid if patch has no manifest id', function () { @@ -940,7 +944,7 @@ describe('DashAdapter', function () { }; let isValid = dashAdapter.isPatchValid(manifest, patch); - expect(isValid).to.be.false; // jshint ignore:line + expect(isValid).to.be.false; }); it('considers patch invalid if manifest has no publish time', function () { @@ -956,7 +960,7 @@ describe('DashAdapter', function () { }; let isValid = dashAdapter.isPatchValid(manifest, patch); - expect(isValid).to.be.false; // jshint ignore:line + expect(isValid).to.be.false; }); it('considers patch invalid if patch has no original publish time', function () { @@ -972,7 +976,7 @@ describe('DashAdapter', function () { }; let isValid = dashAdapter.isPatchValid(manifest, patch); - expect(isValid).to.be.false; // jshint ignore:line + expect(isValid).to.be.false; }); it('considers patch invalid if both objects missing ids', function () { @@ -987,7 +991,7 @@ describe('DashAdapter', function () { }; let isValid = dashAdapter.isPatchValid(manifest, patch); - expect(isValid).to.be.false; // jshint ignore:line + expect(isValid).to.be.false; }); it('considers patch invalid if both objects missing mpd publish times', function () { @@ -1001,7 +1005,7 @@ describe('DashAdapter', function () { }; let isValid = dashAdapter.isPatchValid(manifest, patch); - expect(isValid).to.be.false; // jshint ignore:line + expect(isValid).to.be.false; }); it('considers patch invalid if patch missing new publish time', function () { @@ -1016,7 +1020,7 @@ describe('DashAdapter', function () { }; let isValid = dashAdapter.isPatchValid(manifest, patch); - expect(isValid).to.be.false; // jshint ignore:line + expect(isValid).to.be.false; }); it('considers patch invalid if ids do not match', function () { @@ -1033,7 +1037,7 @@ describe('DashAdapter', function () { }; let isValid = dashAdapter.isPatchValid(manifest, patch); - expect(isValid).to.be.false; // jshint ignore:line + expect(isValid).to.be.false; }); it('considers patch invalid if publish times do not match', function () { @@ -1051,7 +1055,7 @@ describe('DashAdapter', function () { }; let isValid = dashAdapter.isPatchValid(manifest, patch); - expect(isValid).to.be.false; // jshint ignore:line + expect(isValid).to.be.false; }); it('considers patch invalid if new publish time is not later than previous', function () { @@ -1067,7 +1071,7 @@ describe('DashAdapter', function () { }; let isValid = dashAdapter.isPatchValid(manifest, patch); - expect(isValid).to.be.false; // jshint ignore:line + expect(isValid).to.be.false; }); it('considers patch valid if ids, publish times match, and new publish time is later than previous', function () { @@ -1084,7 +1088,7 @@ describe('DashAdapter', function () { }; let isValid = dashAdapter.isPatchValid(manifest, patch); - expect(isValid).to.be.true; // jshint ignore:line + expect(isValid).to.be.true; }); }); @@ -1093,7 +1097,7 @@ describe('DashAdapter', function () { it('applies add operation to structure with no siblings', function () { let manifest = {}; - let addedPeriod = {id: 'foo'}; + let addedPeriod = { id: 'foo' }; let patch = patchHelper.generatePatch('foobar', [{ action: 'add', selector: '/MPD', @@ -1109,8 +1113,8 @@ describe('DashAdapter', function () { }); it('applies add operation to structure with single sibling', function () { - let originalPeriod = {id: 'foo'}; - let addedPeriod = {id: 'bar'}; + let originalPeriod = { id: 'foo' }; + let addedPeriod = { id: 'bar' }; // special case x2js object which omits the _asArray variant let manifest = { Period: originalPeriod @@ -1130,8 +1134,8 @@ describe('DashAdapter', function () { }); it('applies add implicit append operation with siblings', function () { - let originalPeriods = [{id: 'foo'}, {id: 'bar'}]; - let addedPeriod = {id: 'baz'}; + let originalPeriods = [{ id: 'foo' }, { id: 'bar' }]; + let addedPeriod = { id: 'baz' }; let manifest = { Period: originalPeriods.slice(), Period_asArray: originalPeriods.slice() @@ -1151,8 +1155,8 @@ describe('DashAdapter', function () { }); it('applies add prepend operation with siblings', function () { - let originalPeriods = [{id: 'foo'}, {id: 'bar'}]; - let addedPeriod = {id: 'baz'}; + let originalPeriods = [{ id: 'foo' }, { id: 'bar' }]; + let addedPeriod = { id: 'baz' }; let manifest = { Period: originalPeriods.slice(), Period_asArray: originalPeriods.slice() @@ -1173,8 +1177,8 @@ describe('DashAdapter', function () { }); it('applies add before operation with siblings', function () { - let originalPeriods = [{id: 'foo'}, {id: 'bar'}, {id: 'baz'}]; - let addedPeriod = {id: 'qux'}; + let originalPeriods = [{ id: 'foo' }, { id: 'bar' }, { id: 'baz' }]; + let addedPeriod = { id: 'qux' }; let manifest = { Period: originalPeriods.slice(), Period_asArray: originalPeriods.slice() @@ -1195,8 +1199,8 @@ describe('DashAdapter', function () { }); it('applies add after operation with siblings', function () { - let originalPeriods = [{id: 'foo'}, {id: 'bar'}, {id: 'baz'}]; - let addedPeriod = {id: 'qux'}; + let originalPeriods = [{ id: 'foo' }, { id: 'bar' }, { id: 'baz' }]; + let addedPeriod = { id: 'qux' }; let manifest = { Period: originalPeriods.slice(), Period_asArray: originalPeriods.slice() @@ -1235,7 +1239,7 @@ describe('DashAdapter', function () { }); it('applies add attribute operation on existing attribute, should act as replace', function () { - let originalPeriod = {id: 'foo'}; + let originalPeriod = { id: 'foo' }; let manifest = { Period: originalPeriod, Period_asArray: [originalPeriod] @@ -1253,8 +1257,8 @@ describe('DashAdapter', function () { }); it('applies replace operation with siblings', function () { - let originalPeriods = [{id: 'foo'}, {id: 'bar'}, {id: 'baz'}]; - let replacementPeriod = {id: 'qux'}; + let originalPeriods = [{ id: 'foo' }, { id: 'bar' }, { id: 'baz' }]; + let replacementPeriod = { id: 'qux' }; let manifest = { Period: originalPeriods.slice(), Period_asArray: originalPeriods.slice() @@ -1274,8 +1278,8 @@ describe('DashAdapter', function () { }); it('applies replace operation without siblings', function () { - let originalPeriod = {id: 'foo'}; - let replacementPeriod = {id: 'bar'}; + let originalPeriod = { id: 'foo' }; + let replacementPeriod = { id: 'bar' }; let manifest = { Period: originalPeriod, Period_asArray: [originalPeriod] @@ -1295,7 +1299,7 @@ describe('DashAdapter', function () { }); it('applies replace operation to attribute', function () { - let originalPeriod = {id: 'foo'}; + let originalPeriod = { id: 'foo' }; let manifest = { Period: originalPeriod, Period_asArray: [originalPeriod] @@ -1312,7 +1316,7 @@ describe('DashAdapter', function () { }); it('applies remove operation leaving multiple siblings', function () { - let originalPeriods = [{id: 'foo'}, {id: 'bar'}, {id: 'baz'}]; + let originalPeriods = [{ id: 'foo' }, { id: 'bar' }, { id: 'baz' }]; let manifest = { Period: originalPeriods.slice(), Period_asArray: originalPeriods.slice() @@ -1329,7 +1333,7 @@ describe('DashAdapter', function () { }); it('applies remove operation leaving one sibling', function () { - let originalPeriods = [{id: 'foo'}, {id: 'bar'}]; + let originalPeriods = [{ id: 'foo' }, { id: 'bar' }]; let manifest = { Period: originalPeriods.slice(), Period_asArray: originalPeriods.slice() @@ -1346,7 +1350,7 @@ describe('DashAdapter', function () { }); it('applies remove operation leaving no siblings', function () { - let originalPeriod = {id: 'foo'}; + let originalPeriod = { id: 'foo' }; let manifest = { Period: originalPeriod, Period_asArray: [originalPeriod] @@ -1363,7 +1367,7 @@ describe('DashAdapter', function () { }); it('applies remove attribute operation', function () { - let originalPeriod = {id: 'foo', start: 'bar'}; + let originalPeriod = { id: 'foo', start: 'bar' }; let manifest = { Period: originalPeriod, Period_asArray: [originalPeriod] @@ -1381,8 +1385,8 @@ describe('DashAdapter', function () { }); it('applies multiple operations respecting order', function () { - let originalPeriods = [{id: 'foo'}, {id: 'bar'}]; - let newPeriod = {id: 'baz'}; + let originalPeriods = [{ id: 'foo' }, { id: 'bar' }]; + let newPeriod = { id: 'baz' }; let manifest = { Period: originalPeriods.slice(), Period_asArray: originalPeriods.slice() @@ -1425,7 +1429,7 @@ describe('DashAdapter', function () { }); it('invalid operations are ignored', function () { - let originalPeriods = [{id: 'foo'}, {id: 'bar'}]; + let originalPeriods = [{ id: 'foo' }, { id: 'bar' }]; let manifest = { Period: originalPeriods.slice(), Period_asArray: originalPeriods.slice() @@ -1474,26 +1478,35 @@ describe('DashAdapter', function () { AdaptationSet_asArray: [ { id: 0, mimeType: Constants.VIDEO, - Role_asArray:[], + Role_asArray: [], Accessibility_asArray: [{ schemeIdUri: 'urn:mpeg:dash:role:2011', value: 'description' }], - SupplementalProperty_asArray: [{schemeIdUri: 'test:scheme', value: 'value1'},{schemeIdUri: 'test:scheme', value: 'value2'}], + SupplementalProperty_asArray: [{ + schemeIdUri: 'test:scheme', + value: 'value1' + }, { schemeIdUri: 'test:scheme', value: 'value2' }], [DashConstants.AUDIOCHANNELCONFIGURATION_ASARRAY]: [ - {schemeIdUri: 'tag:dolby.com,2014:dash:audio_channel_configuration:2011', value: '0xF801'} + { + schemeIdUri: 'tag:dolby.com,2014:dash:audio_channel_configuration:2011', + value: '0xF801' + } ] }, { id: 1, mimeType: Constants.VIDEO, - Role_asArray:[{schemeIdUri: 'urn:mpeg:dash:role:2011', value: 'main'}], + Role_asArray: [{ schemeIdUri: 'urn:mpeg:dash:role:2011', value: 'main' }], Accessibility_asArray: [], - SupplementalProperty_asArray: [{schemeIdUri: 'test:scheme', value: 'value1'},{schemeIdUri: 'test:scheme', value: 'value4'}], + SupplementalProperty_asArray: [{ + schemeIdUri: 'test:scheme', + value: 'value1' + }, { schemeIdUri: 'test:scheme', value: 'value4' }], [DashConstants.AUDIOCHANNELCONFIGURATION_ASARRAY]: [ - {schemeIdUri: 'urn:mpeg:mpegB:cicp:ChannelConfiguration', value: '6'} + { schemeIdUri: 'urn:mpeg:mpegB:cicp:ChannelConfiguration', value: '6' } ] } ] }] }; mediaInfo1 = dashAdapter.getAllMediaInfoForType( - {id: 'defaultId_0', index: 0}, Constants.VIDEO, + { id: 'defaultId_0', index: 0 }, Constants.VIDEO, manifest_1); }); diff --git a/test/unit/dash.DashMetrics.js b/test/unit/dash.DashMetrics.js index 05837a8a46..567a983a72 100644 --- a/test/unit/dash.DashMetrics.js +++ b/test/unit/dash.DashMetrics.js @@ -15,27 +15,27 @@ describe('DashMetrics', function () { it('should return null when getCurrentRepresentationSwitch is called and type is undefined', () => { const representation = dashMetrics.getCurrentRepresentationSwitch(); - expect(representation).to.be.null; // jshint ignore:line + expect(representation).to.be.null; }); it('should return 0 when getCurrentBufferLevel is called and type is undefined', () => { const bufferLevel = dashMetrics.getCurrentBufferLevel(); - expect(bufferLevel).to.be.equal(0); // jshint ignore:line + expect(bufferLevel).to.be.equal(0); }); describe('getCurrentHttpRequest', () => { it('should return null when getCurrentHttpRequest is called and mediaType is undefined', () => { const currentHttpRequest = dashMetrics.getCurrentHttpRequest(); - expect(currentHttpRequest).to.be.null; // jshint ignore:line + expect(currentHttpRequest).to.be.null; }); it('should return null when getCurrentHttpRequest is called and metrics.httpList is undefined', () => { metricsModelMock.setMetrics({}); const currentHttpRequest = dashMetrics.getCurrentHttpRequest('audio'); - expect(currentHttpRequest).to.be.null; // jshint ignore:line + expect(currentHttpRequest).to.be.null; }); }); @@ -43,23 +43,23 @@ describe('DashMetrics', function () { it('should return an empty array when getHttpRequests is called and metrics is undefined', () => { const httpRequestArray = dashMetrics.getHttpRequests(); - expect(httpRequestArray).to.be.instanceOf(Array); // jshint ignore:line - expect(httpRequestArray).to.be.empty; // jshint ignore:line + expect(httpRequestArray).to.be.instanceOf(Array); + expect(httpRequestArray).to.be.empty; }); it('should return an empty array when getHttpRequests is called and metrics.httpList is undefined', () => { metricsModelMock.setMetrics({}); const httpRequestArray = dashMetrics.getHttpRequests(); - expect(httpRequestArray).to.be.instanceOf(Array); // jshint ignore:line - expect(httpRequestArray).to.be.empty; // jshint ignore:line + expect(httpRequestArray).to.be.instanceOf(Array); + expect(httpRequestArray).to.be.empty; }); }); it('should return null when getCurrentDroppedFrames is called', () => { const droppedFrames = dashMetrics.getCurrentDroppedFrames(); - expect(droppedFrames).to.be.null; // jshint ignore:line + expect(droppedFrames).to.be.null; }); describe('getLatestMPDRequestHeaderValueByID', () => { @@ -78,7 +78,7 @@ describe('DashMetrics', function () { metricsModelMock.setMetrics({}); const lastMpdRequestHeader = dashMetrics.getLatestMPDRequestHeaderValueByID(); - expect(lastMpdRequestHeader).to.be.null; // jshint ignore:line + expect(lastMpdRequestHeader).to.be.null; }); it('should return null when getLatestMPDRequestHeaderValueByID is called and metrics is defined but id is undefined', () => { @@ -87,7 +87,7 @@ describe('DashMetrics', function () { const lastMpdRequestHeader = dashMetrics.getLatestMPDRequestHeaderValueByID(); - expect(lastMpdRequestHeader).to.be.null; // jshint ignore:line + expect(lastMpdRequestHeader).to.be.null; }); }); @@ -107,7 +107,7 @@ describe('DashMetrics', function () { metricsModelMock.setMetrics({}); const lastFragmentRequestHeader = dashMetrics.getLatestFragmentRequestHeaderValueByID(); - expect(lastFragmentRequestHeader).to.be.null; // jshint ignore:line + expect(lastFragmentRequestHeader).to.be.null; }); it('should return null when getLatestFragmentRequestHeaderValueByID is called and httpRequest._responseHeaders and id are undefined', () => { @@ -115,7 +115,7 @@ describe('DashMetrics', function () { metricsModelMock.setMetrics(metrics); const lastFragmentRequestHeader = dashMetrics.getLatestFragmentRequestHeaderValueByID('stream'); - expect(lastFragmentRequestHeader).to.be.null; // jshint ignore:line + expect(lastFragmentRequestHeader).to.be.null; }); }); }); diff --git a/test/unit/dash.DashParser.js b/test/unit/dash.DashParser.js index c6554d06e3..7aa272cf88 100644 --- a/test/unit/dash.DashParser.js +++ b/test/unit/dash.DashParser.js @@ -26,7 +26,7 @@ describe('DashParser', function () { it('should return an Object when parse is called with correct data', async () => { let manifest = await FileLoader.loadTextFile('/data/dash/manifest.xml'); - expect(dashParser.parse.bind(manifest)).to.be.instanceOf(Object); // jshint ignore:line + expect(dashParser.parse.bind(manifest)).to.be.instanceOf(Object); }); describe('DashParser matchers', async () => { @@ -42,9 +42,9 @@ describe('DashParser', function () { let parsedMpd = dashParser.parse(manifest); let audioAdaptationsArray = dashManifestModel.getAdaptationsForType(parsedMpd, 0, 'audio'); - expect(audioAdaptationsArray).to.be.instanceOf(Array); // jshint ignore:line - expect(audioAdaptationsArray.length).to.equal(1); // jshint ignore:line - expect(dashManifestModel.getLanguageForAdaptation(audioAdaptationsArray[0])).to.equal('es'); // jshint ignore:line + expect(audioAdaptationsArray).to.be.instanceOf(Array); + expect(audioAdaptationsArray.length).to.equal(1); + expect(dashManifestModel.getLanguageForAdaptation(audioAdaptationsArray[0])).to.equal('es'); }); it('should return normalized language tages for labels on AdaptationSets', async () => { @@ -52,9 +52,9 @@ describe('DashParser', function () { let audioAdaptation = dashManifestModel.getAdaptationsForType(parsedMpd, 0, 'audio')[0]; let labelArray = dashManifestModel.getLabelsForAdaptation(audioAdaptation); - expect(labelArray).to.be.instanceOf(Array); // jshint ignore:line - expect(labelArray.length).to.equal(2); // jshint ignore:line - expect(labelArray[1].lang).to.equal('fr'); // jshint ignore:line + expect(labelArray).to.be.instanceOf(Array); + expect(labelArray.length).to.equal(2); + expect(labelArray[1].lang).to.equal('fr'); }); }); }) diff --git a/test/unit/dash.models.DashManifestModel.js b/test/unit/dash.models.DashManifestModel.js index 5f4c0a4fa2..de46bf818a 100644 --- a/test/unit/dash.models.DashManifestModel.js +++ b/test/unit/dash.models.DashManifestModel.js @@ -73,86 +73,86 @@ describe('DashManifestModel', function () { it('should return null when getSuggestedPresentationDelay is called and mpd is undefined', () => { const suggestedPresentationDelay = dashManifestModel.getSuggestedPresentationDelay(); - expect(suggestedPresentationDelay).to.be.null; // jshint ignore:line + expect(suggestedPresentationDelay).to.be.null; }); it('should return null when getSuggestedPresentationDelay is called and mpd is an empty object', () => { const suggestedPresentationDelay = dashManifestModel.getSuggestedPresentationDelay({}); - expect(suggestedPresentationDelay).to.be.null; // jshint ignore:line + expect(suggestedPresentationDelay).to.be.null; }); it('should return 5 when getSuggestedPresentationDelay is called and mpd is an object with suggestedPresentationDelay attribute', () => { const suggestedPresentationDelay = dashManifestModel.getSuggestedPresentationDelay({ suggestedPresentationDelay: 5 }); - expect(suggestedPresentationDelay).to.be.equal(5); // jshint ignore:line + expect(suggestedPresentationDelay).to.be.equal(5); }); it('should return null when getAvailabilityStartTime is called and mpd is undefined', () => { const availabilityStartTime = dashManifestModel.getAvailabilityStartTime(); - expect(availabilityStartTime).to.be.null; // jshint ignore:line + expect(availabilityStartTime).to.be.null; }); it('should return null when getAvailabilityStartTime is called and mpd is an empty object', () => { const availabilityStartTime = dashManifestModel.getAvailabilityStartTime({}); - expect(availabilityStartTime).to.be.null; // jshint ignore:line + expect(availabilityStartTime).to.be.null; }); it('should return correct value when getAvailabilityStartTime is called and mpd is object with the availabilityStartTime attribute', () => { const now = new Date(); const availabilityStartTime = dashManifestModel.getAvailabilityStartTime({ availabilityStartTime: now }); - expect(availabilityStartTime).to.be.equal(now.getTime()); // jshint ignore:line + expect(availabilityStartTime).to.be.equal(now.getTime()); }); it('should return empty string when getLanguageForAdaptation is called and adaptation is undefined', () => { const language = dashManifestModel.getLanguageForAdaptation(); - expect(language).to.equal(EMPTY_STRING); // jshint ignore:line + expect(language).to.equal(EMPTY_STRING); }); it('should return an empty array when getViewpointForAdaptation is called and adaptation is undefined', () => { const viewPoint = dashManifestModel.getViewpointForAdaptation(); - expect(viewPoint).to.be.instanceOf(Array); // jshint ignore:line - expect(viewPoint).to.be.empty; // jshint ignore:line + expect(viewPoint).to.be.instanceOf(Array); + expect(viewPoint).to.be.empty; }); it('should return an empty array when getAudioChannelConfigurationForAdaptation is called and adaptation is undefined', () => { const AudioChannelConfigurationArray = dashManifestModel.getAudioChannelConfigurationForAdaptation(); - expect(AudioChannelConfigurationArray).to.be.instanceOf(Array); // jshint ignore:line - expect(AudioChannelConfigurationArray).to.be.empty; // jshint ignore:line + expect(AudioChannelConfigurationArray).to.be.instanceOf(Array); + expect(AudioChannelConfigurationArray).to.be.empty; }); it('should return an empty array when getAccessibilityForAdaptation is called and adaptation is undefined', () => { const accessibilityArray = dashManifestModel.getAccessibilityForAdaptation(); - expect(accessibilityArray).to.be.instanceOf(Array); // jshint ignore:line - expect(accessibilityArray).to.be.empty; // jshint ignore:line + expect(accessibilityArray).to.be.instanceOf(Array); + expect(accessibilityArray).to.be.empty; }); it('should return an empty array when getRolesForAdaptation is called and adaptation is undefined', () => { const rolesArray = dashManifestModel.getRolesForAdaptation(); - expect(rolesArray).to.be.instanceOf(Array); // jshint ignore:line - expect(rolesArray).to.be.empty; // jshint ignore:line + expect(rolesArray).to.be.instanceOf(Array); + expect(rolesArray).to.be.empty; }); it('should return an empty array when getSupplementalPropertiesForAdaptation', () => { const suppPropArray = dashManifestModel.getSupplementalPropertiesForAdaptation(); - expect(suppPropArray).to.be.instanceOf(Object); // jshint ignore:line - expect(suppPropArray).to.be.empty; // jshint ignore:line + expect(suppPropArray).to.be.instanceOf(Object); + expect(suppPropArray).to.be.empty; }); it('should return an empty array when getSupplementalPropertiesAsArrayForAdaptation', () => { const suppPropArray = dashManifestModel.getSupplementalPropertiesAsArrayForAdaptation(); - expect(suppPropArray).to.be.instanceOf(Array); // jshint ignore:line - expect(suppPropArray).to.be.empty; // jshint ignore:line + expect(suppPropArray).to.be.instanceOf(Array); + expect(suppPropArray).to.be.empty; }); it('should return correct array of DescriptorType when getSupplementalPropertiesAsArrayForAdaptation is called', () => { @@ -160,26 +160,26 @@ describe('DashManifestModel', function () { SupplementalProperty_asArray: [{schemeIdUri: 'test.scheme', value: 'testVal'},{schemeIdUri: 'test.scheme', value: 'test2Val'}] }); - expect(suppPropArray).to.be.instanceOf(Array); // jshint ignore:line - expect(suppPropArray[0]).to.be.instanceOf(DescriptorType); // jshint ignore:line - expect(suppPropArray[0].schemeIdUri).equals('test.scheme'); // jshint ignore:line - expect(suppPropArray[0].value).equals('testVal'); // jshint ignore:line - expect(suppPropArray[1].schemeIdUri).equals('test.scheme'); // jshint ignore:line - expect(suppPropArray[1].value).equals('test2Val'); // jshint ignore:line + expect(suppPropArray).to.be.instanceOf(Array); + expect(suppPropArray[0]).to.be.instanceOf(DescriptorType); + expect(suppPropArray[0].schemeIdUri).equals('test.scheme'); + expect(suppPropArray[0].value).equals('testVal'); + expect(suppPropArray[1].schemeIdUri).equals('test.scheme'); + expect(suppPropArray[1].value).equals('test2Val'); }); it('should return an empty array when getSupplementalPropertiesForRepresentation', () => { const suppPropArray = dashManifestModel.getSupplementalPropertiesForRepresentation(); - expect(suppPropArray).to.be.instanceOf(Object); // jshint ignore:line - expect(suppPropArray).to.be.empty; // jshint ignore:line + expect(suppPropArray).to.be.instanceOf(Object); + expect(suppPropArray).to.be.empty; }); it('should return an empty array when getSupplementalPropertiesAsArrayForRepresentation', () => { const suppPropArray = dashManifestModel.getSupplementalPropertiesAsArrayForRepresentation(); - expect(suppPropArray).to.be.instanceOf(Array); // jshint ignore:line - expect(suppPropArray).to.be.empty; // jshint ignore:line + expect(suppPropArray).to.be.instanceOf(Array); + expect(suppPropArray).to.be.empty; }); it('should return correct array of DescriptorType when getSupplementalPropertiesAsArrayForRepresentation is called', () => { @@ -187,84 +187,84 @@ describe('DashManifestModel', function () { SupplementalProperty_asArray: [{schemeIdUri: 'test.scheme', value: 'testVal'}] }); - expect(suppPropArray).to.be.instanceOf(Array); // jshint ignore:line - expect(suppPropArray[0]).to.be.instanceOf(DescriptorType); // jshint ignore:line - expect(suppPropArray[0].schemeIdUri).equals('test.scheme'); // jshint ignore:line - expect(suppPropArray[0].value).equals('testVal'); // jshint ignore:line + expect(suppPropArray).to.be.instanceOf(Array); + expect(suppPropArray[0]).to.be.instanceOf(DescriptorType); + expect(suppPropArray[0].schemeIdUri).equals('test.scheme'); + expect(suppPropArray[0].value).equals('testVal'); }); it('should return null when getAdaptationForId is called and id, manifest and periodIndex are undefined', () => { const adaptation = dashManifestModel.getAdaptationForId(undefined, undefined, undefined); - expect(adaptation).to.be.null; // jshint ignore:line + expect(adaptation).to.be.null; }); it('should return null when getAdaptationForId is called and id and periodIndex are undefined', () => { const manifest = { Period_asArray: [] }; const adaptation = dashManifestModel.getAdaptationForId(undefined, manifest, undefined); - expect(adaptation).to.be.null; // jshint ignore:line + expect(adaptation).to.be.null; }); it('should return null when getAdaptationForId is called and id is undefined', () => { const manifest = { Period_asArray: [] }; const adaptation = dashManifestModel.getAdaptationForId(undefined, manifest, 2); - expect(adaptation).to.be.null; // jshint ignore:line + expect(adaptation).to.be.null; }); it('should return null when getAdaptationForId is called and id is undefined and periodIndex = 0', () => { const manifest = { Period_asArray: [{ AdaptationSet_asArray: [{ id: 0 }] }] }; const adaptation = dashManifestModel.getAdaptationForId(undefined, manifest, 0); - expect(adaptation).to.be.null; // jshint ignore:line + expect(adaptation).to.be.null; }); it('should return valid value when getAdaptationForId is called and id is 0 and periodIndex = 0', () => { const manifest = { Period_asArray: [{ AdaptationSet_asArray: [{ id: 0 }] }] }; const adaptation = dashManifestModel.getAdaptationForId(0, manifest, 0); - expect(adaptation.id).to.equal(0); // jshint ignore:line + expect(adaptation.id).to.equal(0); }); it('should return null when getAdaptationForIndex is called and index, manifest and periodIndex are undefined', () => { const adaptation = dashManifestModel.getAdaptationForIndex(undefined, undefined, undefined); - expect(adaptation).to.be.null; // jshint ignore:line + expect(adaptation).to.be.null; }); it('should return null when getAdaptationForIndex is called and id and periodIndex are undefined', () => { const manifest = { Period_asArray: [] }; const adaptation = dashManifestModel.getAdaptationForIndex(undefined, manifest, undefined); - expect(adaptation).to.be.null; // jshint ignore:line + expect(adaptation).to.be.null; }); it('should return null when getAdaptationForIndex is called and id is undefined', () => { const manifest = { Period_asArray: [] }; const adaptation = dashManifestModel.getAdaptationForIndex(undefined, manifest, 2); - expect(adaptation).to.be.null; // jshint ignore:line + expect(adaptation).to.be.null; }); it('should return null when getAdaptationForIndex is called and id is undefined and periodIndex = 0', () => { const manifest = { Period_asArray: [{ AdaptationSet_asArray: [{ id: 0 }] }] }; const adaptation = dashManifestModel.getAdaptationForIndex(undefined, manifest, 0); - expect(adaptation).to.be.null; // jshint ignore:line + expect(adaptation).to.be.null; }); it('should return valid value when getAdaptationForIndex is called and id is 0 and periodIndex = 0', () => { const manifest = { Period_asArray: [{ AdaptationSet_asArray: [{ id: 0 }] }] }; const adaptation = dashManifestModel.getAdaptationForIndex(0, manifest, 0); - expect(adaptation.id).to.equal(0); // jshint ignore:line + expect(adaptation.id).to.equal(0); }); it('should return -1 when getIndexForAdaptation is called and adaptation, manifest and periodIndex are undefined', () => { const index = dashManifestModel.getIndexForAdaptation(undefined, undefined, undefined); - expect(index).to.equal(-1); // jshint ignore:line + expect(index).to.equal(-1); }); it('should return -1 when getIndexForAdaptation is called and manifest and periodIndex are undefined', () => { @@ -272,29 +272,29 @@ describe('DashManifestModel', function () { var adaptation = mpdHelper.composeAdaptation('video'); const index = dashManifestModel.getIndexForAdaptation(adaptation, manifest, undefined); - expect(index).to.equal(-1); // jshint ignore:line + expect(index).to.equal(-1); }); it('should return -1 when getIndexForAdaptation is called and periodIndex are undefined', () => { var adaptation = mpdHelper.composeAdaptation('video'); const index = dashManifestModel.getIndexForAdaptation(adaptation, undefined, undefined); - expect(index).to.equal(-1); // jshint ignore:line + expect(index).to.equal(-1); }); it('should return an empty array when getAdaptationsForType is called and manifest, periodIndex and type are undefined', () => { const adaptationsArray = dashManifestModel.getAdaptationsForType(); - expect(adaptationsArray).to.be.instanceOf(Array); // jshint ignore:line - expect(adaptationsArray).to.be.empty; // jshint ignore:line + expect(adaptationsArray).to.be.instanceOf(Array); + expect(adaptationsArray).to.be.empty; }); it('should return an empty array when getAdaptationsForType is called and periodIndex and type are undefined', () => { const manifest = { Period_asArray: [] }; const adaptationsArray = dashManifestModel.getAdaptationsForType(manifest, undefined, undefined); - expect(adaptationsArray).to.be.instanceOf(Array); // jshint ignore:line - expect(adaptationsArray).to.be.empty; // jshint ignore:line + expect(adaptationsArray).to.be.instanceOf(Array); + expect(adaptationsArray).to.be.empty; }); it('should return an empty array when getAdaptationsForType is called and type is undefined', () => { @@ -306,25 +306,25 @@ describe('DashManifestModel', function () { it('should return null when getCodec is called and adaptation is undefined', () => { const codec = dashManifestModel.getCodec(); - expect(codec).to.be.null; // jshint ignore:line + expect(codec).to.be.null; }); it('should return null when getCodec is called and adaptation.Representation_asArray is undefined', () => { const codec = dashManifestModel.getCodec({}); - expect(codec).to.be.null; // jshint ignore:line + expect(codec).to.be.null; }); it('should return null when getCodec is called and adaptation.Representation_asArray.length is -1', () => { const codec = dashManifestModel.getCodec({ Representation_asArray: { length: -1 } }); - expect(codec).to.be.null; // jshint ignore:line + expect(codec).to.be.null; }); it('should return null when getCodec is called and representationId is not an integer', () => { const codec = dashManifestModel.getCodec({ Representation_asArray: { length: 1 } }, true); - expect(codec).to.be.null; // jshint ignore:line + expect(codec).to.be.null; }); it('should return correct codec when getCodec is called and representationId is an integer and addResolutionInfo is true', () => { @@ -337,7 +337,7 @@ describe('DashManifestModel', function () { }] }, 0, true); - expect(codec).to.be.equal('video/mp4;codecs="avc1.4D400D";width="1080";height="960"'); // jshint ignore:line + expect(codec).to.be.equal('video/mp4;codecs="avc1.4D400D";width="1080";height="960"'); }); it('should return correct codec when getCodec is called and representationId is an integer and addResolutionInfo is false', () => { @@ -350,7 +350,7 @@ describe('DashManifestModel', function () { }] }, 0, false); - expect(codec).to.be.equal('video/mp4;codecs="avc1.4D400D"'); // jshint ignore:line + expect(codec).to.be.equal('video/mp4;codecs="avc1.4D400D"'); }); it('should return correct codec without a correct mime type profile when getCodec is called and representationId is an integer and addResolutionInfo is false', () => { @@ -363,7 +363,7 @@ describe('DashManifestModel', function () { }] }, 0, false); - expect(codec).to.be.equal('video/mp4;codecs="avc1.4D400D"'); // jshint ignore:line + expect(codec).to.be.equal('video/mp4;codecs="avc1.4D400D"'); }); it('should return correct codec without an invalid mime type profile when getCodec is called and representationId is an integer and addResolutionInfo is false', () => { @@ -376,65 +376,65 @@ describe('DashManifestModel', function () { }] }, 0, false); - expect(codec).to.be.equal('video/mp4;codecs="avc1.4D400D"'); // jshint ignore:line + expect(codec).to.be.equal('video/mp4;codecs="avc1.4D400D"'); }); it('should return null when getMimeType is called and adaptation is undefined', () => { const mimeType = dashManifestModel.getMimeType(); - expect(mimeType).to.be.null; // jshint ignore:line + expect(mimeType).to.be.null; }); it('should return null when getMimeType is called and adaptation.Representation_asArray is undefined', () => { const mimeType = dashManifestModel.getMimeType({}); - expect(mimeType).to.be.null; // jshint ignore:line + expect(mimeType).to.be.null; }); it('should return null when getMimeType is called and adaptation.Representation_asArray.length is -1', () => { const mimeType = dashManifestModel.getMimeType({ Representation_asArray: { length: -1 } }); - expect(mimeType).to.be.null; // jshint ignore:line + expect(mimeType).to.be.null; }); it('should return null when getKID is called and adaptation is undefined', () => { const kid = dashManifestModel.getKID(); - expect(kid).to.be.null; // jshint ignore:line + expect(kid).to.be.null; }); it('should return kid value when getKID is called and adaptation is well defined', () => { const kid = dashManifestModel.getKID({ 'cenc:default_KID': 'testKid' }); - expect(kid).to.equal('testKid'); // jshint ignore:line + expect(kid).to.equal('testKid'); }); it('should return empty array when getLabelsForAdaptation is called and adaptation is undefined', () => { const labels = dashManifestModel.getLabelsForAdaptation(); - expect(labels).to.be.instanceOf(Array); // jshint ignore:line - expect(labels).to.be.empty; // jshint ignore:line + expect(labels).to.be.instanceOf(Array); + expect(labels).to.be.empty; }); it('should return empty array when getLabelsForAdaptation is called and adaptation is not well defined', () => { const labels = dashManifestModel.getLabelsForAdaptation({}); - expect(labels).to.be.instanceOf(Array); // jshint ignore:line - expect(labels).to.be.empty; // jshint ignore:line + expect(labels).to.be.instanceOf(Array); + expect(labels).to.be.empty; }); it('should return empty array when getLabelsForAdaptation is called and adaptation is not well defined', () => { const labels = dashManifestModel.getLabelsForAdaptation({ Label_asArray: true }); - expect(labels).to.be.instanceOf(Array); // jshint ignore:line - expect(labels).to.be.empty; // jshint ignore:line + expect(labels).to.be.instanceOf(Array); + expect(labels).to.be.empty; }); it('should return empty array when getLabelsForAdaptation is called and adaptation is well defined with an empty Label_asArray', () => { const labels = dashManifestModel.getLabelsForAdaptation({ Label_asArray: [] }); - expect(labels).to.be.instanceOf(Array); // jshint ignore:line - expect(labels).to.be.empty; // jshint ignore:line + expect(labels).to.be.instanceOf(Array); + expect(labels).to.be.empty; }); it('should return correct array when getLabelsForAdaptation is called and adaptation is well defined', () => { @@ -445,71 +445,71 @@ describe('DashManifestModel', function () { }, { lang: 'eng', __text: 'english' }] }); - expect(labels).to.be.instanceOf(Array); // jshint ignore:line - expect(labels.length).to.equal(2); // jshint ignore:line - expect(labels[0].lang).to.equal('fre'); // jshint ignore:line + expect(labels).to.be.instanceOf(Array); + expect(labels.length).to.equal(2); + expect(labels[0].lang).to.equal('fre'); }); it('should return null when getContentProtectionData is called and adaptation is undefined', () => { const contentProtection = dashManifestModel.getContentProtectionData(); - expect(contentProtection).to.be.null; // jshint ignore:line + expect(contentProtection).to.be.null; }); it('should return null when getContentProtectionData is called and adaptation is defined, but ContentProtection_asArray is an empty array', () => { const adaptation = { ContentProtection_asArray: [] }; const contentProtection = dashManifestModel.getContentProtectionData(adaptation); - expect(contentProtection).to.be.null; // jshint ignore:line + expect(contentProtection).to.be.null; }); it('should return false when getIsDynamic is called and manifest is undefined', () => { const isDynamic = dashManifestModel.getIsDynamic(); - expect(isDynamic).to.be.false; // jshint ignore:line + expect(isDynamic).to.be.false; }); it('should return Number.MAX_SAFE_NUMBER (or Number.MAX_VALUE in case MAX_SAFE_NUMBER is not defined) when getDuration is called and manifest is undefined', () => { const duration = dashManifestModel.getDuration(); - expect(duration).to.equal(Number.MAX_SAFE_INTEGER || Number.MAX_VALUE); // jshint ignore:line + expect(duration).to.equal(Number.MAX_SAFE_INTEGER || Number.MAX_VALUE); }); it('should return duration when getDuration is called and manifest has a defined mediaPresentationDuration', () => { const duration = dashManifestModel.getDuration({ mediaPresentationDuration: 50 }); - expect(duration).to.equal(50); // jshint ignore:line + expect(duration).to.equal(50); }); it('should return infinity when getDuration is called and manifest is a dynamic one', () => { const duration = dashManifestModel.getDuration({ type: DashConstants.DYNAMIC }); - expect(duration).to.equal(Infinity); // jshint ignore:line + expect(duration).to.equal(Infinity); }); it('should return 0 when getRepresentationCount is called and adaptation is undefined', () => { const representationCount = dashManifestModel.getRepresentationCount(); - expect(representationCount).to.equal(0); // jshint ignore:line + expect(representationCount).to.equal(0); }); it('should return NaN when getBandwidth is called and representation is undefined', () => { const bdtw = dashManifestModel.getBandwidth(); - expect(bdtw).to.be.NaN; // jshint ignore:line + expect(bdtw).to.be.NaN; }); it('should return correct value when getBandwidth is called and representation is defined', () => { const bdtw = dashManifestModel.getBandwidth({ bandwidth: 9600 }); - expect(bdtw).to.equal(9600); // jshint ignore:line + expect(bdtw).to.equal(9600); }); it('should return empty array when getBitrateListForAdaptation is called and adaptation is undefined', () => { const bitrateList = dashManifestModel.getBitrateListForAdaptation(); - expect(bitrateList).to.be.instanceOf(Array); // jshint ignore:line - expect(bitrateList).to.be.empty; // jshint ignore:line + expect(bitrateList).to.be.instanceOf(Array); + expect(bitrateList).to.be.empty; }); it('should not return empty array when getBitrateListForAdaptation is called and adaptation is defined', () => { @@ -517,65 +517,65 @@ describe('DashManifestModel', function () { const bitrateList = dashManifestModel.getBitrateListForAdaptation(realAdaptation); - expect(bitrateList).to.be.instanceOf(Array); // jshint ignore:line - expect(bitrateList).not.to.be.empty; // jshint ignore:line + expect(bitrateList).to.be.instanceOf(Array); + expect(bitrateList).not.to.be.empty; }); it('should return null when getRepresentationFor is called and index and adaptation are undefined', () => { const representation = dashManifestModel.getRepresentationFor(); - expect(representation).to.be.null; // jshint ignore:line + expect(representation).to.be.null; }); it('should return null when getRepresentationFor is called and index and andadaptation.Representation_asArray are undefined', () => { const adaptation = {}; const representation = dashManifestModel.getRepresentationFor(undefined, adaptation); - expect(representation).to.be.null; // jshint ignore:line + expect(representation).to.be.null; }); it('should return null when getRepresentationFor is called and index is undefined', () => { var adaptation = mpdHelper.composeAdaptation('video'); const representation = dashManifestModel.getRepresentationFor(undefined, adaptation); - expect(representation).to.be.null; // jshint ignore:line + expect(representation).to.be.null; }); it('should return representation.id = video20 when getRepresentationFor is called', () => { var adaptation = mpdHelper.composeAdaptation('video'); const representation = dashManifestModel.getRepresentationFor(0, adaptation); - expect(representation.id).equal('video20'); // jshint ignore:line + expect(representation.id).equal('video20'); }); it('should return undefined when getLocation is called and manifest is undefined', () => { const location = dashManifestModel.getLocation(); - expect(location).to.be.empty; // jshint ignore:line + expect(location).to.be.empty; }); it('should return undefined when getLocation is called and manifest is an empty object', () => { const location = dashManifestModel.getLocation({}); - expect(location).to.be.empty; // jshint ignore:line + expect(location).to.be.empty; }); it('should return valid location when getLocation is called and manifest is a valid object', () => { const location = dashManifestModel.getLocation({ Location: '', Location_asArray: ['location_1'] }); - expect(location[0].url).to.be.equal('location_1'); // jshint ignore:line + expect(location[0].url).to.be.equal('location_1'); }); it('should return undefined when getPatchLocation is called and manifest is undefined', () => { const location = dashManifestModel.getPatchLocation(); - expect(location).to.be.empty; // jshint ignore:line + expect(location).to.be.empty; }); it('should return undefined when getPatchLocation is called and one is not present', () => { const location = dashManifestModel.getPatchLocation({}); - expect(location).to.be.empty; // jshint ignore:line + expect(location).to.be.empty; }); it('should return valid patch location when getLocation is called and manifest contains complex location', () => { @@ -597,15 +597,15 @@ describe('DashManifestModel', function () { it('should return an empty Array when getUTCTimingSources is called and manifest is undefined', () => { const utcSourceArray = dashManifestModel.getUTCTimingSources(); - expect(utcSourceArray).to.be.instanceOf(Array); // jshint ignore:line - expect(utcSourceArray).to.be.empty; // jshint ignore:line + expect(utcSourceArray).to.be.instanceOf(Array); + expect(utcSourceArray).to.be.empty; }); it('should return an empty Array when getEventStreamForRepresentation is called and manifest and representation are undefined', () => { const eventsStream = dashManifestModel.getEventStreamForRepresentation(); - expect(eventsStream).to.be.instanceOf(Array); // jshint ignore:line - expect(eventsStream).to.be.empty; // jshint ignore:line + expect(eventsStream).to.be.instanceOf(Array); + expect(eventsStream).to.be.empty; }); it('should not return an empty Array when getEventStreamForRepresentation is called and manifest and representation are well defined', () => { @@ -635,35 +635,35 @@ describe('DashManifestModel', function () { const representation = { adaptation: { index: 0, period: { index: 0 } }, index: 0 }; const eventsStream = dashManifestModel.getEventStreamForRepresentation(manifest, representation); - expect(eventsStream).to.be.instanceOf(Array); // jshint ignore:line - expect(eventsStream).to.be.empty; // jshint ignore:line + expect(eventsStream).to.be.instanceOf(Array); + expect(eventsStream).to.be.empty; }); it('should return an empty Array when getEventStreamForAdaptationSet is called and manifest and adaptation are undefined', () => { const eventsStream = dashManifestModel.getEventStreamForAdaptationSet(); - expect(eventsStream).to.be.instanceOf(Array); // jshint ignore:line - expect(eventsStream).to.be.empty; // jshint ignore:line + expect(eventsStream).to.be.instanceOf(Array); + expect(eventsStream).to.be.empty; }); it('should return an empty Array when getEventsForPeriod is called and manifest and period are undefined', () => { const eventsStream = dashManifestModel.getEventsForPeriod(); - expect(eventsStream).to.be.instanceOf(Array); // jshint ignore:line - expect(eventsStream).to.be.empty; // jshint ignore:line + expect(eventsStream).to.be.instanceOf(Array); + expect(eventsStream).to.be.empty; }); it('should return mpd.manifest = null when getMpd is called and manifest is undefined', () => { const mpd = dashManifestModel.getMpd(); - expect(mpd.manifest).to.be.null; // jshint ignore:line + expect(mpd.manifest).to.be.null; }); it('should return mpd.manifest not null when getMpd is called and manifest is defined', () => { const mpd = dashManifestModel.getMpd({}); - expect(mpd.manifest).not.to.be.null; // jshint ignore:line - expect(mpd.manifest.availabilityStartTime).to.be.undefined; // jshint ignore:line + expect(mpd.manifest).not.to.be.null; + expect(mpd.manifest.availabilityStartTime).to.be.undefined; }); it('should return an error when getRegularPeriods and getEndTimeForLastPeriod are called and duration is undefined', () => { @@ -675,8 +675,8 @@ describe('DashManifestModel', function () { it('should return an empty array when getRegularPeriods is called and mpd is undefined', () => { const periodsArray = dashManifestModel.getRegularPeriods(); - expect(periodsArray).to.be.instanceOf(Array); // jshint ignore:line - expect(periodsArray).to.be.empty; // jshint ignore:line + expect(periodsArray).to.be.instanceOf(Array); + expect(periodsArray).to.be.empty; }); it('should return just the first period when type is static and neither start nor duration period attributes are provided', () => { @@ -707,8 +707,8 @@ describe('DashManifestModel', function () { const periodsArray = dashManifestModel.getRegularPeriods(mpd); - expect(periodsArray).to.be.instanceOf(Array); // jshint ignore:line - expect(periodsArray).to.have.lengthOf(1); // jshint ignore:line + expect(periodsArray).to.be.instanceOf(Array); + expect(periodsArray).to.have.lengthOf(1); expect(periodsArray[0].start).to.equals(0); expect(periodsArray[0].duration).to.equals(300); }); @@ -750,8 +750,8 @@ describe('DashManifestModel', function () { }; const periodsArray = dashManifestModel.getRegularPeriods(manifest); - expect(periodsArray).to.be.instanceOf(Array); // jshint ignore:line - expect(periodsArray).to.have.lengthOf(3); // jshint ignore:line + expect(periodsArray).to.be.instanceOf(Array); + expect(periodsArray).to.have.lengthOf(3); expect(periodsArray[0].start).to.equals(0); expect(periodsArray[0].duration).to.equals(100); @@ -800,8 +800,8 @@ describe('DashManifestModel', function () { }; const periodsArray = dashManifestModel.getRegularPeriods(manifest); - expect(periodsArray).to.be.instanceOf(Array); // jshint ignore:line - expect(periodsArray).to.have.lengthOf(3); // jshint ignore:line + expect(periodsArray).to.be.instanceOf(Array); + expect(periodsArray).to.have.lengthOf(3); expect(periodsArray[0].start).to.equals(0); expect(periodsArray[0].duration).to.equals(80); @@ -816,24 +816,24 @@ describe('DashManifestModel', function () { it('should return an empty array when getAdaptationsForPeriod is called and period is undefined', () => { const adaptationArray = dashManifestModel.getAdaptationsForPeriod(); - expect(adaptationArray).to.be.instanceOf(Array); // jshint ignore:line - expect(adaptationArray).to.be.empty; // jshint ignore:line + expect(adaptationArray).to.be.instanceOf(Array); + expect(adaptationArray).to.be.empty; }); it('should not return an empty array when getAdaptationsForPeriod is called and period is defined', () => { const period = voHelper.getDummyPeriod(); const adaptationArray = dashManifestModel.getAdaptationsForPeriod(period); - expect(adaptationArray).to.be.instanceOf(Array); // jshint ignore:line - expect(adaptationArray).not.to.be.empty; // jshint ignore:line - expect(adaptationArray[0].index).to.equals(0); // jshint ignore:line + expect(adaptationArray).to.be.instanceOf(Array); + expect(adaptationArray).not.to.be.empty; + expect(adaptationArray[0].index).to.equals(0); }); it('should return an empty array when getRepresentationsForAdaptation is called and adaptation is undefined', () => { const representationArray = dashManifestModel.getRepresentationsForAdaptation(); - expect(representationArray).to.be.instanceOf(Array); // jshint ignore:line - expect(representationArray).to.be.empty; // jshint ignore:line + expect(representationArray).to.be.instanceOf(Array); + expect(representationArray).to.be.empty; }); it('should not return an empty array when getRepresentationsForAdaptation is called and adaptation is defined', () => { @@ -862,21 +862,21 @@ describe('DashManifestModel', function () { }; const representationArray = dashManifestModel.getRepresentationsForAdaptation(voAdaptation); - expect(representationArray).to.be.instanceOf(Array); // jshint ignore:line - expect(representationArray).not.to.be.empty; // jshint ignore:line - expect(representationArray[0].index).to.equals(0); // jshint ignore:line + expect(representationArray).to.be.instanceOf(Array); + expect(representationArray).not.to.be.empty; + expect(representationArray[0].index).to.equals(0); }); it('should return null when getId is called and manifest undefined', () => { const id = dashManifestModel.getId(); - expect(id).to.be.null; // jshint ignore:line + expect(id).to.be.null; }); it('should return null when getId is called and manifest is missing id', () => { const id = dashManifestModel.getId({}); - expect(id).to.be.null; // jshint ignore:line + expect(id).to.be.null; }); it('should return id when getId is called and manifest contains id', () => { @@ -892,7 +892,7 @@ describe('DashManifestModel', function () { it('should return false when hasProfile is called and manifest is undefined', () => { const IsDVB = dashManifestModel.hasProfile(); - expect(IsDVB).to.be.false; // jshint ignore:line + expect(IsDVB).to.be.false; }); it('should return true when hasProfile is called and manifest contains a valid DVB profile', () => { @@ -902,7 +902,7 @@ describe('DashManifestModel', function () { const isDVB = dashManifestModel.hasProfile(manifest, 'urn:dvb:dash:profile:dvb-dash:2014'); - expect(isDVB).to.be.true; // jshint ignore:line + expect(isDVB).to.be.true; }); it('should return false when hasProfile is called and manifest does not contain a valid DVB profile', () => { @@ -912,13 +912,13 @@ describe('DashManifestModel', function () { const isDVB = dashManifestModel.hasProfile(manifest, 'urn:dvb:dash:profile:dvb-dash:2014'); - expect(isDVB).to.be.false; // jshint ignore:line + expect(isDVB).to.be.false; }); it('should return null when getPublishTime is called and manifest is undefined', () => { const publishTime = dashManifestModel.getPublishTime(); - expect(publishTime).to.be.null; // jshint ignore:line + expect(publishTime).to.be.null; }); it('should return valid date object when getPublishTime is called with manifest with valid date', () => { @@ -929,7 +929,7 @@ describe('DashManifestModel', function () { const publishTime = dashManifestModel.getPublishTime(manifest); expect(publishTime).to.be.instanceOf(Date); - expect(publishTime.getTime()).to.not.be.NaN; // jshint ignore:line + expect(publishTime.getTime()).to.not.be.NaN; }); it('should return invalid date object when getPublishTime is called with manifest with invalid date', () => { @@ -940,18 +940,18 @@ describe('DashManifestModel', function () { const publishTime = dashManifestModel.getPublishTime(manifest); expect(publishTime).to.be.instanceOf(Date); - expect(publishTime.getTime()).to.be.NaN; // jshint ignore:line + expect(publishTime.getTime()).to.be.NaN; }); it('should return NaN when getManifestUpdatePeriod is called and manifest is undefined', () => { const updatePeriod = dashManifestModel.getManifestUpdatePeriod(); - expect(updatePeriod).to.be.NaN; // jshint ignore:line + expect(updatePeriod).to.be.NaN; }); it('should return NaN when minimumUpdatePeriod is not present in manifest', () => { const manifest = {}; const updatePeriod = dashManifestModel.getManifestUpdatePeriod(manifest); - expect(updatePeriod).to.be.NaN; // jshint ignore:line + expect(updatePeriod).to.be.NaN; }); it('should return valid value when minimumUpdatePeriod is present in manifest and latencyOfLastUpdate is defined', () => { @@ -960,7 +960,7 @@ describe('DashManifestModel', function () { const manifest = { minimumUpdatePeriod: minimumUpdatePeriod }; const expectedResult = minimumUpdatePeriod - latencyOfLastUpdate; const updatePeriod = dashManifestModel.getManifestUpdatePeriod(manifest, latencyOfLastUpdate); - expect(updatePeriod).to.equal(expectedResult); // jshint ignore:line + expect(updatePeriod).to.equal(expectedResult); }); it('should return valid value when minimumUpdatePeriod is present in manifest and latencyOfLastUpdate is not defined', () => { @@ -968,7 +968,7 @@ describe('DashManifestModel', function () { const manifest = { minimumUpdatePeriod: minimumUpdatePeriod }; const expectedResult = minimumUpdatePeriod; const updatePeriod = dashManifestModel.getManifestUpdatePeriod(manifest); - expect(updatePeriod).to.equal(expectedResult); // jshint ignore:line + expect(updatePeriod).to.equal(expectedResult); }); describe('getBaseUrlsFromElement', () => { @@ -977,8 +977,8 @@ describe('DashManifestModel', function () { const obj = dashManifestModel.getBaseURLsFromElement(node); - expect(obj).to.be.instanceOf(Array); // jshint ignore:line - expect(obj).to.be.empty; // jshint ignore:line + expect(obj).to.be.instanceOf(Array); + expect(obj).to.be.empty; }); @@ -989,10 +989,10 @@ describe('DashManifestModel', function () { const obj = dashManifestModel.getBaseURLsFromElement(node); - expect(obj).to.be.instanceOf(Array); // jshint ignore:line - expect(obj).to.have.lengthOf(1); // jshint ignore:line - expect(obj[0]).to.be.instanceOf(BaseURL); // jshint ignore:line - expect(obj[0].url).to.equal(TEST_URL); // jshint ignore:line + expect(obj).to.be.instanceOf(Array); + expect(obj).to.have.lengthOf(1); + expect(obj[0]).to.be.instanceOf(BaseURL); + expect(obj[0].url).to.equal(TEST_URL); }); it('returns an Array of BaseURLs with BaseURL[0] serviceLocation set to URL when no serviceLocation was specified', () => { @@ -1004,11 +1004,11 @@ describe('DashManifestModel', function () { const obj = dashManifestModel.getBaseURLsFromElement(node); - expect(obj).to.be.instanceOf(Array); // jshint ignore:line - expect(obj).to.have.lengthOf(1); // jshint ignore:line - expect(obj[0]).to.be.instanceOf(BaseURL); // jshint ignore:line - expect(obj[0].url).to.equal(TEST_URL); // jshint ignore:line - expect(obj[0].serviceLocation).to.equal(TEST_URL); // jshint ignore:line + expect(obj).to.be.instanceOf(Array); + expect(obj).to.have.lengthOf(1); + expect(obj[0]).to.be.instanceOf(BaseURL); + expect(obj[0].url).to.equal(TEST_URL); + expect(obj[0].serviceLocation).to.equal(TEST_URL); }); it('returns an Array of BaseURLs with length 1 when multiple relative BaseUrls were specified', () => { @@ -1025,10 +1025,10 @@ describe('DashManifestModel', function () { const obj = dashManifestModel.getBaseURLsFromElement(node); - expect(obj).to.be.instanceOf(Array); // jshint ignore:line - expect(obj).to.have.lengthOf(1); // jshint ignore:line - expect(obj[0]).to.be.instanceOf(BaseURL); // jshint ignore:line - expect(obj[0].url).to.equal(RELATIVE_TEST_URL + '0'); // jshint ignore:line + expect(obj).to.be.instanceOf(Array); + expect(obj).to.have.lengthOf(1); + expect(obj[0]).to.be.instanceOf(BaseURL); + expect(obj[0].url).to.equal(RELATIVE_TEST_URL + '0'); }); it('returns an Array of BaseURLs when multiple BaseUrls were specified', () => { @@ -1045,11 +1045,11 @@ describe('DashManifestModel', function () { const obj = dashManifestModel.getBaseURLsFromElement(node); - expect(obj).to.be.instanceOf(Array); // jshint ignore:line - expect(obj).to.have.lengthOf(2); // jshint ignore:line + expect(obj).to.be.instanceOf(Array); + expect(obj).to.have.lengthOf(2); obj.forEach((o, i) => { - expect(o).to.be.instanceOf(BaseURL); // jshint ignore:line - expect(o.url).to.equal(TEST_URL + i); // jshint ignore:line + expect(o).to.be.instanceOf(BaseURL); + expect(o.url).to.equal(TEST_URL + i); }); }); @@ -1063,11 +1063,11 @@ describe('DashManifestModel', function () { const obj = dashManifestModel.getBaseURLsFromElement(node); - expect(obj).to.be.instanceOf(Array); // jshint ignore:line - expect(obj).to.have.lengthOf(1); // jshint ignore:line - expect(obj[0]).to.be.instanceOf(BaseURL); // jshint ignore:line - expect(obj[0].url).to.equal(TEST_URL); // jshint ignore:line - expect(obj[0].serviceLocation).to.equal(SERVICE_LOCATION); // jshint ignore:line + expect(obj).to.be.instanceOf(Array); + expect(obj).to.have.lengthOf(1); + expect(obj[0]).to.be.instanceOf(BaseURL); + expect(obj[0].url).to.equal(TEST_URL); + expect(obj[0].serviceLocation).to.equal(SERVICE_LOCATION); }); it('returns an Array of BaseURLs with BaseURL[0] having correct defaults for DVB extensions when not specified', () => { @@ -1079,10 +1079,10 @@ describe('DashManifestModel', function () { const obj = dashManifestModel.getBaseURLsFromElement(node); - expect(obj).to.be.instanceOf(Array); // jshint ignore:line - expect(obj).to.have.lengthOf(1); // jshint ignore:line - expect(obj[0].dvb_priority).to.equal(BaseURL.DEFAULT_DVB_PRIORITY); // jshint ignore:line - expect(obj[0].dvb_weight).to.equal(BaseURL.DEFAULT_DVB_WEIGHT); // jshint ignore:line + expect(obj).to.be.instanceOf(Array); + expect(obj).to.have.lengthOf(1); + expect(obj[0].dvb_priority).to.equal(BaseURL.DEFAULT_DVB_PRIORITY); + expect(obj[0].dvb_weight).to.equal(BaseURL.DEFAULT_DVB_WEIGHT); }); it('returns an Array of BaseURLs with BaseURL[0] having correct priority and weight for DVB extensions when specified', () => { @@ -1098,10 +1098,10 @@ describe('DashManifestModel', function () { const obj = dashManifestModel.getBaseURLsFromElement(node); - expect(obj).to.be.instanceOf(Array); // jshint ignore:line - expect(obj).to.have.lengthOf(1); // jshint ignore:line - expect(obj[0].dvb_priority).to.equal(TEST_PRIORITY); // jshint ignore:line - expect(obj[0].dvb_weight).to.equal(TEST_WEIGHT); // jshint ignore:line + expect(obj).to.be.instanceOf(Array); + expect(obj).to.have.lengthOf(1); + expect(obj[0].dvb_priority).to.equal(TEST_PRIORITY); + expect(obj[0].dvb_weight).to.equal(TEST_WEIGHT); }); it('returns an Array of BaseURLs with BaseURL[0] resolved to the document base uri when the base uri is specified and the input url is relative', () => { @@ -1114,9 +1114,9 @@ describe('DashManifestModel', function () { const obj = dashManifestModel.getBaseURLsFromElement(node); - expect(obj).to.be.instanceOf(Array); // jshint ignore:line - expect(obj).to.have.lengthOf(1); // jshint ignore:line - expect(obj[0].url).to.equal(TEST_URL + RELATIVE_TEST_URL); // jshint ignore:line + expect(obj).to.be.instanceOf(Array); + expect(obj).to.have.lengthOf(1); + expect(obj[0].url).to.equal(TEST_URL + RELATIVE_TEST_URL); }); it('returns an Array of BaseURLs with BaseURL[0] resolved to the document base uri when the base uri is the mpd and the input url is relative', () => { @@ -1129,9 +1129,9 @@ describe('DashManifestModel', function () { const obj = dashManifestModel.getBaseURLsFromElement(node); - expect(obj).to.be.instanceOf(Array); // jshint ignore:line - expect(obj).to.have.lengthOf(1); // jshint ignore:line - expect(obj[0].url).to.equal(TEST_URL + RELATIVE_TEST_URL); // jshint ignore:line + expect(obj).to.be.instanceOf(Array); + expect(obj).to.have.lengthOf(1); + expect(obj[0].url).to.equal(TEST_URL + RELATIVE_TEST_URL); }); it('returns an Array of BaseURLs with BaseURL[0] ignoring the document base uri when the base uri is specified and the input url is absolute', () => { @@ -1144,9 +1144,9 @@ describe('DashManifestModel', function () { const obj = dashManifestModel.getBaseURLsFromElement(node); - expect(obj).to.be.instanceOf(Array); // jshint ignore:line - expect(obj).to.have.lengthOf(1); // jshint ignore:line - expect(obj[0].url).to.equal(TEST_URL); // jshint ignore:line + expect(obj).to.be.instanceOf(Array); + expect(obj).to.have.lengthOf(1); + expect(obj[0].url).to.equal(TEST_URL); }); it('returns an Array of BaseURLs with BaseURL[0] resolved to the document base uri when the base uri is specified but no other urls', () => { @@ -1156,9 +1156,9 @@ describe('DashManifestModel', function () { const obj = dashManifestModel.getBaseURLsFromElement(node); - expect(obj).to.be.instanceOf(Array); // jshint ignore:line - expect(obj).to.have.lengthOf(1); // jshint ignore:line - expect(obj[0].url).to.equal(TEST_URL); // jshint ignore:line + expect(obj).to.be.instanceOf(Array); + expect(obj).to.have.lengthOf(1); + expect(obj[0].url).to.equal(TEST_URL); }); }); @@ -1168,8 +1168,8 @@ describe('DashManifestModel', function () { const obj = dashManifestModel.getProducerReferenceTimesForAdaptation(node); - expect(obj).to.be.instanceOf(Array); // jshint ignore:line - expect(obj).to.be.empty; // jshint ignore:line + expect(obj).to.be.instanceOf(Array); + expect(obj).to.be.empty; }); it('returns an empty Array where a single ProducerReferenceTime element on a node has missing mandatory attributes', () => { @@ -1185,8 +1185,8 @@ describe('DashManifestModel', function () { const obj = dashManifestModel.getProducerReferenceTimesForAdaptation(node); - expect(obj).to.be.instanceOf(Array); // jshint ignore:line - expect(obj).to.be.empty; // jshint ignore:line + expect(obj).to.be.instanceOf(Array); + expect(obj).to.be.empty; }); it('returns an Array of ProducerReferenceTime elements with mandatory attributes', () => { @@ -1230,9 +1230,9 @@ describe('DashManifestModel', function () { }; const obj = dashManifestModel.getProducerReferenceTimesForAdaptation(node); - expect(obj).to.be.instanceOf(Array); // jshint ignore:line - expect(obj).to.have.lengthOf(1); // jshint ignore:line - expect(obj[0].type).to.equal('encoder'); // jshint ignore:line + expect(obj).to.be.instanceOf(Array); + expect(obj).to.have.lengthOf(1); + expect(obj[0].type).to.equal('encoder'); }); it('returns ProducerReferenceTimes within representations', () => { diff --git a/test/unit/dash.utils.SegmentUtils.js b/test/unit/dash.utils.SegmentUtils.js index 95b77968a7..db04c7fb27 100644 --- a/test/unit/dash.utils.SegmentUtils.js +++ b/test/unit/dash.utils.SegmentUtils.js @@ -19,7 +19,7 @@ describe('SegmentUtils', function () { describe('unescapeDollarsInTemplate', function () { it('should return undefined when unescapeDollarsInTemplate is called with an undefined url', function () { const result = unescapeDollarsInTemplate(); - expect(result).to.be.undefined; // jshint ignore:line + expect(result).to.be.undefined; }); it('should unescape $$', function () { @@ -31,7 +31,7 @@ describe('SegmentUtils', function () { describe('replaceIDForTemplate', function () { it('should return undefined when replaceIDForTemplate is called with an undefined url', function () { const result = replaceIDForTemplate(); - expect(result).to.be.undefined; // jshint ignore:line + expect(result).to.be.undefined; }); it('should return url when replaceIDForTemplate is called with an undefined value', function () { @@ -53,7 +53,7 @@ describe('SegmentUtils', function () { describe('replaceTokenForTemplate', function () { it('should return undefined when no url is provided', function () { const result = replaceTokenForTemplate(undefined, 'Number', 1); - expect(result).to.be.undefined; // jshint ignore:line + expect(result).to.be.undefined; }); it('should replace tokens', function () { diff --git a/test/unit/mocks/MediaControllerMock.js b/test/unit/mocks/MediaControllerMock.js index ba6210a9d4..e3b6596b17 100644 --- a/test/unit/mocks/MediaControllerMock.js +++ b/test/unit/mocks/MediaControllerMock.js @@ -8,11 +8,12 @@ class MediaControllerMock { this.initialSettings = {}; this.switchMode = {}; this.selectionMode = undefined; - this.track = undefined; + this.track = undefined; this.tracks = []; } - checkInitialMediaSettingsForType() {} + checkInitialMediaSettingsForType() { + } addTrack(track) { this.tracks.push(track); @@ -99,13 +100,16 @@ class MediaControllerMock { return settings.lang === track.lang && matchRole; } - setConfig() {} + setConfig() { + } - saveTextSettingsDisabled() {} + saveTextSettingsDisabled() { + } reset() { this.setup(); } } + export default MediaControllerMock; diff --git a/test/unit/mss.parser.MssParser.js b/test/unit/mss.parser.MssParser.js index b3a3c3f476..585999d59e 100644 --- a/test/unit/mss.parser.MssParser.js +++ b/test/unit/mss.parser.MssParser.js @@ -49,7 +49,7 @@ describe('MssParser', function () { } } }); - it('should skip video adaptations if fourCC attribute is not found', async () => { + it('should skip video adaptations if fourCC attribute is not found', async () => { let xml = await FileLoader.loadTextFile('/data/mss/manifestFourCCError.xml'); let manifest = mssParser.parse(xml); let adaptations = manifest.Period.AdaptationSet_asArray; diff --git a/test/unit/streaming.controllers.AbrController.js b/test/unit/streaming.controllers.AbrController.js index 6212e739cf..12caa0b83c 100644 --- a/test/unit/streaming.controllers.AbrController.js +++ b/test/unit/streaming.controllers.AbrController.js @@ -68,17 +68,17 @@ describe('AbrController', function () { it('should return null when attempting to get abandonment state when abandonmentStateDict array is empty', function () { const state = abrCtrl.getAbandonmentStateFor('1', Constants.AUDIO); - expect(state).to.be.null; // jshint ignore:line + expect(state).to.be.null; }); it('should return 0 when calling getQualityForBitrate with no mediaInfo', function () { const quality = abrCtrl.getQualityForBitrate(undefined, undefined, true); - expect(quality).to.be.equal(0); // jshint ignore:line + expect(quality).to.be.equal(0); }); it('should return true if isPlayingAtTopQuality function is called without parameter', function () { let isPlayingTopQuality = abrCtrl.isPlayingAtTopQuality(); - expect(isPlayingTopQuality).to.be.true; // jshint ignore:line + expect(isPlayingTopQuality).to.be.true; }); it('should update top quality index', function () { @@ -178,7 +178,7 @@ describe('AbrController', function () { abrCtrl.updateTopQualityIndex(mediaInfo); // Max allowed bitrate in kbps, bandwidth is in bps - const s = {streaming: {abr: {maxBitrate: {}}}}; + const s = { streaming: { abr: { maxBitrate: {} } } }; const streamId = streamProcessor.getStreamInfo().id; s.streaming.abr.maxBitrate[Constants.VIDEO] = streamProcessor.getMediaInfo().bitrateList[0].bandwidth / 1000; settings.update(s); @@ -225,7 +225,7 @@ describe('AbrController', function () { it('should return the appropriate min allowed index for the min allowed bitrate set', function () { // Min allowed bitrate in kbps, bandwidth is in bps - const s = {streaming: {abr: {minBitrate: {}}}}; + const s = { streaming: { abr: { minBitrate: {} } } }; const streamId = streamProcessor.getStreamInfo().id; s.streaming.abr.minBitrate[Constants.VIDEO] = streamProcessor.getMediaInfo().bitrateList[0].bandwidth / 1000; settings.update(s); @@ -279,7 +279,7 @@ describe('AbrController', function () { it('should configure initial bitrate for text type', function () { let initialBitrateFor = abrCtrl.getInitialBitrateFor(Constants.TEXT); - expect(initialBitrateFor).to.be.NaN; // jshint ignore:line + expect(initialBitrateFor).to.be.NaN; }); it('should return an appropriate BitrateInfo when calling getTopBitrateInfoFor', function () { @@ -290,7 +290,7 @@ describe('AbrController', function () { expect(bitrateInfo.bitrate).to.be.equal(3000000); expect(bitrateInfo.qualityIndex).to.be.equal(2); - const s = {streaming: {abr: {limitBitrateByPortal: true}}}; + const s = { streaming: { abr: { limitBitrateByPortal: true } } }; settings.update(s); bitrateInfo = abrCtrl.getTopBitrateInfoFor(Constants.VIDEO); @@ -301,9 +301,9 @@ describe('AbrController', function () { it('should return the appropriate top quality index when calling getMaxAllowedIndexFor', function () { videoModelMock.setClientWidth(899); - const s = {streaming: {abr: {limitBitrateByPortal: true}}}; + const s = { streaming: { abr: { limitBitrateByPortal: true } } }; settings.update(s); - abrCtrl.updateTopQualityIndex({type: Constants.VIDEO, streamInfo: {id: 'test'}, representationCount: 5}); + abrCtrl.updateTopQualityIndex({ type: Constants.VIDEO, streamInfo: { id: 'test' }, representationCount: 5 }); let topQualityIndex = abrCtrl.getMaxAllowedIndexFor(Constants.VIDEO, 'test'); expect(topQualityIndex).to.be.equal(4); }); diff --git a/test/unit/streaming.controllers.BufferController.js b/test/unit/streaming.controllers.BufferController.js index d50328a896..b6fc3db213 100644 --- a/test/unit/streaming.controllers.BufferController.js +++ b/test/unit/streaming.controllers.BufferController.js @@ -84,7 +84,7 @@ describe('BufferController', function () { it('should not create a preBufferSink if mediaInfo is undefined', function (done) { bufferController.createBufferSink() .then((sink) => { - expect(sink).to.be.null; // jshint ignore:line + expect(sink).to.be.null; done(); }) .catch((e) => { @@ -156,10 +156,10 @@ describe('BufferController', function () { bufferController.createBufferSink(mediaInfo) .then(() => { const buffer = mediaSourceMock.buffers[0]; - expect(buffer).to.exist; // jshint ignore:line + expect(buffer).to.exist; bufferController.reset(false, false); - expect(buffer.aborted).to.be.true; // jshint ignore:line + expect(buffer.aborted).to.be.true; done(); }) .catch((e) => { @@ -199,7 +199,7 @@ describe('BufferController', function () { }; eventBus.on(Events.INIT_FRAGMENT_LOADED, onInitDataLoaded, this); - expect(mediaSourceMock.buffers[0].chunk).to.be.null; // jshint ignore:line + expect(mediaSourceMock.buffers[0].chunk).to.be.null; // send event eventBus.trigger(Events.INIT_FRAGMENT_LOADED, event); }); @@ -232,7 +232,7 @@ describe('BufferController', function () { }; eventBus.on(Events.INIT_FRAGMENT_LOADED, onInitDataLoaded, this); - expect(cache).to.not.exist; // jshint ignore:line + expect(cache).to.not.exist; // send event eventBus.trigger(Events.INIT_FRAGMENT_LOADED, event); }); @@ -267,7 +267,7 @@ describe('BufferController', function () { }; eventBus.on(Events.MEDIA_FRAGMENT_LOADED, onMediaFragmentLoaded, this); - expect(mediaSourceMock.buffers[0].chunk).to.be.null; // jshint ignore:line + expect(mediaSourceMock.buffers[0].chunk).to.be.null; // send event eventBus.trigger(Events.MEDIA_FRAGMENT_LOADED, event); }); @@ -421,7 +421,7 @@ describe('BufferController', function () { end: 11 }); let range = bufferController.getRangeAt(10); - expect(range).to.be.null; // jshint ignore:line + expect(range).to.be.null; }); it('should return range of buffered data - time not in range (little gap)', function () { diff --git a/test/unit/streaming.controllers.MediaController.js b/test/unit/streaming.controllers.MediaController.js index a4e5ea5023..43a83c89e3 100644 --- a/test/unit/streaming.controllers.MediaController.js +++ b/test/unit/streaming.controllers.MediaController.js @@ -41,27 +41,27 @@ describe('MediaController', function () { describe('Initial Settings', function () { it('should not set initial settings - type undefined', function () { let settings = mediaController.getInitialSettings(undefined); - expect(settings).to.not.exist; // jshint ignore:line + expect(settings).to.not.exist; mediaController.setInitialSettings(undefined); settings = mediaController.getInitialSettings(undefined); - expect(settings).to.not.exist; // jshint ignore:line + expect(settings).to.not.exist; }); it('should not set initial settings - value undefined', function () { let settings = mediaController.getInitialSettings('test'); - expect(settings).to.not.exist; // jshint ignore:line + expect(settings).to.not.exist; mediaController.setInitialSettings('test'); settings = mediaController.getInitialSettings('test'); - expect(settings).to.not.exist; // jshint ignore:line + expect(settings).to.not.exist; }); it('should set and get initial settings', function () { let settings = mediaController.getInitialSettings('test'); - expect(settings).to.not.exist; // jshint ignore:line + expect(settings).to.not.exist; mediaController.setInitialSettings('test', 'testvalue'); @@ -92,7 +92,7 @@ describe('MediaController', function () { }; let equal = mediaController.isTracksEqual(track1, track2); - expect(equal).to.be.false; // jshint ignore:line + expect(equal).to.be.false; }); @@ -104,7 +104,7 @@ describe('MediaController', function () { lang: 'lang', roles: 1, accessibility: 'description', - accessibilitiesWithSchemeIdUri: {schemeIdUri: 'urn:scheme:test:1:2023', value: 'description'}, + accessibilitiesWithSchemeIdUri: { schemeIdUri: 'urn:scheme:test:1:2023', value: 'description' }, audioChannelConfiguration: 1 }; @@ -114,11 +114,11 @@ describe('MediaController', function () { lang: 'lang', roles: 1, accessibility: 'description', - accessibilitiesWithSchemeIdUri: {schemeIdUri: 'urn:scheme:test:2:2023', value: 'description'}, + accessibilitiesWithSchemeIdUri: { schemeIdUri: 'urn:scheme:test:2:2023', value: 'description' }, audioChannelConfiguration: 1 }; let equal = mediaController.isTracksEqual(track1, track2); - expect(equal).to.be.false; // jshint ignore:line + expect(equal).to.be.false; }); @@ -142,7 +142,7 @@ describe('MediaController', function () { audioChannelConfiguration: 1 }; let equal = mediaController.isTracksEqual(track1, track2); - expect(equal).to.be.true; // jshint ignore:line + expect(equal).to.be.true; }); it('should return false if track1 is undefined or null', function () { @@ -158,7 +158,7 @@ describe('MediaController', function () { audioChannelConfiguration: 1 }; let equal = mediaController.isTracksEqual(track1, track2); - expect(equal).to.be.false; // jshint ignore:line + expect(equal).to.be.false; }); it('should return false if track2 is undefined or null', function () { @@ -175,7 +175,7 @@ describe('MediaController', function () { let track2 = null; let equal = mediaController.isTracksEqual(track1, track2); - expect(equal).to.be.false; // jshint ignore:line + expect(equal).to.be.false; }); it('should return true if both tracks are undefined or null', function () { @@ -184,7 +184,7 @@ describe('MediaController', function () { let track2 = null; let equal = mediaController.isTracksEqual(track1, track2); - expect(equal).to.be.true; // jshint ignore:line + expect(equal).to.be.true; }); it('should return true if track are equals (DescriptorType)', function () { @@ -195,7 +195,7 @@ describe('MediaController', function () { lang: 'lang', roles: 1, accessibility: 'description', - accessibility_withSchemeIdUri: [{schemeIdUri: 'urn:scheme:test:1:2023', value: 'description'}], + accessibility_withSchemeIdUri: [{ schemeIdUri: 'urn:scheme:test:1:2023', value: 'description' }], audioChannelConfiguration: 1 }; @@ -205,11 +205,11 @@ describe('MediaController', function () { lang: 'lang', roles: 1, accessibility: 'description', - accessibility_withSchemeIdUri: [{schemeIdUri: 'urn:scheme:test:1:2023', value: 'description'}], + accessibility_withSchemeIdUri: [{ schemeIdUri: 'urn:scheme:test:1:2023', value: 'description' }], audioChannelConfiguration: 1 }; let equal = mediaController.isTracksEqual(track1, track2); - expect(equal).to.be.true; // jshint ignore:line + expect(equal).to.be.true; }); @@ -219,21 +219,21 @@ describe('MediaController', function () { it('getTracksFor should return an empty array if parameters are not defined', function () { const trackArray = mediaController.getTracksFor(); - expect(trackArray).to.be.instanceOf(Array); // jshint ignore:line - expect(trackArray).to.be.empty; // jshint ignore:line + expect(trackArray).to.be.instanceOf(Array); + expect(trackArray).to.be.empty; }); it('getTracksFor should return an empty array if parameters are defined, but internal tracks array is empty', function () { const trackArray = mediaController.getTracksFor(Constants.VIDEO, { id: 'id' }); - expect(trackArray).to.be.instanceOf(Array); // jshint ignore:line - expect(trackArray).to.be.empty; // jshint ignore:line + expect(trackArray).to.be.instanceOf(Array); + expect(trackArray).to.be.empty; }); it('getCurrentTrackFor should return null if parameters are not defined', function () { const currentTrack = mediaController.getCurrentTrackFor(); - expect(currentTrack).to.be.null; // jshint ignore:line + expect(currentTrack).to.be.null; }); it('should add and retrieve track', function () { @@ -251,7 +251,7 @@ describe('MediaController', function () { let trackList = mediaController.getTracksFor(trackType, streamInfo.id); expect(trackList).to.have.lengthOf(1); - expect(objectUtils.areEqual(trackList[0], track)).to.be.true; // jshint ignore:line + expect(objectUtils.areEqual(trackList[0], track)).to.be.true; }); it('should not set uncorrect track', function () { @@ -262,7 +262,7 @@ describe('MediaController', function () { mediaController.setTrack(track); let currentTrack = mediaController.getCurrentTrackFor(trackType, streamInfo); - expect(objectUtils.areEqual(currentTrack, track)).to.be.false; // jshint ignore:line + expect(objectUtils.areEqual(currentTrack, track)).to.be.false; }); it('should add and set current track', function () { @@ -279,7 +279,7 @@ describe('MediaController', function () { // check that track has been added let currentTrack = mediaController.getCurrentTrackFor(trackType, streamInfo.id); - expect(objectUtils.areEqual(currentTrack, track)).to.be.true; // jshint ignore:line + expect(objectUtils.areEqual(currentTrack, track)).to.be.true; }); it('should check current track', function () { @@ -301,7 +301,7 @@ describe('MediaController', function () { // check that track has been added let currentTrack = mediaController.isCurrentTrack(track); - expect(currentTrack).to.be.true; // jshint ignore:line + expect(currentTrack).to.be.true; }); it('should check current track', function () { @@ -323,7 +323,7 @@ describe('MediaController', function () { // check that track has been added let currentTrack = mediaController.isCurrentTrack(null); - expect(currentTrack).to.be.false; // jshint ignore:line + expect(currentTrack).to.be.false; }); it('should emit Events.CURRENT_TRACK_CHANGED when track has changed', function (done) { @@ -362,7 +362,7 @@ describe('MediaController', function () { // check that track has been added let currentTrack = mediaController.getCurrentTrackFor(trackType, streamInfo.id); - expect(objectUtils.areEqual(currentTrack, track1)).to.be.true; // jshint ignore:line + expect(objectUtils.areEqual(currentTrack, track1)).to.be.true; let onTrackChanged = function (e) { @@ -370,8 +370,8 @@ describe('MediaController', function () { let current = e.newMediaInfo; let switchMode = e.switchMode; - expect(objectUtils.areEqual(old, track1)).to.be.true; // jshint ignore:line - expect(objectUtils.areEqual(current, track2)).to.be.true; // jshint ignore:line + expect(objectUtils.areEqual(old, track1)).to.be.true; + expect(objectUtils.areEqual(current, track2)).to.be.true; expect(switchMode).to.equal(Constants.TRACK_SWITCH_MODE_ALWAYS_REPLACE); eventBus.off(Events.CURRENT_TRACK_CHANGED, onTrackChanged); @@ -423,7 +423,7 @@ describe('MediaController', function () { lang: 'en', viewpoint: null, roles: ['alternate'], - accessibility: ['1','description'], + accessibility: ['1', 'description'], audioChannelConfiguration: 6, selectionPriority: 3 }; @@ -444,11 +444,11 @@ describe('MediaController', function () { let trackList = mediaController.getTracksFor(trackType, streamInfo.id); expect(trackList).to.have.lengthOf(2); - expect(objectUtils.areEqual(trackList[0], frTrack)).to.be.true; // jshint ignore:line - expect(objectUtils.areEqual(trackList[1], qtzTrack)).to.be.true; // jshint ignore:line + expect(objectUtils.areEqual(trackList[0], frTrack)).to.be.true; + expect(objectUtils.areEqual(trackList[1], qtzTrack)).to.be.true; let currentTrack = mediaController.getCurrentTrackFor(trackType, streamInfo.id); - expect(objectUtils.areEqual(currentTrack, frTrack)).to.be.false; // jshint ignore:line + expect(objectUtils.areEqual(currentTrack, frTrack)).to.be.false; // call to setInitialMediaSettingsForType mediaController.setInitialSettings(trackType, { @@ -458,7 +458,7 @@ describe('MediaController', function () { mediaController.setInitialMediaSettingsForType(trackType, streamInfo); currentTrack = mediaController.getCurrentTrackFor(trackType, streamInfo.id); - expect(objectUtils.areEqual(currentTrack, qtzTrack)).to.be.true; // jshint ignore:line + expect(objectUtils.areEqual(currentTrack, qtzTrack)).to.be.true; }); @@ -468,11 +468,11 @@ describe('MediaController', function () { let trackList = mediaController.getTracksFor(trackType, streamInfo.id); expect(trackList).to.have.lengthOf(2); - expect(objectUtils.areEqual(trackList[0], qtzTrack)).to.be.true; // jshint ignore:line - expect(objectUtils.areEqual(trackList[1], frTrack)).to.be.true; // jshint ignore:line + expect(objectUtils.areEqual(trackList[0], qtzTrack)).to.be.true; + expect(objectUtils.areEqual(trackList[1], frTrack)).to.be.true; let currentTrack = mediaController.getCurrentTrackFor(trackType, streamInfo.id); - expect(objectUtils.areEqual(currentTrack, frTrack)).to.be.false; // jshint ignore:line + expect(objectUtils.areEqual(currentTrack, frTrack)).to.be.false; // call to setInitialMediaSettingsForType mediaController.setInitialSettings(trackType, { @@ -482,7 +482,7 @@ describe('MediaController', function () { mediaController.setInitialMediaSettingsForType(trackType, streamInfo); currentTrack = mediaController.getCurrentTrackFor(trackType, streamInfo.id); - expect(objectUtils.areEqual(currentTrack, frTrack)).to.be.true; // jshint ignore:line + expect(objectUtils.areEqual(currentTrack, frTrack)).to.be.true; }); it('should check initial media settings to choose initial track with a string/regex lang', function () { @@ -491,11 +491,11 @@ describe('MediaController', function () { let trackList = mediaController.getTracksFor(trackType, streamInfo.id); expect(trackList).to.have.lengthOf(2); - expect(objectUtils.areEqual(trackList[0], frTrack)).to.be.true; // jshint ignore:line - expect(objectUtils.areEqual(trackList[1], qtzTrack)).to.be.true; // jshint ignore:line + expect(objectUtils.areEqual(trackList[0], frTrack)).to.be.true; + expect(objectUtils.areEqual(trackList[1], qtzTrack)).to.be.true; let currentTrack = mediaController.getCurrentTrackFor(trackType, streamInfo.id); - expect(objectUtils.areEqual(currentTrack, frTrack)).to.be.false; // jshint ignore:line + expect(objectUtils.areEqual(currentTrack, frTrack)).to.be.false; // call to setInitialMediaSettingsForType mediaController.setInitialSettings(trackType, { @@ -505,7 +505,7 @@ describe('MediaController', function () { mediaController.setInitialMediaSettingsForType(trackType, streamInfo); currentTrack = mediaController.getCurrentTrackFor(trackType, streamInfo.id); - expect(objectUtils.areEqual(currentTrack, frTrack)).to.be.true; // jshint ignore:line + expect(objectUtils.areEqual(currentTrack, frTrack)).to.be.true; }); it('should check initial media settings to choose initial track with a regex lang', function () { @@ -514,12 +514,12 @@ describe('MediaController', function () { let trackList = mediaController.getTracksFor(trackType, streamInfo.id); expect(trackList).to.have.lengthOf(2); - expect(objectUtils.areEqual(trackList[0], frTrack)).to.be.true; // jshint ignore:line - expect(objectUtils.areEqual(trackList[1], qtzTrack)).to.be.true; // jshint ignore:line + expect(objectUtils.areEqual(trackList[0], frTrack)).to.be.true; + expect(objectUtils.areEqual(trackList[1], qtzTrack)).to.be.true; let currentTrack = mediaController.getCurrentTrackFor(trackType, streamInfo.id); - expect(objectUtils.areEqual(currentTrack, frTrack)).to.be.false; // jshint ignore:line - expect(objectUtils.areEqual(currentTrack, qtzTrack)).to.be.false; // jshint ignore:line + expect(objectUtils.areEqual(currentTrack, frTrack)).to.be.false; + expect(objectUtils.areEqual(currentTrack, qtzTrack)).to.be.false; // call to setInitialMediaSettingsForType mediaController.setInitialSettings(trackType, { @@ -529,7 +529,7 @@ describe('MediaController', function () { mediaController.setInitialMediaSettingsForType(trackType, streamInfo); currentTrack = mediaController.getCurrentTrackFor(trackType, streamInfo.id); - expect(objectUtils.areEqual(currentTrack, qtzTrack)).to.be.true; // jshint ignore:line + expect(objectUtils.areEqual(currentTrack, qtzTrack)).to.be.true; }); it('should check initial media settings to choose initial track with a lang and absent accessibility setting', function () { @@ -539,14 +539,14 @@ describe('MediaController', function () { let trackList = mediaController.getTracksFor(trackType, streamInfo.id); expect(trackList).to.have.lengthOf(3); - expect(objectUtils.areEqual(trackList[0], enTrack)).to.be.true; // jshint ignore:line - expect(objectUtils.areEqual(trackList[1], enADTrack)).to.be.true; // jshint ignore:line - expect(objectUtils.areEqual(trackList[2], esTrack)).to.be.true; // jshint ignore:line + expect(objectUtils.areEqual(trackList[0], enTrack)).to.be.true; + expect(objectUtils.areEqual(trackList[1], enADTrack)).to.be.true; + expect(objectUtils.areEqual(trackList[2], esTrack)).to.be.true; let currentTrack = mediaController.getCurrentTrackFor(trackType, streamInfo.id); - expect(objectUtils.areEqual(currentTrack, enTrack)).to.be.false; // jshint ignore:line - expect(objectUtils.areEqual(currentTrack, enADTrack)).to.be.false; // jshint ignore:line - expect(objectUtils.areEqual(currentTrack, esTrack)).to.be.false; // jshint ignore:line + expect(objectUtils.areEqual(currentTrack, enTrack)).to.be.false; + expect(objectUtils.areEqual(currentTrack, enADTrack)).to.be.false; + expect(objectUtils.areEqual(currentTrack, esTrack)).to.be.false; // call to setInitialMediaSettingsForType mediaController.setInitialSettings(trackType, { @@ -555,7 +555,7 @@ describe('MediaController', function () { mediaController.setInitialMediaSettingsForType(trackType, streamInfo); currentTrack = mediaController.getCurrentTrackFor(trackType, streamInfo.id); - expect(objectUtils.areEqual(currentTrack, enTrack)).to.be.true; // jshint ignore:line + expect(objectUtils.areEqual(currentTrack, enTrack)).to.be.true; }); it('should check initial media settings to choose initial track with a lang and empty accessibility setting', function () { @@ -565,14 +565,14 @@ describe('MediaController', function () { let trackList = mediaController.getTracksFor(trackType, streamInfo.id); expect(trackList).to.have.lengthOf(3); - expect(objectUtils.areEqual(trackList[0], enTrack)).to.be.true; // jshint ignore:line - expect(objectUtils.areEqual(trackList[1], enADTrack)).to.be.true; // jshint ignore:line - expect(objectUtils.areEqual(trackList[2], esTrack)).to.be.true; // jshint ignore:line + expect(objectUtils.areEqual(trackList[0], enTrack)).to.be.true; + expect(objectUtils.areEqual(trackList[1], enADTrack)).to.be.true; + expect(objectUtils.areEqual(trackList[2], esTrack)).to.be.true; let currentTrack = mediaController.getCurrentTrackFor(trackType, streamInfo.id); - expect(objectUtils.areEqual(currentTrack, enTrack)).to.be.false; // jshint ignore:line - expect(objectUtils.areEqual(currentTrack, enADTrack)).to.be.false; // jshint ignore:line - expect(objectUtils.areEqual(currentTrack, esTrack)).to.be.false; // jshint ignore:line + expect(objectUtils.areEqual(currentTrack, enTrack)).to.be.false; + expect(objectUtils.areEqual(currentTrack, enADTrack)).to.be.false; + expect(objectUtils.areEqual(currentTrack, esTrack)).to.be.false; // call to setInitialMediaSettingsForType mediaController.setInitialSettings(trackType, { @@ -582,7 +582,7 @@ describe('MediaController', function () { mediaController.setInitialMediaSettingsForType(trackType, streamInfo); currentTrack = mediaController.getCurrentTrackFor(trackType, streamInfo.id); - expect(objectUtils.areEqual(currentTrack, enTrack)).to.be.true; // jshint ignore:line + expect(objectUtils.areEqual(currentTrack, enTrack)).to.be.true; }); it('should check initial media settings to choose initial track with a lang and accessibility', function () { @@ -592,14 +592,14 @@ describe('MediaController', function () { let trackList = mediaController.getTracksFor(trackType, streamInfo.id); expect(trackList).to.have.lengthOf(3); - expect(objectUtils.areEqual(trackList[0], enTrack)).to.be.true; // jshint ignore:line - expect(objectUtils.areEqual(trackList[1], enADTrack)).to.be.true; // jshint ignore:line - expect(objectUtils.areEqual(trackList[2], esTrack)).to.be.true; // jshint ignore:line + expect(objectUtils.areEqual(trackList[0], enTrack)).to.be.true; + expect(objectUtils.areEqual(trackList[1], enADTrack)).to.be.true; + expect(objectUtils.areEqual(trackList[2], esTrack)).to.be.true; let currentTrack = mediaController.getCurrentTrackFor(trackType, streamInfo.id); - expect(objectUtils.areEqual(currentTrack, enTrack)).to.be.false; // jshint ignore:line - expect(objectUtils.areEqual(currentTrack, enADTrack)).to.be.false; // jshint ignore:line - expect(objectUtils.areEqual(currentTrack, esTrack)).to.be.false; // jshint ignore:line + expect(objectUtils.areEqual(currentTrack, enTrack)).to.be.false; + expect(objectUtils.areEqual(currentTrack, enADTrack)).to.be.false; + expect(objectUtils.areEqual(currentTrack, esTrack)).to.be.false; // call to setInitialMediaSettingsForType mediaController.setInitialSettings(trackType, { @@ -609,7 +609,7 @@ describe('MediaController', function () { mediaController.setInitialMediaSettingsForType(trackType, streamInfo); currentTrack = mediaController.getCurrentTrackFor(trackType, streamInfo.id); - expect(objectUtils.areEqual(currentTrack, enADTrack)).to.be.true; // jshint ignore:line + expect(objectUtils.areEqual(currentTrack, enADTrack)).to.be.true; }); it('should check initial media settings to choose initial accessibility track where media has no accessibility for requested language', function () { @@ -619,14 +619,14 @@ describe('MediaController', function () { let trackList = mediaController.getTracksFor(trackType, streamInfo.id); expect(trackList).to.have.lengthOf(3); - expect(objectUtils.areEqual(trackList[0], enTrack)).to.be.true; // jshint ignore:line - expect(objectUtils.areEqual(trackList[1], enADTrack)).to.be.true; // jshint ignore:line - expect(objectUtils.areEqual(trackList[2], esTrack)).to.be.true; // jshint ignore:line + expect(objectUtils.areEqual(trackList[0], enTrack)).to.be.true; + expect(objectUtils.areEqual(trackList[1], enADTrack)).to.be.true; + expect(objectUtils.areEqual(trackList[2], esTrack)).to.be.true; let currentTrack = mediaController.getCurrentTrackFor(trackType, streamInfo.id); - expect(objectUtils.areEqual(currentTrack, enTrack)).to.be.false; // jshint ignore:line - expect(objectUtils.areEqual(currentTrack, enADTrack)).to.be.false; // jshint ignore:line - expect(objectUtils.areEqual(currentTrack, esTrack)).to.be.false; // jshint ignore:line + expect(objectUtils.areEqual(currentTrack, enTrack)).to.be.false; + expect(objectUtils.areEqual(currentTrack, enADTrack)).to.be.false; + expect(objectUtils.areEqual(currentTrack, esTrack)).to.be.false; // call to setInitialMediaSettingsForType mediaController.setInitialSettings(trackType, { @@ -636,7 +636,7 @@ describe('MediaController', function () { mediaController.setInitialMediaSettingsForType(trackType, streamInfo); currentTrack = mediaController.getCurrentTrackFor(trackType, streamInfo.id); - expect(objectUtils.areEqual(currentTrack, esTrack)).to.be.true; // jshint ignore:line + expect(objectUtils.areEqual(currentTrack, esTrack)).to.be.true; }); }); @@ -652,7 +652,7 @@ describe('MediaController', function () { }; }); const selection = mediaController.selectInitialTrack(type, tracks); - expect(objectUtils.areEqual(selection.bitrateList, expectedTrack.bitrateList)).to.be.true; // jshint ignore:line + expect(objectUtils.areEqual(selection.bitrateList, expectedTrack.bitrateList)).to.be.true; } describe('"highestSelectionPriority" mode', function () { diff --git a/test/unit/streaming.metrics.utils.ManifestParsing.js b/test/unit/streaming.metrics.utils.ManifestParsing.js index cc252a8840..5bf0ed578e 100644 --- a/test/unit/streaming.metrics.utils.ManifestParsing.js +++ b/test/unit/streaming.metrics.utils.ManifestParsing.js @@ -14,8 +14,8 @@ describe('ManifestParsing', function () { it('should return an empty array if no manifest is used', () => { const metrics = manifestParsing.getMetrics(); - expect(metrics).to.be.instanceOf(Array); // jshint ignore:line - expect(metrics).to.be.empty; // jshint ignore:line + expect(metrics).to.be.instanceOf(Array); + expect(metrics).to.be.empty; }); }); }); diff --git a/test/unit/streaming.models.BaseURLTreeModel.js b/test/unit/streaming.models.BaseURLTreeModel.js index dd3e913e1f..4203fa63d6 100644 --- a/test/unit/streaming.models.BaseURLTreeModel.js +++ b/test/unit/streaming.models.BaseURLTreeModel.js @@ -36,10 +36,10 @@ describe('BaseURLTreeModel', function () { const manifest = parser.parse(xml); expect(baseURLTreeModel.update.bind(baseURLTreeModel, manifest)).to.not.throw(); let nodes = baseURLTreeModel.getForPath(); - expect(nodes).to.be.instanceOf(Array); // jshint ignore:line - expect(nodes).to.be.empty; // jshint ignore:line + expect(nodes).to.be.instanceOf(Array); + expect(nodes).to.be.empty; nodes = baseURLTreeModel.getForPath(['./']); - expect(nodes).to.be.instanceOf(Array); // jshint ignore:line - expect(nodes).to.be.empty; // jshint ignore:line + expect(nodes).to.be.instanceOf(Array); + expect(nodes).to.be.empty; }); }); diff --git a/test/unit/streaming.models.CustomParametersModel.js b/test/unit/streaming.models.CustomParametersModel.js index faeed9c1aa..fb70bf84dc 100644 --- a/test/unit/streaming.models.CustomParametersModel.js +++ b/test/unit/streaming.models.CustomParametersModel.js @@ -14,7 +14,7 @@ describe('CustomParametersModel', function () { customParametersModel.reset(); }); - it('Method removeUTCTimingSource should throw an exception', () => { + it('Method removeUTCTimingSource should throw an exception', () => { expect(customParametersModel.removeUTCTimingSource.bind(customParametersModel, true, 'string')).to.throw(Constants.BAD_ARGUMENT_ERROR); expect(customParametersModel.removeUTCTimingSource.bind(customParametersModel, 1, 'string')).to.throw(Constants.BAD_ARGUMENT_ERROR); expect(customParametersModel.removeUTCTimingSource.bind(customParametersModel, 'string', true)).to.throw(Constants.BAD_ARGUMENT_ERROR); @@ -23,7 +23,7 @@ describe('CustomParametersModel', function () { expect(customParametersModel.removeUTCTimingSource.bind(customParametersModel, 1, 1)).to.throw(Constants.BAD_ARGUMENT_ERROR); }); - it('Method addUTCTimingSource should throw an exception', () => { + it('Method addUTCTimingSource should throw an exception', () => { expect(customParametersModel.addUTCTimingSource.bind(customParametersModel, true, 'string')).to.throw(Constants.BAD_ARGUMENT_ERROR); expect(customParametersModel.addUTCTimingSource.bind(customParametersModel, 1, 'string')).to.throw(Constants.BAD_ARGUMENT_ERROR); expect(customParametersModel.addUTCTimingSource.bind(customParametersModel, 'string', true)).to.throw(Constants.BAD_ARGUMENT_ERROR); diff --git a/test/unit/streaming.models.FragmentModel.js b/test/unit/streaming.models.FragmentModel.js index 871813dfe9..8b985a09fd 100644 --- a/test/unit/streaming.models.FragmentModel.js +++ b/test/unit/streaming.models.FragmentModel.js @@ -46,14 +46,14 @@ describe('FragmentModel', function () { it('should return false when isFragmentLoaded is called and request is undefined', () => { const isFragmentLoaded = fragmentModel.isFragmentLoaded(); - expect(isFragmentLoaded).to.be.false; // jshint ignore:line + expect(isFragmentLoaded).to.be.false; }); it('should return false when isFragmentLoaded is called and request is undefined but executedRequests is not empty', () => { fragmentModel.executeRequest(completeInitRequest); const isFragmentLoaded = fragmentModel.isFragmentLoaded(); - expect(isFragmentLoaded).to.be.false; // jshint ignore:line + expect(isFragmentLoaded).to.be.false; fragmentModel.reset(); }); diff --git a/test/unit/streaming.models.MetricsModel.js b/test/unit/streaming.models.MetricsModel.js index b3dc7bc15e..4d57f934c9 100644 --- a/test/unit/streaming.models.MetricsModel.js +++ b/test/unit/streaming.models.MetricsModel.js @@ -21,20 +21,20 @@ describe('MetricsModel', function () { it('should return null when getMetricsFor is called and type is undefined', function () { const metrics = metricsModel.getMetricsFor(); - expect(metrics).to.be.null; // jshint ignore:line + expect(metrics).to.be.null; }); it('should return an empty MetricsList when getMetricsFor is called and type is defined', function () { const metrics = metricsModel.getMetricsFor(Constants.VIDEO); - expect(metrics.TcpList).to.be.instanceOf(Array); // jshint ignore:line - expect(metrics.TcpList).to.be.empty; // jshint ignore:line + expect(metrics.TcpList).to.be.instanceOf(Array); + expect(metrics.TcpList).to.be.empty; }); it('should return null when getMetricsFor is called and type is defined and readOnly is true', function () { const metrics = metricsModel.getMetricsFor(Constants.VIDEO, true); - expect(metrics).to.be.null; // jshint ignore:line + expect(metrics).to.be.null; }); it('should not trigger METRIC_ADDED event when addDroppedFrames is called and quality is undefined', function () { @@ -42,7 +42,7 @@ describe('MetricsModel', function () { eventBus.on(Events.METRIC_ADDED, spy); metricsModel.addDroppedFrames(Constants.VIDEO); - expect(spy).to.have.not.been.called; // jshint ignore:line + expect(spy).to.have.not.been.called; eventBus.off(Events.METRIC_ADDED, spy); }); @@ -52,7 +52,7 @@ describe('MetricsModel', function () { eventBus.on(Events.METRIC_ADDED, spy); metricsModel.addDroppedFrames(Constants.VIDEO, {}); - expect(spy).to.have.been.called.exactly(1); // jshint ignore:line + expect(spy).to.have.been.called.exactly(1); eventBus.off(Events.METRIC_ADDED, spy); }); @@ -62,7 +62,7 @@ describe('MetricsModel', function () { eventBus.on(Events.METRIC_CHANGED, spy); metricsModel.clearCurrentMetricsForType(); - expect(spy).to.have.been.called.exactly(1); // jshint ignore:line + expect(spy).to.have.been.called.exactly(1); eventBus.off(Events.METRIC_CHANGED, spy); }); @@ -74,8 +74,8 @@ describe('MetricsModel', function () { let metric_type = e.metric; let vo = e.value; - expect(type).to.equal(Constants.VIDEO); // jshint ignore:line - expect(metric_type).to.equal(MetricsConstants.BUFFER_LEVEL); // jshint ignore:line + expect(type).to.equal(Constants.VIDEO); + expect(metric_type).to.equal(MetricsConstants.BUFFER_LEVEL); expect(vo.t).to.equal(50); expect(vo.level).to.equal(25); @@ -92,8 +92,8 @@ describe('MetricsModel', function () { let type = e.mediaType; let metric_type = e.metric; - expect(type).to.equal(Constants.VIDEO); // jshint ignore:line - expect(metric_type).to.equal(MetricsConstants.MANIFEST_UPDATE_TRACK_INFO); // jshint ignore:line + expect(type).to.equal(Constants.VIDEO); + expect(metric_type).to.equal(MetricsConstants.MANIFEST_UPDATE_TRACK_INFO); eventBus.off(Events.METRIC_UPDATED, onMetricUpdated); done(); @@ -108,9 +108,9 @@ describe('MetricsModel', function () { let type = e.mediaType; let metric_type = e.metric; - expect(type).to.equal(Constants.VIDEO); // jshint ignore:line - expect(metric_type).to.equal(MetricsConstants.TRACK_SWITCH); // jshint ignore:line - expect(e.value.lto).to.be.undefined; // jshint ignore:line + expect(type).to.equal(Constants.VIDEO); + expect(metric_type).to.equal(MetricsConstants.TRACK_SWITCH); + expect(e.value.lto).to.be.undefined; eventBus.off(Events.METRIC_ADDED, onMetricAdded); done(); @@ -118,4 +118,4 @@ describe('MetricsModel', function () { eventBus.on(Events.METRIC_ADDED, onMetricAdded, this); metricsModel.addRepresentationSwitch(Constants.VIDEO, '', '', ''); }); -}); \ No newline at end of file +}); diff --git a/test/unit/streaming.protection.controllers.ProtectionController.js b/test/unit/streaming.protection.controllers.ProtectionController.js index 6291df8736..512b78bce5 100644 --- a/test/unit/streaming.protection.controllers.ProtectionController.js +++ b/test/unit/streaming.protection.controllers.ProtectionController.js @@ -62,8 +62,8 @@ describe('ProtectionController', function () { it('should return empty array when getKeySystems is called and config object has not been set properly', function () { const keySystemsArray = protectionController.getKeySystems(); - expect(keySystemsArray).to.be.instanceOf(Array); // jshint ignore:line - expect(keySystemsArray).to.be.empty; // jshint ignore:line + expect(keySystemsArray).to.be.instanceOf(Array); + expect(keySystemsArray).to.be.empty; }); }); @@ -88,8 +88,8 @@ describe('ProtectionController', function () { let onDRMError = function (data) { eventBus.off(ProtectionEvents.SERVER_CERTIFICATE_UPDATED, onDRMError); - expect(data.error.code).to.be.equal(ProtectionErrors.SERVER_CERTIFICATE_UPDATED_ERROR_CODE); // jshint ignore:line - expect(data.error.message).to.be.equal(ProtectionErrors.SERVER_CERTIFICATE_UPDATED_ERROR_MESSAGE); // jshint ignore:line + expect(data.error.code).to.be.equal(ProtectionErrors.SERVER_CERTIFICATE_UPDATED_ERROR_CODE); + expect(data.error.message).to.be.equal(ProtectionErrors.SERVER_CERTIFICATE_UPDATED_ERROR_MESSAGE); done(); }; @@ -101,8 +101,8 @@ describe('ProtectionController', function () { it('onKeyMessage behavior', function (done) { let onDRMError = function (data) { eventBus.off(ProtectionEvents.LICENSE_REQUEST_COMPLETE, onDRMError); - expect(data.error.code).to.be.equal(ProtectionErrors.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_CODE); // jshint ignore:line - expect(data.error.message).to.be.equal(ProtectionErrors.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_MESSAGE); // jshint ignore:line + expect(data.error.code).to.be.equal(ProtectionErrors.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_CODE); + expect(data.error.message).to.be.equal(ProtectionErrors.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_MESSAGE); done(); }; @@ -116,7 +116,7 @@ describe('ProtectionController', function () { it('should trigger KEY_SESSION_CREATED event with an error when createKeySession is called without parameter', function (done) { let onSessionCreated = function (data) { eventBus.off(ProtectionEvents.KEY_SESSION_CREATED, onSessionCreated); - expect(data.error.code).to.be.equal(ProtectionErrors.KEY_SESSION_CREATED_ERROR_CODE); // jshint ignore:line + expect(data.error.code).to.be.equal(ProtectionErrors.KEY_SESSION_CREATED_ERROR_CODE); done(); }; @@ -127,8 +127,8 @@ describe('ProtectionController', function () { it('should return the mocked array of ProtectionKeyControllerMock when getSupportedKeySystemsFromContentProtection is called', function () { const keySystems = protectionController.getSupportedKeySystemsFromContentProtection(); - expect(keySystems).to.be.instanceOf(Array); // jshint ignore:line - expect(keySystems).not.to.be.empty; // jshint ignore:line + expect(keySystems).to.be.instanceOf(Array); + expect(keySystems).not.to.be.empty; }); }); diff --git a/test/unit/streaming.protection.drm.KeySystemPlayReady.js b/test/unit/streaming.protection.drm.KeySystemPlayReady.js index 3567e11875..5ec0049ac1 100644 --- a/test/unit/streaming.protection.drm.KeySystemPlayReady.js +++ b/test/unit/streaming.protection.drm.KeySystemPlayReady.js @@ -7,13 +7,12 @@ const expect = require('chai').expect; describe('KeySystemPlayready', function () { - let context = {}; + let context = {}; let settings = Settings(context).getInstance(); let keySystem; let cdmData = null; - const protData = { cdmData: '2lfuDn3JoEo0dM324cA5tSv1gNNw65mgysBqNJqtxGUk7ShUOE03N6LK0cryu2roCQtDghmF7cC6xyt1WTA86CmrUNFRjo1tcxQtTVEW9Xw68pH7/yU2GbtK4zbctx49sffi4fYy8fGEUB5079CesBONxoKli5j2ADM8CWz93a5mYegZWraOq3EH0nvwvRXZ' }; @@ -31,7 +30,7 @@ describe('KeySystemPlayready', function () { }); it('should exist', () => { - expect(KeySystemPlayReady).to.exist; // jshint ignore:line + expect(KeySystemPlayReady).to.exist; }); it('should throw an exception when getting an instance while the config attribute has not been set properly', function () { @@ -49,7 +48,7 @@ describe('KeySystemPlayready', function () { describe('Well initialized', () => { beforeEach(function () { - keySystem = KeySystemPlayReady(context).getInstance({BASE64: BASE64, settings: settings}); + keySystem = KeySystemPlayReady(context).getInstance({ BASE64: BASE64, settings: settings }); }); afterEach(function () { @@ -68,22 +67,22 @@ describe('KeySystemPlayready', function () { it('should return null when getCDMData is called and protData is undefined', function () { const cdmData = keySystem.getCDMData(); - expect(cdmData).to.be.null; // jshint ignore:line + expect(cdmData).to.be.null; }); it('should return null when getInitData is called without parameter', function () { const initData = keySystem.getInitData(); - expect(initData).to.be.null; // jshint ignore:line + expect(initData).to.be.null; }); it('should return null when getLicenseServerURLFromInitData is called without parameter', function () { const licenseServerUrl = keySystem.getLicenseServerURLFromInitData(); - expect(licenseServerUrl).to.be.null; // jshint ignore:line + expect(licenseServerUrl).to.be.null; }); it('should return null when getLicenseRequestFromMessage is called without parameter', function () { const licenseRequest = keySystem.getLicenseRequestFromMessage(); - expect(licenseRequest).to.be.undefined; // jshint ignore:line + expect(licenseRequest).to.be.undefined; }); it('should return at least Content-Type header when getRequestHeadersFromMessage is called without parameter', function () { @@ -93,8 +92,8 @@ describe('KeySystemPlayready', function () { it('should return the correct cdmData', function () { cdmData = keySystem.getCDMData(protData.cdmData); - expect(keySystem).to.be.defined; // jshint ignore:line - expect(cdmData).to.be.not.null; // jshint ignore:line + expect(keySystem).to.be.defined; + expect(cdmData).to.be.not.null; expect(cdmData).to.be.instanceOf(ArrayBuffer); var cdmDataString = String.fromCharCode.apply(null, new Uint16Array(cdmData)); expect(cdmDataString).to.equal(expectedCDMData); diff --git a/test/unit/streaming.rules.abr.ABRRulesCollection.js b/test/unit/streaming.rules.abr.ABRRulesCollection.js index 3615110753..5b7ca43c38 100644 --- a/test/unit/streaming.rules.abr.ABRRulesCollection.js +++ b/test/unit/streaming.rules.abr.ABRRulesCollection.js @@ -39,7 +39,7 @@ describe('ABRRulesCollection', function () { }); abrRulesCollection.initialize(); const qualitySwitchRules = abrRulesCollection.getQualitySwitchRules(); - expect(qualitySwitchRules).to.have.lengthOf(1); // jshint ignore:line + expect(qualitySwitchRules).to.have.lengthOf(1); }); @@ -52,7 +52,7 @@ describe('ABRRulesCollection', function () { }); abrRulesCollection.initialize(); const qualitySwitchRules = abrRulesCollection.getQualitySwitchRules(); - expect(qualitySwitchRules.length).to.be.above(1); // jshint ignore:line + expect(qualitySwitchRules.length).to.be.above(1); }); @@ -78,13 +78,13 @@ describe('ABRRulesCollection', function () { it('should return an empty SwitchRequest when getMaxQuality function is called and rulesContext is undefined', function () { const maxQuality = abrRulesCollection.getMaxQuality(); - expect(maxQuality.quality).to.be.equal(SwitchRequest.NO_CHANGE); // jshint ignore:line + expect(maxQuality.quality).to.be.equal(SwitchRequest.NO_CHANGE); }); it('should return an empty SwitchRequest when shouldAbandonFragment function is called and rulesContext is undefined', function () { const shouldAbandonFragment = abrRulesCollection.shouldAbandonFragment(); - expect(shouldAbandonFragment.quality).to.be.equal(SwitchRequest.NO_CHANGE); // jshint ignore:line + expect(shouldAbandonFragment.quality).to.be.equal(SwitchRequest.NO_CHANGE); }); it('should return correct switch request in getMinSwitchRequest for a single item', () => { @@ -211,7 +211,7 @@ describe('ABRRulesCollection', function () { const sr = abrRulesCollection.getMinSwitchRequest(srArray); expect(sr.quality).to.be.equal(5); - expect(sr.reason).to.be.null; // jshint ignore:line + expect(sr.reason).to.be.null; }); }); diff --git a/test/unit/streaming.rules.abr.AbandonRequestsRule.js b/test/unit/streaming.rules.abr.AbandonRequestsRule.js index ee4154e25b..9cab02a002 100644 --- a/test/unit/streaming.rules.abr.AbandonRequestsRule.js +++ b/test/unit/streaming.rules.abr.AbandonRequestsRule.js @@ -16,7 +16,7 @@ describe('AbandonRequestsRule', function () { const abandonRequestsRule = AbandonRequestsRule(context).create({}); const abandonRequest = abandonRequestsRule.shouldAbandon(); - expect(abandonRequest.quality).to.be.equal(SwitchRequest.NO_CHANGE); // jshint ignore:line + expect(abandonRequest.quality).to.be.equal(SwitchRequest.NO_CHANGE); }); it('should return an empty switchRequest when shouldAbandon function is called with a mock parameter', function () { @@ -32,6 +32,6 @@ describe('AbandonRequestsRule', function () { const abandonRequest = abandonRequestsRule.shouldAbandon(rulesContextMock); - expect(abandonRequest.quality).to.be.equal(SwitchRequest.NO_CHANGE); // jshint ignore:line + expect(abandonRequest.quality).to.be.equal(SwitchRequest.NO_CHANGE); }); -}); \ No newline at end of file +}); diff --git a/test/unit/streaming.rules.abr.BolaRule.js b/test/unit/streaming.rules.abr.BolaRule.js index bb910a5118..275e9f89e2 100644 --- a/test/unit/streaming.rules.abr.BolaRule.js +++ b/test/unit/streaming.rules.abr.BolaRule.js @@ -13,18 +13,18 @@ describe('BolaRule', function () { it('should return an empty switchRequest when getMaxIndex function is called with an empty parameter', function () { const maxIndexRequest = bolaRule.getMaxIndex(); - expect(maxIndexRequest.quality).to.be.equal(SwitchRequest.NO_CHANGE); // jshint ignore:line + expect(maxIndexRequest.quality).to.be.equal(SwitchRequest.NO_CHANGE); }); it('should return an empty switchRequest when getMaxIndex function is called with an malformed parameter', function () { const maxIndexRequest = bolaRule.getMaxIndex({}); - expect(maxIndexRequest.quality).to.be.equal(SwitchRequest.NO_CHANGE); // jshint ignore:line + expect(maxIndexRequest.quality).to.be.equal(SwitchRequest.NO_CHANGE); }); it('should return an empty switchRequest when getMaxIndex function is called with an well formed parameter', function () { const maxIndexRequest = bolaRule.getMaxIndex(rulesContextMock); - expect(maxIndexRequest.quality).to.be.equal(SwitchRequest.NO_CHANGE); // jshint ignore:line + expect(maxIndexRequest.quality).to.be.equal(SwitchRequest.NO_CHANGE); }); }); diff --git a/test/unit/streaming.rules.abr.DroppedFramesRule.js b/test/unit/streaming.rules.abr.DroppedFramesRule.js index 96e66197e1..8aa1095633 100644 --- a/test/unit/streaming.rules.abr.DroppedFramesRule.js +++ b/test/unit/streaming.rules.abr.DroppedFramesRule.js @@ -13,18 +13,18 @@ describe('DroppedFramesRule', function () { it('should return an empty switchRequest when getMaxIndex function is called with an empty parameter', function () { const maxIndexRequest = droppedFramesRule.getMaxIndex(); - expect(maxIndexRequest.quality).to.be.equal(SwitchRequest.NO_CHANGE); // jshint ignore:line + expect(maxIndexRequest.quality).to.be.equal(SwitchRequest.NO_CHANGE); }); it('should return an empty switchRequest when getMaxIndex function is called with an malformed parameter', function () { const maxIndexRequest = droppedFramesRule.getMaxIndex({}); - expect(maxIndexRequest.quality).to.be.equal(SwitchRequest.NO_CHANGE); // jshint ignore:line + expect(maxIndexRequest.quality).to.be.equal(SwitchRequest.NO_CHANGE); }); it('should return an empty switchRequest when getMaxIndex function is called with an well formed parameter', function () { const maxIndexRequest = droppedFramesRule.getMaxIndex(rulesContextMock); - expect(maxIndexRequest.quality).to.be.equal(SwitchRequest.NO_CHANGE); // jshint ignore:line + expect(maxIndexRequest.quality).to.be.equal(SwitchRequest.NO_CHANGE); }); }); diff --git a/test/unit/streaming.rules.abr.InsufficientBufferRule.js b/test/unit/streaming.rules.abr.InsufficientBufferRule.js index f665f31367..054c54fb9c 100644 --- a/test/unit/streaming.rules.abr.InsufficientBufferRule.js +++ b/test/unit/streaming.rules.abr.InsufficientBufferRule.js @@ -24,13 +24,13 @@ describe('InsufficientBufferRule', function () { it('should return an empty switchRequest when getMaxIndex function is called with an empty parameter', function () { const maxIndexRequest = insufficientBufferRule.getMaxIndex(); - expect(maxIndexRequest.quality).to.be.equal(SwitchRequest.NO_CHANGE); // jshint ignore:line + expect(maxIndexRequest.quality).to.be.equal(SwitchRequest.NO_CHANGE); }); it('should return an empty switchRequest when getMaxIndex function is called with an malformed parameter', function () { const maxIndexRequest = insufficientBufferRule.getMaxIndex({}); - expect(maxIndexRequest.quality).to.be.equal(SwitchRequest.NO_CHANGE); // jshint ignore:line + expect(maxIndexRequest.quality).to.be.equal(SwitchRequest.NO_CHANGE); }); it('should throw an exception when attempting to call getMaxIndex While the config attribute has not been set properly', function () { diff --git a/test/unit/streaming.rules.abr.SwitchHistoryRule.js b/test/unit/streaming.rules.abr.SwitchHistoryRule.js index 02745ee630..bc627a541d 100644 --- a/test/unit/streaming.rules.abr.SwitchHistoryRule.js +++ b/test/unit/streaming.rules.abr.SwitchHistoryRule.js @@ -11,13 +11,13 @@ describe('SwitchHistoryRule', function () { it('should return an empty switchRequest when getMaxIndex function is called with an empty parameter', function () { const switchRequest = switchHistoryRule.getMaxIndex(); - expect(switchRequest.quality).to.be.equal(SwitchRequest.NO_CHANGE); // jshint ignore:line + expect(switchRequest.quality).to.be.equal(SwitchRequest.NO_CHANGE); }); it('should return an switchRequest with quality equals 0 when one switchRequest equals to {drops: 7, noDrops: 0, dropSize: 4}, a division by zero occurs', function () { let rulesContextMock = new RulesContextMock(); const switchRequest = switchHistoryRule.getMaxIndex(rulesContextMock); - expect(switchRequest.quality).to.be.equal(0); // jshint ignore:line + expect(switchRequest.quality).to.be.equal(0); }); -}); \ No newline at end of file +}); diff --git a/test/unit/streaming.rules.abr.ThroughputRule.js b/test/unit/streaming.rules.abr.ThroughputRule.js index 2ade31d861..d0d64795e9 100644 --- a/test/unit/streaming.rules.abr.ThroughputRule.js +++ b/test/unit/streaming.rules.abr.ThroughputRule.js @@ -14,13 +14,13 @@ describe('ThroughputRule', function () { it('should return an empty switchRequest when getMaxIndex function is called with an empty parameter', function () { const maxIndexRequest = throughputRule.getMaxIndex(); - expect(maxIndexRequest.quality).to.be.equal(SwitchRequest.NO_CHANGE); // jshint ignore:line + expect(maxIndexRequest.quality).to.be.equal(SwitchRequest.NO_CHANGE); }); it('should return an empty switchRequest when getMaxIndex function is called with an malformed parameter', function () { const maxIndexRequest = throughputRule.getMaxIndex({}); - expect(maxIndexRequest.quality).to.be.equal(SwitchRequest.NO_CHANGE); // jshint ignore:line + expect(maxIndexRequest.quality).to.be.equal(SwitchRequest.NO_CHANGE); }); it('should throw an exception when attempting to call getMaxIndex While the config attribute has not been set properly', function () { diff --git a/test/unit/streaming.utils.BoxParser.js b/test/unit/streaming.utils.BoxParser.js index a16f141282..f04710f938 100644 --- a/test/unit/streaming.utils.BoxParser.js +++ b/test/unit/streaming.utils.BoxParser.js @@ -62,34 +62,34 @@ describe('BoxParser', function () { it('should return false when data is null or not defined', () => { const res = boxParser.findLastTopIsoBoxCompleted(['ftyp'], null); - expect(res.found).to.be.false; // jshint ignore:line + expect(res.found).to.be.false; }); it('should return false when data is empty', () => { const data = new ArrayBuffer(); const res = boxParser.findLastTopIsoBoxCompleted(['ftyp'], data); - expect(res.found).to.be.false; // jshint ignore:line + expect(res.found).to.be.false; }); it('should return false when data length is lower than offset', () => { const data = new ArrayBuffer(5); const res = boxParser.findLastTopIsoBoxCompleted(['ftyp'], data, 10); - expect(res.found).to.be.false; // jshint ignore:line + expect(res.found).to.be.false; }); it('should return false when data to read is lower than 8', () => { const data = new ArrayBuffer(16); const res = boxParser.findLastTopIsoBoxCompleted(['ftyp'], data, 12); - expect(res.found).to.be.false; // jshint ignore:line + expect(res.found).to.be.false; }); it('should return null when data is empty', () => { const res = boxParser.findInitRange(); - expect(res).to.be.null; // jshint ignore:line + expect(res).to.be.null; }); }); @@ -98,45 +98,45 @@ describe('BoxParser', function () { const data = new Uint8Array(ftypCompleted); const res = boxParser.findLastTopIsoBoxCompleted(['ftyp'], data.buffer); - expect(res.found).to.be.true; // jshint ignore:line + expect(res.found).to.be.true; }); it('should return false when looking for a box that is not completed', () => { const data = new Uint8Array(ftypIncompleted); const res = boxParser.findLastTopIsoBoxCompleted(['ftyp'], data.buffer); - expect(res.found).to.be.false; // jshint ignore:line + expect(res.found).to.be.false; }); it('should return true when looking for completed boxes in a buffer with multiple top boxes', () => { const data = new Uint8Array(initSegmentCompleted); let res = boxParser.findLastTopIsoBoxCompleted(['ftyp'], data.buffer); - expect(res.found).to.be.true; // jshint ignore:line + expect(res.found).to.be.true; res = boxParser.findLastTopIsoBoxCompleted(['moov'], data.buffer); - expect(res.found).to.be.true; // jshint ignore:line + expect(res.found).to.be.true; }); it('should return true when looking for completed boxes and using offset values', () => { const data = new Uint8Array(initSegmentCompleted); const res = boxParser.findLastTopIsoBoxCompleted(['ftyp', 'moov'], data.buffer, 132); - expect(res.found).to.be.true; // jshint ignore:line + expect(res.found).to.be.true; }); it('should return offset of the last completed box when the specified box type is not found', () => { const data = new Uint8Array(initSegmentIncompleted); const res = boxParser.findLastTopIsoBoxCompleted(['moov'], data.buffer); - expect(res.found).to.be.false; // jshint ignore:line - expect(res.lastCompletedOffset).to.equal(36); // jshint ignore:line + expect(res.found).to.be.false; + expect(res.lastCompletedOffset).to.equal(36); }); it('should not return null when looking for init range in a completed init segment', () => { const data = new Uint8Array(initSegmentCompleted); let res = boxParser.findInitRange(data.buffer); - expect(res).not.to.be.null; // jshint ignore:line - expect(res).to.equal('0-944'); // jshint ignore:line + expect(res).not.to.be.null; + expect(res).to.equal('0-944'); }); }); @@ -144,14 +144,14 @@ describe('BoxParser', function () { it('should return an object with an empty array called samplesInfo.sampleList when getSamplesInfo is called and sample is undefined', () => { const samplesInfo = boxParser.getSamplesInfo(); - expect(samplesInfo.sampleList).to.be.instanceOf(Array); // jshint ignore:line - expect(samplesInfo.sampleList).to.be.empty; // jshint ignore:line + expect(samplesInfo.sampleList).to.be.instanceOf(Array); + expect(samplesInfo.sampleList).to.be.empty; }); it('should return NaN when getMediaTimescaleFromMoov is called and sample is undefined', () => { const timeScale = boxParser.getMediaTimescaleFromMoov(); - expect(timeScale).to.be.NaN; // jshint ignore:line + expect(timeScale).to.be.NaN; }); }); -}); \ No newline at end of file +}); diff --git a/test/unit/streaming.utils.CustomTimeRanges.js b/test/unit/streaming.utils.CustomTimeRanges.js index d1ffd03197..b789fe49f1 100644 --- a/test/unit/streaming.utils.CustomTimeRanges.js +++ b/test/unit/streaming.utils.CustomTimeRanges.js @@ -10,8 +10,8 @@ describe('CustomTimeRanges', function () { it('should return an empty array called customTimeRangeArray when CustomTimeRanges instance is created', function () { const customTimeRangeArray = customTimeRanges.customTimeRangeArray; - expect(customTimeRangeArray).to.be.instanceOf(Array); // jshint ignore:line - expect(customTimeRangeArray).to.be.empty; // jshint ignore:line + expect(customTimeRangeArray).to.be.instanceOf(Array); + expect(customTimeRangeArray).to.be.empty; }); it('should throw an exception when attempting to call start with a parameter which is not an integer', function () { @@ -25,13 +25,13 @@ describe('CustomTimeRanges', function () { it('should return NaN when start function is called with an index bigger than customTimeRangeArray.length', function () { const start = customTimeRanges.start(2); - expect(start).to.be.NaN; // jshint ignore:line + expect(start).to.be.NaN; }); it('should return NaN when end function is called with an index bigger than customTimeRangeArray.length', function () { const end = customTimeRanges.end(2); - expect(end).to.be.NaN; // jshint ignore:line + expect(end).to.be.NaN; }); it('should return the correct start and end value', function () { @@ -40,10 +40,10 @@ describe('CustomTimeRanges', function () { const end = customTimeRanges.end(0); const start = customTimeRanges.start(0); - expect(start).to.equal(2); // jshint ignore:line - expect(end).to.equal(4); // jshint ignore:line + expect(start).to.equal(2); + expect(end).to.equal(4); customTimeRanges.clear(); - expect(customTimeRanges.length).to.equal(0); // jshint ignore:line + expect(customTimeRanges.length).to.equal(0); }); -}); \ No newline at end of file +}); diff --git a/test/unit/streaming.utils.DVBSelector.js b/test/unit/streaming.utils.DVBSelector.js index 1964236c9a..5480150148 100644 --- a/test/unit/streaming.utils.DVBSelector.js +++ b/test/unit/streaming.utils.DVBSelector.js @@ -24,14 +24,14 @@ describe('BaseURLResolution/DVBSelector', function () { const dvbSelector = DVBSelector(context).create(defaultConfig); const selected = dvbSelector.select(undefined); - expect(selected).to.be.undefined; // jshint ignore:line + expect(selected).to.be.undefined; }); it('should return undefined when the input is empty', () => { const dvbSelector = DVBSelector(context).create(defaultConfig); const selected = dvbSelector.select([]); - expect(selected).to.be.undefined; // jshint ignore:line + expect(selected).to.be.undefined; }); it('should return undefined when the blacklist contains the requested serviceLocation', () => { @@ -46,7 +46,7 @@ describe('BaseURLResolution/DVBSelector', function () { const selected = dvbSelector.select([entryA]); - expect(selected).to.be.undefined; // jshint ignore:line + expect(selected).to.be.undefined; }); it('should return the first entry in the list when the blacklist does not contain the requested serviceLocation', () => { @@ -65,7 +65,7 @@ describe('BaseURLResolution/DVBSelector', function () { entryB ]); - expect(selected).to.equal(entryA); // jshint ignore:line + expect(selected).to.equal(entryA); }); it('should return the next entry in the list when the blacklist contains the serviceLocation of the first', () => { @@ -83,7 +83,7 @@ describe('BaseURLResolution/DVBSelector', function () { entryB ]); - expect(selected).to.equal(entryB); // jshint ignore:line + expect(selected).to.equal(entryB); }); it('should return undefined when the blacklist contains all the serviceLocations', () => { @@ -101,18 +101,18 @@ describe('BaseURLResolution/DVBSelector', function () { entryB ]); - expect(selected).to.be.undefined; // jshint ignore:line + expect(selected).to.be.undefined; }); it('should select baseUrls as defined in the example in DVB A168 10.8.2.4', () => { const baseUrls = [ - { dvb_priority: 1, dvb_weight: 10, serviceLocation: 'A' }, - { dvb_priority: 1, dvb_weight: 30, serviceLocation: 'B' }, - { dvb_priority: 1, dvb_weight: 60, serviceLocation: 'C' }, - { dvb_priority: 3, dvb_weight: 1, serviceLocation: 'C' }, - { dvb_priority: 4, dvb_weight: 1, serviceLocation: 'B' }, - { dvb_priority: 5, dvb_weight: 1, serviceLocation: 'D' }, - { dvb_priority: 5, dvb_weight: 1, serviceLocation: 'E' } + { dvb_priority: 1, dvb_weight: 10, serviceLocation: 'A' }, + { dvb_priority: 1, dvb_weight: 30, serviceLocation: 'B' }, + { dvb_priority: 1, dvb_weight: 60, serviceLocation: 'C' }, + { dvb_priority: 3, dvb_weight: 1, serviceLocation: 'C' }, + { dvb_priority: 4, dvb_weight: 1, serviceLocation: 'B' }, + { dvb_priority: 5, dvb_weight: 1, serviceLocation: 'D' }, + { dvb_priority: 5, dvb_weight: 1, serviceLocation: 'E' } ]; // we need Math.random to be completely unrandom @@ -133,14 +133,14 @@ describe('BaseURLResolution/DVBSelector', function () { stub.returns(0.3); const firstSelection = dvbSelector.select(baseUrls); - expect(firstSelection.dvb_priority).to.equal(1); // jshint ignore:line - expect(firstSelection.serviceLocation).to.equal('B'); // jshint ignore:line + expect(firstSelection.dvb_priority).to.equal(1); + expect(firstSelection.serviceLocation).to.equal('B'); blacklist.push(firstSelection.serviceLocation); const secondSelection = dvbSelector.select(baseUrls); - expect(secondSelection.dvb_priority).to.equal(3); // jshint ignore:line - expect(secondSelection.serviceLocation).to.equal('C'); // jshint ignore:line + expect(secondSelection.dvb_priority).to.equal(3); + expect(secondSelection.serviceLocation).to.equal('C'); // Math.random (called in select()) will return 1 stub.returns(1); @@ -148,25 +148,25 @@ describe('BaseURLResolution/DVBSelector', function () { blacklist.push(secondSelection.serviceLocation); const thirdSelection = dvbSelector.select(baseUrls); - expect(thirdSelection.dvb_priority).to.equal(5); // jshint ignore:line - expect(thirdSelection.serviceLocation).to.equal('E'); // jshint ignore:line + expect(thirdSelection.dvb_priority).to.equal(5); + expect(thirdSelection.serviceLocation).to.equal('E'); blacklist.push(thirdSelection.serviceLocation); const fourthSelection = dvbSelector.select(baseUrls); - expect(fourthSelection).to.be.undefined; // jshint ignore:line + expect(fourthSelection).to.be.undefined; }); it('should not select baseUrls with invalid priority when there is another option', () => { const baseUrls = [ - { serviceLocation: 'A', dvb_priority: 1, dvb_weight: 1 }, + { serviceLocation: 'A', dvb_priority: 1, dvb_weight: 1 }, { serviceLocation: 'B', dvb_priority: 'STRING', dvb_weight: 100000000 } ]; const dvbSelector = DVBSelector(context).create(defaultConfig); const firstSelection = dvbSelector.select(baseUrls); - expect(firstSelection.serviceLocation).to.equal('A'); // jshint ignore:line + expect(firstSelection.serviceLocation).to.equal('A'); }); it('should select baseUrls with invalid priority if there is no other option', () => { @@ -177,6 +177,6 @@ describe('BaseURLResolution/DVBSelector', function () { const dvbSelector = DVBSelector(context).create(defaultConfig); const firstSelection = dvbSelector.select(baseUrls); - expect(firstSelection.serviceLocation).to.equal('B'); // jshint ignore:line + expect(firstSelection.serviceLocation).to.equal('B'); }); }); diff --git a/test/unit/streaming.utils.InitCache.js b/test/unit/streaming.utils.InitCache.js index 46978b26ec..d43b7d2f16 100644 --- a/test/unit/streaming.utils.InitCache.js +++ b/test/unit/streaming.utils.InitCache.js @@ -11,21 +11,21 @@ describe('InitCache', function () { it('should return null when extract is called and parameters are undefined', () => { const extractResult = initCache.extract(); - expect(extractResult).to.be.null; // jshint ignore:line + expect(extractResult).to.be.null; }); it('should return null when extract is called and streamId is undefined', () => { const representationId = 'video_880k'; const extractResult = initCache.extract(null, representationId); - expect(extractResult).to.be.null; // jshint ignore:line + expect(extractResult).to.be.null; }); it('should return null when extract is called and representationId is undefined', () => { const streamId = 'defauldId'; const extractResult = initCache.extract(streamId); - expect(extractResult).to.be.null; // jshint ignore:line + expect(extractResult).to.be.null; }); it('should return when extract is called and representationId is undefined', () => { @@ -36,15 +36,15 @@ describe('InitCache', function () { let extractResult = initCache.extract(streamId); - expect(extractResult).to.be.null; // jshint ignore:line + expect(extractResult).to.be.null; extractResult = initCache.extract(null, representationId); - expect(extractResult).to.be.null; // jshint ignore:line + expect(extractResult).to.be.null; extractResult = initCache.extract(streamId, representationId); - expect(extractResult.dataTest).to.be.equal('videoSegment'); // jshint ignore:line + expect(extractResult.dataTest).to.be.equal('videoSegment'); }); }); -}); \ No newline at end of file +}); diff --git a/test/unit/streaming.utils.IsoFile.js b/test/unit/streaming.utils.IsoFile.js index 5b631b6b8f..1e09ab57be 100644 --- a/test/unit/streaming.utils.IsoFile.js +++ b/test/unit/streaming.utils.IsoFile.js @@ -12,26 +12,26 @@ describe('IsoFile', function () { it('should return null when getBoxes is called and no parsed file has been set', () => { const boxes = isoFile.getBoxes('test'); - expect(boxes).to.be.instanceOf(Array); // jshint ignore:line - expect(boxes).to.be.empty; // jshint ignore:line + expect(boxes).to.be.instanceOf(Array); + expect(boxes).to.be.empty; }); it('should return null when getBox is called and no parsed file has been set', () => { const box = isoFile.getBox('test'); - expect(box).to.be.null; // jshint ignore:line + expect(box).to.be.null; }); it('should return null when getLastBox is called and no parsed file has been set', () => { const lastBox = isoFile.getLastBox(); - expect(lastBox).to.be.null; // jshint ignore:line + expect(lastBox).to.be.null; }); it('should return null when getBox is called and type is undefined', () => { const box = isoFile.getBox(); - expect(box).to.be.null; // jshint ignore:line + expect(box).to.be.null; }); }); describe('when incorrect parsed file has been set', () => { @@ -41,14 +41,14 @@ describe('IsoFile', function () { const boxes = isoFile.getBoxes(); expect(boxes).to.be.instanceOf(Array); - expect(boxes).to.be.empty; // jshint ignore:line + expect(boxes).to.be.empty; }); it('should return null when getLastBox is called', () => { isoFile.setData({boxes: [{type: 'typeA'}, {type: 'typeB'}]}); const box = isoFile.getLastBox(); - expect(box).to.be.null; // jshint ignore:line + expect(box).to.be.null; }); it('should return an empty array when getBoxes is called', () => { @@ -57,28 +57,28 @@ describe('IsoFile', function () { const boxes = isoFile.getBoxes('typeA'); expect(boxes).to.be.instanceOf(Array); - expect(boxes).to.be.empty; // jshint ignore:line + expect(boxes).to.be.empty; }); it('should return null when getBox is called and parsedFile has no boxes attribute', () => { isoFile.setData({}); const box = isoFile.getBox('typeA'); - expect(box).to.be.null; // jshint ignore:line + expect(box).to.be.null; }); it('should return null when getBox is called and parsedFile has an empty boxes array attribute', () => { isoFile.setData({boxes: []}); const box = isoFile.getBox('typeA'); - expect(box).to.be.null; // jshint ignore:line + expect(box).to.be.null; }); it('should return null when getBox is called and parsedFile is incorrect', () => { isoFile.setData({boxes: [{type: 'typeA'}, {type: 'typeB'}]}); const box = isoFile.getBox('typeA'); - expect(box).to.be.null; // jshint ignore:line + expect(box).to.be.null; }); }); @@ -92,20 +92,20 @@ describe('IsoFile', function () { it('should return null when getBox is called and type is not present in boxes array', () => { const box = isoFile.getBox('emsg'); - expect(box).to.be.null; // jshint ignore:line + expect(box).to.be.null; }); it('should return the good box when getBox is called and type is present in boxes array', () => { const box = isoFile.getBox('mfhd'); - expect(box).not.to.be.null; // jshint ignore:line + expect(box).not.to.be.null; expect(box.type).to.equal('mfhd'); }); it('should return the good box when getLastBox is called', () => { const box = isoFile.getLastBox(); - expect(box).not.to.be.null; // jshint ignore:line + expect(box).not.to.be.null; expect(box.type).to.equal('mdat'); }); }); diff --git a/test/unit/streaming.utils.VTTParser.js b/test/unit/streaming.utils.VTTParser.js index 175f7e64d2..752cdb9ebf 100644 --- a/test/unit/streaming.utils.VTTParser.js +++ b/test/unit/streaming.utils.VTTParser.js @@ -10,15 +10,15 @@ describe('VTTParser', function () { it('should return an empty array when parse is called and data is not defined', function () { const vttSubtitlesArray = vttParser.parse(); - expect(vttSubtitlesArray).to.be.instanceOf(Array); // jshint ignore:line - expect(vttSubtitlesArray).to.be.empty; // jshint ignore:line + expect(vttSubtitlesArray).to.be.instanceOf(Array); + expect(vttSubtitlesArray).to.be.empty; }); it('should return an array with a size of 8 when parse is called and data is vttSample', async () => { let vtt_file = await FileLoader.loadTextFile('/data/subtitles/vttSample.vtt'); const vttSubtitlesArray = vttParser.parse(vtt_file); - expect(vttSubtitlesArray).to.be.instanceOf(Array); // jshint ignore:line + expect(vttSubtitlesArray).to.be.instanceOf(Array); expect(vttSubtitlesArray.length).to.be.equal(8); }); });