diff --git a/modules/gumgumBidAdapter.js b/modules/gumgumBidAdapter.js index 54d845be7ad..8364cd57579 100644 --- a/modules/gumgumBidAdapter.js +++ b/modules/gumgumBidAdapter.js @@ -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; } @@ -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)) diff --git a/test/spec/modules/gumgumBidAdapter_spec.js b/test/spec/modules/gumgumBidAdapter_spec.js index 7022f8f96dd..65ec52aa8c4 100644 --- a/test/spec/modules/gumgumBidAdapter_spec.js +++ b/test/spec/modules/gumgumBidAdapter_spec.js @@ -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]; @@ -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); @@ -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);