Skip to content

Commit

Permalink
add test case for missing adomain in ix adapter (#5422)
Browse files Browse the repository at this point in the history
* add test case for missing adomain in ix adapter

at request of @ix-prebid-support on #5404

* Update ixBidAdapter_spec.js

* Update ixBidAdapter_spec.js

* Update ixBidAdapter_spec.js
  • Loading branch information
patmmccann authored Jul 20, 2020
1 parent a8f394e commit 13a347a
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions test/spec/modules/ixBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,35 @@ describe('IndexexchangeAdapter', function () {
]
};

const DEFAULT_BANNER_BID_RESPONSE_WITHOUT_ADOMAIN = {
cur: 'USD',
id: '11a22b33c44d',
seatbid: [
{
bid: [
{
crid: '12345',
adid: '14851455',
impid: '1a2b3c4d',
cid: '3051266',
price: 100,
w: 300,
h: 250,
id: '1',
ext: {
dspid: 50,
pricelevel: '_100',
advbrandid: 303325,
advbrand: 'OECTA'
},
adm: '<a target="_blank" href="https://www.indexexchange.com"></a>'
}
],
seat: '3970'
}
]
};

const DEFAULT_VIDEO_BID_RESPONSE = {
cur: 'USD',
id: '1aa2bb3cc4de',
Expand Down Expand Up @@ -844,6 +873,31 @@ describe('IndexexchangeAdapter', function () {
expect(result[0]).to.deep.equal(expectedParse[0]);
});

it('should get correct bid response for banner ad with missing adomain', function () {
const expectedParse = [
{
requestId: '1a2b3c4d',
cpm: 1,
creativeId: '12345',
width: 300,
height: 250,
mediaType: 'banner',
ad: '<a target="_blank" href="https://www.indexexchange.com"></a>',
currency: 'USD',
ttl: 300,
netRevenue: true,
dealId: undefined,
meta: {
networkId: 50,
brandId: 303325,
brandName: 'OECTA'
}
}
];
const result = spec.interpretResponse({ body: DEFAULT_BANNER_BID_RESPONSE_WITHOUT_ADOMAIN }, { data: DEFAULT_BIDDER_REQUEST_DATA });
expect(result[0]).to.deep.equal(expectedParse[0]);
});

it('should set creativeId to default value if not provided', function () {
const bidResponse = utils.deepClone(DEFAULT_BANNER_BID_RESPONSE);
delete bidResponse.seatbid[0].bid[0].crid;
Expand Down

0 comments on commit 13a347a

Please sign in to comment.