Skip to content

Commit

Permalink
Yieldmo Bid Adapter : adding 4.x VAST protocol support (#10363)
Browse files Browse the repository at this point in the history
* Adding 4.x VAST Protocol support

Adding protocol support for VAST 4.0 and 4.1

* Adding unit tests
  • Loading branch information
desidiver committed Aug 16, 2023
1 parent 309f979 commit 1f6abf6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
10 changes: 8 additions & 2 deletions modules/yieldmoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -607,8 +607,14 @@ function validateVideoParams(bid) {
}

validate('video.protocols', val => isDefined(val), paramRequired);
validate('video.protocols', val => isArrayOfNums(val) && val.every(v => (v >= 1 && v <= 6)),
paramInvalid, 'array of numbers, ex: [2,3]');
validate(
'video.protocols',
(val) =>
isArrayOfNums(val) &&
val.every((v) => v >= 1 && v <= 12 && v != 9 && v != 10), // 9 and 10 are for DAST which are not supported.
paramInvalid,
'array of numbers between 1 and 12 except for 9 or 10 , ex: [2,3, 7, 11]'
);

validate('video.api', val => isDefined(val), paramRequired);
validate('video.api', val => isArrayOfNums(val) && val.every(v => (v >= 1 && v <= 6)),
Expand Down
14 changes: 14 additions & 0 deletions test/spec/modules/yieldmoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,20 @@ describe('YieldmoAdapter', function () {
expect(buildVideoBidAndGetVideoParam().mimes).to.deep.equal(['video/mkv']);
});

it('should validate protocol in video bid request', function () {
expect(
spec.isBidRequestValid(
mockVideoBid({}, {}, { protocols: [2, 3, 11] })
)
).to.be.true;

expect(
spec.isBidRequestValid(
mockVideoBid({}, {}, { protocols: [2, 3, 10] })
)
).to.be.false;
});

describe('video.skip state check', () => {
it('should not set video.skip if neither *.video.skip nor *.video.skippable is present', function () {
utils.deepAccess(videoBid, 'mediaTypes.video')['skippable'] = false;
Expand Down

0 comments on commit 1f6abf6

Please sign in to comment.