From 2d135d909e0e2bdf93d6ca7a06fe53e99a4b3f6c Mon Sep 17 00:00:00 2001 From: xuanwang Date: Fri, 17 Sep 2021 15:26:18 +0800 Subject: [PATCH 1/5] freewheel add schain in the request --- modules/freewheel-sspBidAdapter.js | 6 ++++++ .../modules/freewheel-sspBidAdapter_spec.js | 21 ++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/modules/freewheel-sspBidAdapter.js b/modules/freewheel-sspBidAdapter.js index fa2f7b4cd6b..e8a7e5164cf 100644 --- a/modules/freewheel-sspBidAdapter.js +++ b/modules/freewheel-sspBidAdapter.js @@ -312,6 +312,12 @@ export const spec = { requestParams._fw_us_privacy = bidderRequest.uspConsent; } + // Add schain object + var schain = currentBidRequest.schain; + if (schain) { + requestParams.schain = schain; + } + var vastParams = currentBidRequest.params.vastUrlParams; if (typeof vastParams === 'object') { for (var key in vastParams) { diff --git a/test/spec/modules/freewheel-sspBidAdapter_spec.js b/test/spec/modules/freewheel-sspBidAdapter_spec.js index a5b4bd2a03f..931e5dc59e0 100644 --- a/test/spec/modules/freewheel-sspBidAdapter_spec.js +++ b/test/spec/modules/freewheel-sspBidAdapter_spec.js @@ -17,7 +17,8 @@ describe('freewheelSSP BidAdapter Test', () => { let bid = { 'bidder': 'freewheel-ssp', 'params': { - 'zoneId': '277225' + 'zoneId': '277225', + 'schain' }, 'adUnitCode': 'adunit-code', 'mediaTypes': { @@ -31,6 +32,19 @@ describe('freewheelSSP BidAdapter Test', () => { 'bidId': '30b31c1838de1e', 'bidderRequestId': '22edbae2733bf6', 'auctionId': '1d1a030790a475', + 'schain': { + 'ver': '1.0', + 'complete': 1, + 'nodes': [ + { + 'asi': 'example.com', + 'sid': '0', + 'hp': 1, + 'rid': 'bidrequestid', + 'domain': 'example.com' + } + ] + } }; it('should return true when required params found', () => { @@ -45,6 +59,11 @@ describe('freewheelSSP BidAdapter Test', () => { }; expect(spec.isBidRequestValid(bid)).to.equal(false); }); + + it('should return a properly formatted request with schain defined', function () { + const bidRequests = spec.buildRequests(bidRequest, bidderRequests); + expect(bidRequests.data.schain).to.deep.equal(bidRequest[0].schain) + }); }); describe('isBidRequestValidForVideo', () => { From dd7133bd50d8d4b3cafc948882f45fcc4132e1c5 Mon Sep 17 00:00:00 2001 From: xwang202 <57196235+xwang202@users.noreply.github.com> Date: Mon, 11 Oct 2021 13:56:53 +0800 Subject: [PATCH 2/5] Fix an error on test case --- test/spec/modules/freewheel-sspBidAdapter_spec.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/spec/modules/freewheel-sspBidAdapter_spec.js b/test/spec/modules/freewheel-sspBidAdapter_spec.js index 931e5dc59e0..107ae259c36 100644 --- a/test/spec/modules/freewheel-sspBidAdapter_spec.js +++ b/test/spec/modules/freewheel-sspBidAdapter_spec.js @@ -17,8 +17,7 @@ describe('freewheelSSP BidAdapter Test', () => { let bid = { 'bidder': 'freewheel-ssp', 'params': { - 'zoneId': '277225', - 'schain' + 'zoneId': '277225' }, 'adUnitCode': 'adunit-code', 'mediaTypes': { From c00c29a241f8d5e59448012bd33095ee794b6937 Mon Sep 17 00:00:00 2001 From: xwang202 <57196235+xwang202@users.noreply.github.com> Date: Wed, 27 Oct 2021 22:52:18 +0800 Subject: [PATCH 3/5] Update freewheel-sspBidAdapter_spec.js Update test case --- test/spec/modules/freewheel-sspBidAdapter_spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/spec/modules/freewheel-sspBidAdapter_spec.js b/test/spec/modules/freewheel-sspBidAdapter_spec.js index 107ae259c36..bf254e9f261 100644 --- a/test/spec/modules/freewheel-sspBidAdapter_spec.js +++ b/test/spec/modules/freewheel-sspBidAdapter_spec.js @@ -60,7 +60,7 @@ describe('freewheelSSP BidAdapter Test', () => { }); it('should return a properly formatted request with schain defined', function () { - const bidRequests = spec.buildRequests(bidRequest, bidderRequests); + const bidRequests = spec.buildRequests(bid); expect(bidRequests.data.schain).to.deep.equal(bidRequest[0].schain) }); }); From 46cc68f78c318a78b49305ac34a988805d8235e0 Mon Sep 17 00:00:00 2001 From: xwang202 <57196235+xwang202@users.noreply.github.com> Date: Wed, 27 Oct 2021 23:31:14 +0800 Subject: [PATCH 4/5] Update freewheel-sspBidAdapter_spec.js fix the test --- test/spec/modules/freewheel-sspBidAdapter_spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/spec/modules/freewheel-sspBidAdapter_spec.js b/test/spec/modules/freewheel-sspBidAdapter_spec.js index bf254e9f261..cce9adc5b64 100644 --- a/test/spec/modules/freewheel-sspBidAdapter_spec.js +++ b/test/spec/modules/freewheel-sspBidAdapter_spec.js @@ -61,7 +61,7 @@ describe('freewheelSSP BidAdapter Test', () => { it('should return a properly formatted request with schain defined', function () { const bidRequests = spec.buildRequests(bid); - expect(bidRequests.data.schain).to.deep.equal(bidRequest[0].schain) + expect(bidRequests.data.schain).to.deep.equal(bid.schain) }); }); From 96384bb66102f97c2fac373ce07c0b4687d7cb93 Mon Sep 17 00:00:00 2001 From: xwang202 <57196235+xwang202@users.noreply.github.com> Date: Wed, 3 Nov 2021 15:58:15 +0800 Subject: [PATCH 5/5] Update freewheel-sspBidAdapter_spec.js Fix the test error --- .../modules/freewheel-sspBidAdapter_spec.js | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/test/spec/modules/freewheel-sspBidAdapter_spec.js b/test/spec/modules/freewheel-sspBidAdapter_spec.js index cce9adc5b64..81f4ecec074 100644 --- a/test/spec/modules/freewheel-sspBidAdapter_spec.js +++ b/test/spec/modules/freewheel-sspBidAdapter_spec.js @@ -31,19 +31,6 @@ describe('freewheelSSP BidAdapter Test', () => { 'bidId': '30b31c1838de1e', 'bidderRequestId': '22edbae2733bf6', 'auctionId': '1d1a030790a475', - 'schain': { - 'ver': '1.0', - 'complete': 1, - 'nodes': [ - { - 'asi': 'example.com', - 'sid': '0', - 'hp': 1, - 'rid': 'bidrequestid', - 'domain': 'example.com' - } - ] - } }; it('should return true when required params found', () => { @@ -58,11 +45,6 @@ describe('freewheelSSP BidAdapter Test', () => { }; expect(spec.isBidRequestValid(bid)).to.equal(false); }); - - it('should return a properly formatted request with schain defined', function () { - const bidRequests = spec.buildRequests(bid); - expect(bidRequests.data.schain).to.deep.equal(bid.schain) - }); }); describe('isBidRequestValidForVideo', () => { @@ -116,6 +98,19 @@ describe('freewheelSSP BidAdapter Test', () => { 'bidId': '30b31c1838de1e', 'bidderRequestId': '22edbae2733bf6', 'auctionId': '1d1a030790a475', + 'schain': { + 'ver': '1.0', + 'complete': 1, + 'nodes': [ + { + 'asi': 'example.com', + 'sid': '0', + 'hp': 1, + 'rid': 'bidrequestid', + 'domain': 'example.com' + } + ] + } } ]; @@ -130,6 +125,12 @@ describe('freewheelSSP BidAdapter Test', () => { expect(payload.playerSize).to.equal('300x600'); }); + it('should return a properly formatted request with schain defined', function () { + const request = spec.buildRequests(bidRequests); + const payload = request[0].data; + expect(payload.schain).to.deep.equal(bidRequests[0].schain) + }); + it('sends bid request to ENDPOINT via GET', () => { const request = spec.buildRequests(bidRequests); expect(request[0].url).to.contain(ENDPOINT);