-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'sschr/20240416_DescriptorType_BugFix' into 'dolby/descr…
…iptorType_bugfix' bugFix resolving type mismatch w.r.t DescriptorType See merge request standards2/dlb_dash.js!11
- Loading branch information
Showing
2 changed files
with
122 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,135 @@ | ||
import DescriptorType from '../../../../src/dash/vo/DescriptorType.js'; | ||
|
||
import {expect} from 'chai'; | ||
import { expect } from 'chai'; | ||
|
||
describe('DescriptorType', () => { | ||
|
||
it('should be constructed with null values', () => { | ||
const dt = new DescriptorType(); | ||
expect(dt).to.deep.equal({ | ||
schemeIdUri: null, | ||
value: null, | ||
id: null | ||
describe('Initialization', () => { | ||
it('should be constructed with null values', () => { | ||
const dt = new DescriptorType(); | ||
expect(dt).to.deep.equal({ | ||
schemeIdUri: null, | ||
value: null, | ||
id: null | ||
}); | ||
}); | ||
}); | ||
|
||
it('should initialise with correct base values', () => { | ||
const dt = new DescriptorType(); | ||
dt.init({ | ||
schemeIdUri: 'testScheme', | ||
value: '1', | ||
it('should initialise with correct base values', () => { | ||
const dt = new DescriptorType(); | ||
dt.init({ | ||
schemeIdUri: 'testScheme', | ||
value: '1', | ||
}); | ||
expect(dt).to.deep.equal({ | ||
schemeIdUri: 'testScheme', | ||
value: '1', | ||
id: null | ||
}); | ||
}); | ||
expect(dt).to.deep.equal({ | ||
schemeIdUri: 'testScheme', | ||
value: '1', | ||
id: null | ||
|
||
it('should initialise with correct base values and type conversion', () => { | ||
const dt = new DescriptorType(); | ||
dt.init({ | ||
schemeIdUri: 'testScheme', | ||
value: 1, | ||
}); | ||
expect(dt).to.deep.equal({ | ||
schemeIdUri: 'testScheme', | ||
value: '1', | ||
id: null | ||
}); | ||
}); | ||
|
||
it('should initialise with known dvb extensions if present', () => { | ||
const dt = new DescriptorType(); | ||
dt.init({ | ||
schemeIdUri: 'testScheme', | ||
value: '1', | ||
'dvb:url': 'testUrl' | ||
}); | ||
expect(dt).to.deep.equal({ | ||
schemeIdUri: 'testScheme', | ||
value: '1', | ||
id: null, | ||
dvbUrl: 'testUrl' | ||
}); | ||
}); | ||
}); | ||
|
||
it('should initialise with known dvb extensions if present', () => { | ||
const dt = new DescriptorType(); | ||
dt.init({ | ||
schemeIdUri: 'testScheme', | ||
value: '1', | ||
'dvb:url': 'testUrl' | ||
describe('inArray', () => { | ||
it('should return false array is empty', () => { | ||
const dt = new DescriptorType(); | ||
dt.init({ | ||
schemeIdUri: 'testScheme', | ||
value: 10 | ||
}); | ||
const testArray = []; | ||
|
||
let ret = dt.inArray(testArray); | ||
expect(ret).to.be.false; | ||
}); | ||
expect(dt).to.deep.equal({ | ||
schemeIdUri: 'testScheme', | ||
value: '1', | ||
id: null, | ||
dvbUrl: 'testUrl' | ||
|
||
it('should find a descriptor if only the schemeIdUri is provided', () => { | ||
const dt = new DescriptorType(); | ||
dt.init({ | ||
schemeIdUri: 'testScheme', | ||
value: 10 | ||
}); | ||
const testArray = [ | ||
{ schemeIdUri: 'notSupportedTestScheme' }, | ||
{ schemeIdUri: 'testScheme' }, | ||
{ schemeIdUri: 'notSupported' } | ||
]; | ||
|
||
let ret = dt.inArray(testArray); | ||
expect(ret).to.be.true; | ||
}); | ||
}); | ||
|
||
it('should not erroneously match a descriptor if different schemeIdUri are provided', () => { | ||
const dt = new DescriptorType(); | ||
dt.init({ | ||
schemeIdUri: 'testScheme', | ||
value: 10 | ||
}); | ||
const testArray = [ | ||
{ schemeIdUri: 'notSupportedTestScheme' }, | ||
{ schemeIdUri: 'notSupported' } | ||
]; | ||
|
||
let ret = dt.inArray(testArray); | ||
expect(ret).to.be.false; | ||
}); | ||
|
||
it('should find a descriptor if schemeIdUri and value is provided', () => { | ||
const dt = new DescriptorType(); | ||
dt.init({ | ||
schemeIdUri: 'testScheme', | ||
value: 2 | ||
}); | ||
const testArray = [ | ||
{ schemeIdUri: 'notSupportedTestScheme', value: '1' }, | ||
{ schemeIdUri: 'testScheme', value: '2' }, | ||
{ schemeIdUri: 'notSupported', value: '3' } | ||
]; | ||
|
||
let ret = dt.inArray(testArray); | ||
expect(ret).to.be.true; | ||
}); | ||
|
||
it('should not find a descriptor if schemeIdUri is provided and value not matches', () => { | ||
const dt = new DescriptorType(); | ||
dt.init({ | ||
schemeIdUri: 'testScheme', | ||
value: 3 | ||
}); | ||
const testArray = [ | ||
{ schemeIdUri: 'notSupportedTestScheme', value: '1' }, | ||
{ schemeIdUri: 'testScheme', value: '1' }, | ||
{ schemeIdUri: 'notSupported', value: '1' } | ||
]; | ||
|
||
let ret = dt.inArray(testArray); | ||
expect(ret).to.be.false; | ||
}); | ||
}); | ||
}); |