Skip to content

Commit

Permalink
Seedtag - add device.sua parameter to the bidRequest (#11856)
Browse files Browse the repository at this point in the history
* add device.sua parameter to the payload

* lint

* fix test
  • Loading branch information
ybootin authored Jun 25, 2024
1 parent 980a11e commit ac3f0e8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/seedtagBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,10 @@ export const spec = {
payload.badv = bidderRequest.ortb2?.badv
}

if (bidderRequest.ortb2?.device?.sua) {
payload.sua = bidderRequest.ortb2.device.sua
}

const payloadString = JSON.stringify(payload);

return {
Expand Down
27 changes: 27 additions & 0 deletions test/spec/modules/seedtagBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,33 @@ describe('Seedtag Adapter', function () {
expect(data.badv).to.be.undefined;
});
});

describe('device.sua param', function () {
it('should add device.sua param to payload when bidderRequest has ortb2 device.sua info', function () {
const sua = 1
var ortb2 = {
device: {
sua: sua
}
}
bidderRequest['ortb2'] = ortb2

const request = spec.buildRequests(validBidRequests, bidderRequest);
const data = JSON.parse(request.data);
expect(data.sua).to.equal(sua);
});

it('should not add device.sua param to payload when bidderRequest does not have ortb2 device.sua info', function () {
var ortb2 = {
device: {}
}
bidderRequest['ortb2'] = ortb2

const request = spec.buildRequests(validBidRequests, bidderRequest);
const data = JSON.parse(request.data);
expect(data.sua).to.be.undefined;
});
});
})
describe('interpret response method', function () {
it('should return a void array, when the server response are not correct.', function () {
Expand Down

0 comments on commit ac3f0e8

Please sign in to comment.