Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insticator adapter update with publisherId param #11733

Merged
merged 3 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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