Skip to content

Commit

Permalink
added schain support to sonobi adapter (prebid#4173)
Browse files Browse the repository at this point in the history
  • Loading branch information
JonGoSonobi authored and EMXDigital committed Sep 18, 2019
1 parent 1c3f56e commit e63bc70
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/sonobiBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ export const spec = {
payload.digkeyv = digitrust.keyv;
}

if (validBidRequests[0].schain) {
payload.schain = JSON.stringify(validBidRequests[0].schain)
}

// If there is no key_maker data, then don't make the request.
if (isEmpty(data)) {
return null;
Expand Down
21 changes: 21 additions & 0 deletions test/spec/modules/sonobiBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,22 @@ describe('SonobiBidAdapter', function () {
userSync.canBidderRegisterSync.restore();
});
let bidRequest = [{
'schain': {
'ver': '1.0',
'complete': 1,
'nodes': [
{
'asi': 'indirectseller.com',
'sid': '00001',
'hp': 1
},
{
'asi': 'indirectseller-2.com',
'sid': '00002',
'hp': 0
},
]
},
'bidder': 'sonobi',
'params': {
'placement_id': '1a2b3c4d5e6f1a2b3c4d',
Expand Down Expand Up @@ -350,6 +366,11 @@ describe('SonobiBidAdapter', function () {
const bidRequests = spec.buildRequests(bidRequest, bidderRequests);
expect(bidRequests.data.ius).to.equal(1);
});

it('should return a properly formatted request with schain defined', function () {
const bidRequests = spec.buildRequests(bidRequest, bidderRequests);
expect(JSON.parse(bidRequests.data.schain)).to.deep.equal(bidRequest[0].schain)
})
})

describe('.interpretResponse', function () {
Expand Down

0 comments on commit e63bc70

Please sign in to comment.