From 582787a92cba504e054e41180f2a3c41187a5a0f Mon Sep 17 00:00:00 2001 From: Tzafrir Ben Ami Date: Tue, 31 Oct 2017 11:53:44 +0200 Subject: [PATCH] change #1742 (https://github.com/prebid/Prebid.js/issues/1742): rather than interpretResponse(body), the bidderFactory is calling your adapter with interpretResponse({ body: body, ... }) --- modules/komoonaBidAdapter.js | 4 +- test/spec/modules/komoonaBidAdapter_spec.js | 48 +++++++++++---------- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/modules/komoonaBidAdapter.js b/modules/komoonaBidAdapter.js index abbcebc0d06..2a8c8753098 100644 --- a/modules/komoonaBidAdapter.js +++ b/modules/komoonaBidAdapter.js @@ -83,8 +83,8 @@ export const spec = { interpretResponse: (response, request) => { const bidResponses = []; try { - if (response.bids) { - response.bids.forEach(bid => { + if (response.body && response.body.bids) { + response.body.bids.forEach(bid => { // The bid ID. Used to tie this bid back to the request. bid.requestId = bid.uuid; // The creative payload of the returned bid. diff --git a/test/spec/modules/komoonaBidAdapter_spec.js b/test/spec/modules/komoonaBidAdapter_spec.js index afb7c88e495..d6d1a224d1e 100644 --- a/test/spec/modules/komoonaBidAdapter_spec.js +++ b/test/spec/modules/komoonaBidAdapter_spec.js @@ -36,20 +36,22 @@ describe('Komoona.com Adapter Tests', () => { }]; const bidsResponse = { - bids: [ - { - placementid: '170577', - uuid: '2faedf1095f815', - width: 300, - height: 250, - cpm: 0.51, - creative: '', - ttl: 360, - currency: 'USD', - netRevenue: true, - creativeId: 'd30b58c2ba' - } - ] + body: { + bids: [ + { + placementid: '170577', + uuid: '2faedf1095f815', + width: 300, + height: 250, + cpm: 0.51, + creative: '', + ttl: 360, + currency: 'USD', + netRevenue: true, + creativeId: 'd30b58c2ba' + } + ] + } }; it('Verifies komoonaAdapter bidder code', () => { @@ -134,16 +136,18 @@ describe('Komoona.com Adapter Tests', () => { // verify bid object const bid = bids[0]; - expect(bid.cpm).to.equal(bidsResponse.bids[0].cpm); - expect(bid.ad).to.equal(bidsResponse.bids[0].creative); - expect(bid.requestId).equal(bidsResponse.bids[0].uuid); - expect(bid.uuid).equal(bidsResponse.bids[0].uuid); - expect(bid.width).to.equal(bidsResponse.bids[0].width); - expect(bid.height).to.equal(bidsResponse.bids[0].height); - expect(bid.ttl).to.equal(bidsResponse.bids[0].ttl); + const responseBids = bidsResponse.body.bids; + + expect(bid.cpm).to.equal(responseBids[0].cpm); + expect(bid.ad).to.equal(responseBids[0].creative); + expect(bid.requestId).equal(responseBids[0].uuid); + expect(bid.uuid).equal(responseBids[0].uuid); + expect(bid.width).to.equal(responseBids[0].width); + expect(bid.height).to.equal(responseBids[0].height); + expect(bid.ttl).to.equal(responseBids[0].ttl); expect(bid.currency).to.equal('USD'); expect(bid.netRevenue).to.equal(true); - expect(bid.creativeId).to.equal(bidsResponse.bids[0].creativeId); + expect(bid.creativeId).to.equal(responseBids[0].creativeId); }); describe('Verifies komoonaAdapter sync options', () => {