Skip to content

Commit

Permalink
Insticator adapter update with publisherId param (#11733)
Browse files Browse the repository at this point in the history
* Adding publisherId to the bidrequest for insticator adapter

* test cases to insticator adapter

* test cases to insticator adapter

---------

Co-authored-by: shashidharm <[email protected]>
  • Loading branch information
shashidhar-insticator and shashidharm committed Jun 7, 2024
1 parent 031f96b commit e94e081
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/insticatorBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,10 @@ function buildRequest(validBidRequests, bidderRequest) {
deepSetValue(req, 'user.ext.consent', bidderRequest.gdprConsent.consentString);
}

if (validBidRequests[0]?.params?.publisherId) {
deepSetValue(req, 'site.publisher.id', validBidRequests[0].params.publisherId);
}

return req;
}

Expand Down
31 changes: 31 additions & 0 deletions test/spec/modules/insticatorBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,37 @@ describe('InsticatorBidAdapter', function () {
expect(data.regs.ext).to.have.property('us_privacy');
expect(data.regs.ext).to.have.property('gppSid');
});

it('should return true if publisherId is absent', () => {
expect(spec.isBidRequestValid(bidRequest)).to.be.true;
})

it('should have publisher object with id in site object, if publisherId present in params', function () {
const tempBiddRequest = {
...bidRequest,
}
tempBiddRequest.params = {
...tempBiddRequest.params,
publisherId: '86dd03a1-053f-4e3e-90e7-389070a0c62c'
}
const requests = spec.buildRequests([tempBiddRequest], bidderRequest);
const data = JSON.parse(requests[0].data);
expect(data.site.publisher).to.be.an('object');
expect(data.site.publisher.id).to.equal(tempBiddRequest.params.publisherId)
});

it('should have publisher object should be empty, if publisherId is empty string', function () {
const tempBiddRequest = {
...bidRequest,
}
tempBiddRequest.params = {
...tempBiddRequest.params,
publisherId: ''
}
const requests = spec.buildRequests([tempBiddRequest], bidderRequest);
const data = JSON.parse(requests[0].data);
expect(data.site.publisher).to.not.an('object');
});
});

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

0 comments on commit e94e081

Please sign in to comment.