From 8f4f25dc10b5c4a02221642e733051214bf3ec07 Mon Sep 17 00:00:00 2001 From: Michele Nasti Date: Mon, 13 May 2019 13:19:02 +0200 Subject: [PATCH 1/2] added property ex to rawBid --- modules/aardvarkBidAdapter.js | 4 ++++ test/spec/modules/aardvarkBidAdapter_spec.js | 3 +++ 2 files changed, 7 insertions(+) diff --git a/modules/aardvarkBidAdapter.js b/modules/aardvarkBidAdapter.js index 49095b1cfc1..b1cbc675568 100644 --- a/modules/aardvarkBidAdapter.js +++ b/modules/aardvarkBidAdapter.js @@ -124,6 +124,10 @@ export const spec = { bidResponse.dealId = rawBid.dealId } + if (rawBid.hasOwnProperty('ex')) { + bidResponse.ex = rawBid.ex; + } + switch (rawBid.media) { case 'banner': bidResponse.ad = rawBid.adm + utils.createTrackPixelHtml(decodeURIComponent(rawBid.nurl)); diff --git a/test/spec/modules/aardvarkBidAdapter_spec.js b/test/spec/modules/aardvarkBidAdapter_spec.js index 628f19f8fd2..c5195494941 100644 --- a/test/spec/modules/aardvarkBidAdapter_spec.js +++ b/test/spec/modules/aardvarkBidAdapter_spec.js @@ -219,6 +219,7 @@ describe('aardvarkAdapterTest', function () { cid: '1abgs362e0x48a8', adm: '', ttl: 200, + ex: 'extraproperty' } ], headers: {} @@ -234,6 +235,7 @@ describe('aardvarkAdapterTest', function () { expect(result[0].currency).to.equal('USD'); expect(result[0].ttl).to.equal(200); expect(result[0].dealId).to.equal('dealing'); + expect(result[0].ex).to.be.undefined; expect(result[0].ad).to.not.be.undefined; expect(result[1].requestId).to.equal('1abgs362e0x48a8'); @@ -243,6 +245,7 @@ describe('aardvarkAdapterTest', function () { expect(result[1].currency).to.equal('USD'); expect(result[1].ttl).to.equal(200); expect(result[1].ad).to.not.be.undefined; + expect(result[1].ex).to.equal('extraproperty'); }); it('should handle nobid responses', function () { From 0bb87be7eb0ff1e5bfd6646593aab3f878fc453d Mon Sep 17 00:00:00 2001 From: Michele Nasti Date: Mon, 13 May 2019 15:05:55 +0200 Subject: [PATCH 2/2] removed utils.getTopWindowUrl() --- modules/aardvarkBidAdapter.js | 2 +- test/spec/modules/aardvarkBidAdapter_spec.js | 32 +++++++++++++++----- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/modules/aardvarkBidAdapter.js b/modules/aardvarkBidAdapter.js index b1cbc675568..108e56ac06a 100644 --- a/modules/aardvarkBidAdapter.js +++ b/modules/aardvarkBidAdapter.js @@ -25,7 +25,7 @@ export const spec = { var auctionCodes = []; var requests = []; var requestsMap = {}; - var referer = utils.getTopWindowUrl(); + var referer = bidderRequest.refererInfo.referer; var pageCategories = []; // This reference to window.top can cause issues when loaded in an iframe if not protected with a try/catch. diff --git a/test/spec/modules/aardvarkBidAdapter_spec.js b/test/spec/modules/aardvarkBidAdapter_spec.js index c5195494941..8ce4aa85561 100644 --- a/test/spec/modules/aardvarkBidAdapter_spec.js +++ b/test/spec/modules/aardvarkBidAdapter_spec.js @@ -54,21 +54,27 @@ describe('aardvarkAdapterTest', function () { auctionId: 'e97cafd0-ebfc-4f5c-b7c9-baa0fd335a4a' }]; + const bidderRequest = { + refererInfo: { + referer: 'http://example.com' + } + }; + it('should use HTTP GET method', function () { - const requests = spec.buildRequests(bidRequests); + const requests = spec.buildRequests(bidRequests, bidderRequest); requests.forEach(function(requestItem) { expect(requestItem.method).to.equal('GET'); }); }); it('should call the correct bidRequest url', function () { - const requests = spec.buildRequests(bidRequests); + const requests = spec.buildRequests(bidRequests, bidderRequest); expect(requests.length).to.equal(1); expect(requests[0].url).to.match(new RegExp('^\/\/adzone.pub.com/xiby/TdAx_RAZd/aardvark\?')); }); it('should have correct data', function () { - const requests = spec.buildRequests(bidRequests); + const requests = spec.buildRequests(bidRequests, bidderRequest); expect(requests.length).to.equal(1); expect(requests[0].data.version).to.equal(1); expect(requests[0].data.jsonp).to.equal(false); @@ -108,22 +114,28 @@ describe('aardvarkAdapterTest', function () { auctionId: 'e97cafd0-ebfc-4f5c-b7c9-baa0fd335a4a' }]; + const bidderRequest = { + refererInfo: { + referer: 'http://example.com' + } + }; + it('should use HTTP GET method', function () { - const requests = spec.buildRequests(bidRequests); + const requests = spec.buildRequests(bidRequests, bidderRequest); requests.forEach(function(requestItem) { expect(requestItem.method).to.equal('GET'); }); }); it('should call the correct bidRequest urls for each auction', function () { - const requests = spec.buildRequests(bidRequests); + const requests = spec.buildRequests(bidRequests, bidderRequest); expect(requests[0].url).to.match(new RegExp('^\/\/bidder.rtk.io/Toby/TdAx/aardvark\?')); expect(requests[0].data.categories.length).to.equal(2); expect(requests[1].url).to.match(new RegExp('^\/\/adzone.pub.com/xiby/RAZd/aardvark\?')); }); it('should have correct data', function () { - const requests = spec.buildRequests(bidRequests); + const requests = spec.buildRequests(bidRequests, bidderRequest); expect(requests.length).to.equal(2); expect(requests[0].data.version).to.equal(1); expect(requests[0].data.jsonp).to.equal(false); @@ -157,6 +169,9 @@ describe('aardvarkAdapterTest', function () { gdprConsent: { consentString: 'awefasdfwefasdfasd', gdprApplies: true + }, + refererInfo: { + referer: 'http://example.com' } }; @@ -184,7 +199,10 @@ describe('aardvarkAdapterTest', function () { }]; const bidderRequest = { - gdprConsent: undefined + gdprConsent: undefined, + refererInfo: { + referer: 'http://example.com' + } }; it('should transmit correct data', function () {