Skip to content

Commit

Permalink
tests that url params are respected
Browse files Browse the repository at this point in the history
  • Loading branch information
karimMourra committed Mar 22, 2022
1 parent 16a461f commit 52a36b0
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions test/spec/modules/dfpAdServerVideo_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,42 @@ describe('The DFP video support module', function () {
expect(url.pathname).to.equal('/ads');
});

it('should append to the url size param', () => {
const url = parse(buildDfpVideoUrl({
adUnit: adUnit,
bid: bid,
url: 'http://video.adserver.example/ads?sz=360x240&iu=/123/aduniturl&impl=s',
params: {
cust_params: {
hb_rand: 'random'
}
}
}));

const queryObject = utils.parseQS(url.query);
expect(queryObject.sz).to.equal('360x240|640x480');
});

it('should append to the existing url cust params', () => {
const url = parse(buildDfpVideoUrl({
adUnit: adUnit,
bid: bid,
url: 'http://video.adserver.example/ads?sz=360x240&iu=/123/aduniturl&impl=s&cust_params=existing_key%3Dexisting_value%26other_key%3Dother_value',
params: {
cust_params: {
hb_rand: 'random'
}
}
}));

const queryObject = utils.parseQS(url.query);
const customParams = utils.parseQS('?' + decodeURIComponent(queryObject.cust_params));

expect(customParams).to.have.property('existing_key', 'existing_value');
expect(customParams).to.have.property('other_key', 'other_value');
expect(customParams).to.have.property('hb_rand', 'random');
});

describe('adpod unit tests', function () {
let amStub;
let amGetAdUnitsStub;
Expand Down

0 comments on commit 52a36b0

Please sign in to comment.