Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GumGum: add default sizes #5492

Merged
merged 15 commits into from
Jul 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions modules/gumgumBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,15 @@ function buildRequests (validBidRequests, bidderRequest) {
transactionId,
userId = {}
} = bidRequest;
const bannerSizes = mediaTypes.banner && mediaTypes.banner.sizes;
let sizes = [1, 1];
let data = {};

if (mediaTypes.banner) {
sizes = mediaTypes.banner.sizes;
} else if (mediaTypes.video) {
sizes = mediaTypes.video.playerSize;
}

if (pageViewId) {
data.pv = pageViewId;
}
Expand Down Expand Up @@ -278,7 +284,7 @@ function buildRequests (validBidRequests, bidderRequest) {
tId: transactionId,
pi: data.pi,
selector: params.selector,
sizes: bannerSizes,
sizes,
url: BID_ENDPOINT,
method: 'GET',
data: Object.assign(data, _getBrowserParams(topWindowUrl), _getDigiTrustQueryParams(userId), _getTradeDeskIDParam(userId))
Expand Down
36 changes: 20 additions & 16 deletions test/spec/modules/gumgumBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,24 @@ describe('gumgumAdapter', function () {
}
}
];
const vidMediaTypes = {
video: {
playerSize: [640, 480],
context: 'instream',
minduration: 1,
maxduration: 2,
linearity: 1,
startdelay: 1,
placement: 123456,
protocols: [1, 2]
}
};

it('should return a defined sizes field for video', function () {
const request = { ...bidRequests[0], mediaTypes: vidMediaTypes, params: { 'videoPubID': 123 } };
const bidRequest = spec.buildRequests([request])[0];
expect(bidRequest.sizes).to.equal(vidMediaTypes.video.playerSize);
});

it('sends bid request to ENDPOINT via GET', function () {
const request = spec.buildRequests(bidRequests)[0];
Expand Down Expand Up @@ -145,21 +163,7 @@ describe('gumgumAdapter', function () {
expect(bidRequest.data).to.not.include.any.keys('t');
});
it('should send pubId if videoPubID param is specified', function () {
const mediaTypes = {
video: {
playerSize: [640, 480],
context: 'instream',
minduration: 1,
maxduration: 2,
linearity: 1,
startdelay: 1,
placement: 123456,
protocols: [1, 2]
}
};
const request = Object.assign({}, bidRequests[0]);
request.mediaTypes = mediaTypes
request.params = { 'videoPubID': 123 };
const request = { ...bidRequests[0], mediaTypes: vidMediaTypes, params: { 'videoPubID': 123 } };
const bidRequest = spec.buildRequests([request])[0];
expect(bidRequest.data).to.include.any.keys('pubId');
expect(bidRequest.data.pubId).to.equal(request.params.videoPubID);
Expand Down Expand Up @@ -423,7 +427,7 @@ describe('gumgumAdapter', function () {
});

it('updates jcsi object when the server response jcsi prop is found', function () {
const response = Object.assign({cw: 'AD_JSON'}, serverResponse);
const response = Object.assign({ cw: 'AD_JSON' }, serverResponse);
const bidResponse = spec.interpretResponse({ body: response }, bidRequest)[0].ad;
const decodedResponse = JSON.parse(atob(bidResponse));
expect(decodedResponse.jcsi).to.eql(JCSI);
Expand Down