Skip to content

Commit

Permalink
change prebid#1742 (prebid#1742): rather than interpretResponse(body)…
Browse files Browse the repository at this point in the history
…, the bidderFactory is calling your adapter with interpretResponse({ body: body, ... })
  • Loading branch information
tzafrirb committed Oct 31, 2017
1 parent f130123 commit 582787a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 24 deletions.
4 changes: 2 additions & 2 deletions modules/komoonaBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
48 changes: 26 additions & 22 deletions test/spec/modules/komoonaBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,22 @@ describe('Komoona.com Adapter Tests', () => {
}];

const bidsResponse = {
bids: [
{
placementid: '170577',
uuid: '2faedf1095f815',
width: 300,
height: 250,
cpm: 0.51,
creative: '<script type="text/javascript" src="http://creative.com/pathToNiceCreative"></script>',
ttl: 360,
currency: 'USD',
netRevenue: true,
creativeId: 'd30b58c2ba'
}
]
body: {
bids: [
{
placementid: '170577',
uuid: '2faedf1095f815',
width: 300,
height: 250,
cpm: 0.51,
creative: '<script type="text/javascript" src="http://creative.com/pathToNiceCreative"></script>',
ttl: 360,
currency: 'USD',
netRevenue: true,
creativeId: 'd30b58c2ba'
}
]
}
};

it('Verifies komoonaAdapter bidder code', () => {
Expand Down Expand Up @@ -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', () => {
Expand Down

0 comments on commit 582787a

Please sign in to comment.