Skip to content

Commit

Permalink
updated tests and changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
saravanan committed Nov 27, 2024
1 parent afa6bd9 commit b984963
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
### Fixed
- Mid rolls errorneously reported as post rolls when midroll's schedule time > the duration of the adbreak
- Adhelper testcases to use the source duration instead

### Changed
- Updated Bitmovin Player version to 8.191.0


### Fixed
- Ad-related delays not contributing to rebuffering metrics
- Underreported VST after playing CSAI pre-rolls
Expand Down
24 changes: 10 additions & 14 deletions spec/tests/AdHelper.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,30 @@ import * as Conviva from '@convivainc/conviva-js-coresdk';
describe(AdHelper, () => {
describe('mapAdPosition', () => {
it('should map ad position to preroll', () => {
const player = {
getDuration: () => 100,
} as PlayerAPI;
const duration = 100 as number;
const adBreak = {
scheduleTime: 0
} as AdBreak;

expect(AdHelper.mapCsaiAdPosition(adBreak, player)).toEqual(Conviva.Constants.AdPosition.PREROLL)
expect(AdHelper.mapCsaiAdPosition(adBreak, duration)).toEqual(Conviva.Constants.AdPosition.PREROLL)
})

it('should map ad position to postroll', () => {
const player = {
getDuration: () => 100,
} as PlayerAPI;
const duration = 100 as number;
const adBreak = {
scheduleTime: 100
} as AdBreak;

expect(AdHelper.mapCsaiAdPosition(adBreak, player)).toEqual(Conviva.Constants.AdPosition.POSTROLL)
expect(AdHelper.mapCsaiAdPosition(adBreak, duration)).toEqual(Conviva.Constants.AdPosition.POSTROLL)
})

it('should map ad position to midroll', () => {
const player = {
getDuration: () => 100,
} as PlayerAPI;
const duration = 100 as number;
const adBreak = {
scheduleTime: 50
} as AdBreak;

expect(AdHelper.mapCsaiAdPosition(adBreak, player)).toEqual(Conviva.Constants.AdPosition.MIDROLL)
expect(AdHelper.mapCsaiAdPosition(adBreak, duration)).toEqual(Conviva.Constants.AdPosition.MIDROLL)
})
})

Expand Down Expand Up @@ -67,6 +61,7 @@ describe(AdHelper, () => {
describe('extractConvivaAdInfo', () => {
it('should extract minimal Conviva ad info', () => {
const player = {} as PlayerAPI;
const duration = 100 as number;
const adBreakEvent = {
adBreak: {
scheduleTime: 0
Expand All @@ -79,7 +74,7 @@ describe(AdHelper, () => {
},
} as AdEvent;

expect(AdHelper.extractCsaiConvivaAdInfo(player, adBreakEvent, adEvent)).toEqual({
expect(AdHelper.extractCsaiConvivaAdInfo(player, adBreakEvent, duration, adEvent)).toEqual({
"c3.ad.creativeId": "NA",
"c3.ad.firstAdId": "123",
"c3.ad.firstAdSystem": "NA",
Expand All @@ -96,6 +91,7 @@ describe(AdHelper, () => {

it('should extract full Conviva ad info', () => {
const player = {} as PlayerAPI;
const duration = 100 as number;
const adBreakEvent = {
adBreak: {
scheduleTime: 0
Expand All @@ -119,7 +115,7 @@ describe(AdHelper, () => {
} as Ad | LinearAd,
} as AdEvent;

expect(AdHelper.extractCsaiConvivaAdInfo(player, adBreakEvent, adEvent)).toEqual({
expect(AdHelper.extractCsaiConvivaAdInfo(player, adBreakEvent, duration, adEvent)).toEqual({
[Conviva.Constants.ASSET_NAME]: "Test title",
[Conviva.Constants.STREAM_URL]: 'https://test.com',
[Conviva.Constants.DURATION]: 100,
Expand Down

0 comments on commit b984963

Please sign in to comment.