sanity.test.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import document from 'global/document';
  2. import QUnit from 'qunit';
  3. import sinon from 'sinon';
  4. import videojs from 'video.js';
  5. QUnit.module('videojs-contrib-hls - sanity', {
  6. beforeEach() {
  7. this.fixture = document.getElementById('qunit-fixture');
  8. this.video = document.createElement('video');
  9. this.fixture.appendChild(this.video);
  10. this.player = videojs(this.video);
  11. // Mock the environment's timers because certain things - particularly
  12. // player readiness - are asynchronous in video.js 5.
  13. this.clock = sinon.useFakeTimers();
  14. },
  15. afterEach() {
  16. // The clock _must_ be restored before disposing the player; otherwise,
  17. // certain timeout listeners that happen inside video.js may throw errors.
  18. this.clock.restore();
  19. this.player.dispose();
  20. }
  21. });
  22. QUnit.test('the environment is sane', function(assert) {
  23. assert.strictEqual(typeof Array.isArray, 'function', 'es5 exists');
  24. assert.strictEqual(typeof sinon, 'object', 'sinon exists');
  25. assert.strictEqual(typeof videojs, 'function', 'videojs exists');
  26. assert.strictEqual(typeof videojs.MediaSource, 'function', 'MediaSource is an object');
  27. assert.strictEqual(typeof videojs.URL, 'object', 'URL is an object');
  28. assert.strictEqual(typeof videojs.Hls, 'object', 'Hls is an object');
  29. assert.strictEqual(typeof videojs.HlsSourceHandler,
  30. 'function',
  31. 'HlsSourceHandler is a function');
  32. assert.strictEqual(typeof videojs.HlsHandler, 'function', 'HlsHandler is a function');
  33. });