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

ADSS-1813 Fix multi size #12

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
4 changes: 2 additions & 2 deletions modules/gumgumBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -553,10 +553,10 @@ function interpretResponse(serverResponse, bidRequest) {
sizes = [`${maxw}x${maxh}`];
} else if (product === 5 && includes(sizes, '1x1')) {
sizes = ['1x1'];
} else if (product === 2 && includes(sizes, '1x1')) {
} else if ((product === 2 && includes(sizes, '1x1')) || product === 3) {
const requestSizesThatMatchResponse = (bidRequest.sizes && bidRequest.sizes.reduce((result, current) => {
const [ width, height ] = current;
if (responseWidth === width || responseHeight === height) result.push(current.join('x'));
if (responseWidth === width && responseHeight === height) result.push(current.join('x'));
return result
}, [])) || [];
sizes = requestSizesThatMatchResponse.length ? requestSizesThatMatchResponse : parseSizesInput(bidRequest.sizes)
Expand Down
13 changes: 13 additions & 0 deletions test/spec/modules/gumgumBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,19 @@ describe('gumgumAdapter', function () {
expect(result.height = expectedSize[1]);
})

it('request size that matches response size for in-slot', function () {
const request = { ...bidRequest };
const body = { ...serverResponse };
const expectedSize = [[ 320, 50 ], [300, 600], [300, 250]];
let result;
request.pi = 3;
body.ad.width = 300;
body.ad.height = 600;
result = spec.interpretResponse({ body }, request)[0];
expect(result.width = expectedSize[1][0]);
expect(result.height = expectedSize[1][1]);
})

it('defaults to use bidRequest sizes', function () {
const { ad, jcsi, pag, thms, meta } = serverResponse
const noAdSizes = { ...ad }
Expand Down