Skip to content

Commit

Permalink
test: add tests for deprecated function
Browse files Browse the repository at this point in the history
The deprecated `.extend` method should not be called when the modules are imported.  The change in the next commit will allow users of the library to upgrade to video.js version 8 where the `.extend` method has been removed.

Issue silvermine#152
  • Loading branch information
Eric Fortmeyer authored and datagutt committed Feb 25, 2023
1 parent 3acc31f commit 9260fce
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/ChromcastButton.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
'use strict';

var expect = require('expect.js');

const chromecastButton = require('../src/js/components/ChromecastButton');

class ButtonComponentStub {}

describe('ChromecastButton', function() {
it('should not call videojs.extend', function() {
const videoJsSpy = {
extend: function() {
expect().fail('videojs.extends is deprecated');
},
getComponent: function() {
return ButtonComponentStub;
},
registerComponent: function(_, component) {
expect(component.prototype instanceof ButtonComponentStub).to.be(true);
},
};

chromecastButton(videoJsSpy);
});
});
26 changes: 26 additions & 0 deletions tests/ChromcastTech.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'use strict';

var expect = require('expect.js');

const chromecastTech = require('../src/js/tech/ChromecastTech');

class TechComponentStub {
}

describe('ChromecastTech', function() {
it('should not call videojs.extend', function() {
const videoJsSpy = {
extend: function() {
expect().fail('videojs.extends is deprecated');
},
getComponent: function() {
return TechComponentStub;
},
registerTech: function(_, component) {
expect(component.prototype instanceof TechComponentStub).to.be(true);
},
};

chromecastTech(videoJsSpy);
});
});

0 comments on commit 9260fce

Please sign in to comment.