Skip to content

Commit

Permalink
Adnuntius Bidder: Deal ID and domain change (prebid#7540)
Browse files Browse the repository at this point in the history
* Adnuntius Bid Adapter: Added tests for gdpr and segments

* Changed bidder to read segments from ortb2.

* Adding deals to response.
  • Loading branch information
mikael-lundin authored and Chris Pabst committed Jan 10, 2022
1 parent 77c1603 commit e6ec75b
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/adnuntiusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export const spec = {
height: Number(ad.creativeHeight),
creativeId: ad.creativeId,
currency: (ad.bid) ? ad.bid.currency : 'EUR',
dealId: ad.dealId || '',
meta: {
advertiserDomains: (ad.destinationUrls.destination) ? [ad.destinationUrls.destination.split('/')[2]] : []

Expand Down
68 changes: 68 additions & 0 deletions test/spec/modules/adnuntiusBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,74 @@ describe('adnuntiusBidAdapter', function () {
});
});

describe('user privacy', function () {
it('should send GDPR Consent data if gdprApplies', function () {
let request = spec.buildRequests(bidRequests, { gdprConsent: { gdprApplies: true, consentString: 'consentString' } });
expect(request.length).to.equal(1);
expect(request[0]).to.have.property('url')
expect(request[0].url).to.equal(ENDPOINT_URL_CONSENT);
});

it('should not send GDPR Consent data if gdprApplies equals undefined', function () {
let request = spec.buildRequests(bidRequests, { gdprConsent: { gdprApplies: undefined, consentString: 'consentString' } });
expect(request.length).to.equal(1);
expect(request[0]).to.have.property('url')
expect(request[0].url).to.equal(ENDPOINT_URL);
});

it('should pass segments if available in config', function () {
config.setBidderConfig({
bidders: ['adnuntius', 'other'],
config: {
ortb2: {
user: {
data: [{
name: 'adnuntius',
segment: [{ id: 'segment1' }, { id: 'segment2' }]
},
{
name: 'other',
segment: ['segment3']
}],
}
}
}
});

const request = config.runWithBidder('adnuntius', () => spec.buildRequests(bidRequests));
expect(request.length).to.equal(1);
expect(request[0]).to.have.property('url')
expect(request[0].url).to.equal(ENDPOINT_URL_SEGMENTS);
});

it('should skip segments in config if not either id or array of strings', function () {
config.setBidderConfig({
bidders: ['adnuntius', 'other'],
config: {
ortb2: {
user: {
data: [{
name: 'adnuntius',
segment: [{ id: 'segment1' }, { id: 'segment2' }, { id: 'segment3' }]
},
{
name: 'other',
segment: [{
notright: 'segment4'
}]
}],
}
}
}
});

const request = config.runWithBidder('adnuntius', () => spec.buildRequests(bidRequests));
expect(request.length).to.equal(1);
expect(request[0]).to.have.property('url')
expect(request[0].url).to.equal(ENDPOINT_URL_SEGMENTS);
});
});

describe('user privacy', function () {
it('should send GDPR Consent data if gdprApplies', function () {
let request = spec.buildRequests(bidRequests, { gdprConsent: { gdprApplies: true, consentString: 'consentString' } });
Expand Down

0 comments on commit e6ec75b

Please sign in to comment.