Skip to content

Commit

Permalink
add adomain support (#6791)
Browse files Browse the repository at this point in the history
Co-authored-by: Ignat Khaylov <khaylov@betweenx.com>
  • Loading branch information
ignat-one and Ignat Khaylov authored May 19, 2021
1 parent c346322 commit 566c8ae
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
5 changes: 4 additions & 1 deletion modules/betweenBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ export const spec = {
creativeId: serverResponse.body[i].creativeid,
currency: serverResponse.body[i].currency || 'RUB',
netRevenue: serverResponse.body[i].netRevenue || true,
ad: serverResponse.body[i].ad
ad: serverResponse.body[i].ad,
meta: {
advertiserDomains: serverResponse.body[i].adomain ? serverResponse.body[i].adomain : []
}
};
bidResponses.push(bidResponse);
}
Expand Down
33 changes: 33 additions & 0 deletions test/spec/modules/betweenBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,4 +267,37 @@ describe('betweenBidAdapterTests', function () {
const shid3 = JSON.parse(spec.buildRequests(bidRequestData).data)[0].data.shid3;
expect(shid).to.equal('01EXQE7JKNDRDDVATB0S2GX1NT') && expect(shid3).to.equal('');
});
it('check adomain', function() {
const serverResponse = {
body: [{
bidid: 'bid1234',
cpm: 1.12,
w: 240,
h: 400,
currency: 'USD',
ad: 'Ad html',
adomain: ['domain1.com', 'domain2.com']
}]
};
const bids = spec.interpretResponse(serverResponse);
expect(bids).to.have.lengthOf(1);
const bid = bids[0];
expect(bid.meta.advertiserDomains).to.deep.equal(['domain1.com', 'domain2.com']);
});
it('check server response without adomain', function() {
const serverResponse = {
body: [{
bidid: 'bid1234',
cpm: 1.12,
w: 240,
h: 400,
currency: 'USD',
ad: 'Ad html',
}]
};
const bids = spec.interpretResponse(serverResponse);
expect(bids).to.have.lengthOf(1);
const bid = bids[0];
expect(bid.meta.advertiserDomains).to.deep.equal([]);
});
});

0 comments on commit 566c8ae

Please sign in to comment.