Skip to content

Commit

Permalink
Fix for the multi-size in- slot
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinGumGum committed Feb 6, 2024
1 parent f8858ae commit 4d6cd54
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
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

0 comments on commit 4d6cd54

Please sign in to comment.