Skip to content

Commit

Permalink
Add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dsilhavy committed Mar 4, 2025
1 parent 43946e3 commit 7d22d40
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/dash/models/DashManifestModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,9 @@ function DashManifestModel() {
return null
}
const frameRate = realRepresentation[DashConstants.FRAMERATE];
if (!frameRate) {
return null
}

if (typeof frameRate === 'string' && frameRate.includes('/')) {
const [numerator, denominator] = frameRate.split('/').map(value => parseInt(value, 10));
Expand Down
7 changes: 6 additions & 1 deletion test/unit/test/dash/dash.models.DashManifestModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -1665,11 +1665,16 @@ describe('DashManifestModel', function () {

describe('getFramerate()', () => {

it('Should be undefined when no Representation is provided', () => {
it('Should be null when no Representation is provided', () => {
const framerate = dashManifestModel.getFramerate();
expect(framerate).to.be.null;
})

it('Should be null when not defined', () => {
const framerate = dashManifestModel.getFramerate({});
expect(framerate).to.be.null;
})

it('Should parse single integer', () => {
const framerate = dashManifestModel.getFramerate({frameRate: '24'});
expect(framerate).to.be.equal(24);
Expand Down

0 comments on commit 7d22d40

Please sign in to comment.