Skip to content

Commit

Permalink
Adding the "positionType" parameter (#7234)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxSmileWanted authored Jul 29, 2021
1 parent ed036b9 commit caa329a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/smilewantedBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const spec = {
transactionId: bid.transactionId,
timeout: config.getConfig('bidderTimeout'),
bidId: bid.bidId,
positionType: bid.params.positionType || '',
prebidVersion: '$prebid.version$'
};

Expand Down
28 changes: 28 additions & 0 deletions test/spec/modules/smilewantedBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@ const DISPLAY_REQUEST = [{
transactionId: 'trans_abcd1234'
}];

const DISPLAY_REQUEST_WITH_POSITION_TYPE = [{
adUnitCode: 'sw_300x250',
bidId: '12345',
sizes: [
[300, 250],
[300, 200]
],
bidder: 'smilewanted',
params: {
zoneId: 1,
positionType: 'infeed'
},
requestId: 'request_abcd1234',
transactionId: 'trans_abcd1234'
}];

const BID_RESPONSE_DISPLAY = {
body: {
cpm: 3,
Expand Down Expand Up @@ -300,6 +316,18 @@ describe('smilewantedBidAdapterTests', function () {
})).to.equal(false);
});

it('SmileWanted - Verify if payload(positionType) is default value when nothing is passed on the param', function () {
const request = spec.buildRequests(DISPLAY_REQUEST, {});
const requestContent = JSON.parse(request[0].data);
expect(requestContent).to.have.property('positionType').and.to.equal('');
});

it('SmileWanted - Verify if payload(positionType) is well passed', function () {
const request = spec.buildRequests(DISPLAY_REQUEST_WITH_POSITION_TYPE, {});
const requestContent = JSON.parse(request[0].data);
expect(requestContent).to.have.property('positionType').and.to.equal('infeed');
});

it('SmileWanted - Verify user sync', function () {
var syncs = spec.getUserSyncs({iframeEnabled: true}, {}, {
consentString: 'foo'
Expand Down

0 comments on commit caa329a

Please sign in to comment.