Skip to content

Commit

Permalink
StroeerCore Bid Adapter: add special format parameters to bid request
Browse files Browse the repository at this point in the history
  • Loading branch information
philipwatson committed Sep 27, 2024
1 parent 44b2a46 commit 7b21ed5
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 5 deletions.
1 change: 1 addition & 0 deletions modules/stroeerCoreBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ const mapToPayloadBaseBid = (bidRequest) => ({
bid: bidRequest.bidId,
sid: bidRequest.params.sid,
viz: elementInView(bidRequest.adUnitCode),
sfp: bidRequest.params.sfp,
});

const mapToPayloadBannerBid = (bidRequest) => {
Expand Down
47 changes: 42 additions & 5 deletions test/spec/modules/stroeerCoreBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ describe('stroeerCore bid adapter', function () {
'siz': [[300, 600], [160, 60]],
'fp': undefined
},
'sfp': undefined,
},
{
'sid': 'ABC=',
Expand All @@ -541,7 +542,8 @@ describe('stroeerCore bid adapter', function () {
'siz': [[100, 200], [300, 500]],
'fp': undefined
},
'viz': undefined
'viz': undefined,
'sfp': undefined,
}
];

Expand All @@ -555,7 +557,8 @@ describe('stroeerCore bid adapter', function () {
'siz': [640, 480],
'mim': ['video/mp4', 'video/quicktime'],
'fp': undefined
}
},
'sfp': undefined,
}
];

Expand Down Expand Up @@ -597,7 +600,8 @@ describe('stroeerCore bid adapter', function () {
'ban': {
'siz': [[100, 200], [300, 500]],
'fp': undefined
}
},
'sfp': undefined,
}
];

Expand All @@ -611,14 +615,14 @@ describe('stroeerCore bid adapter', function () {
'siz': [640, 480],
'mim': ['video/mp4', 'video/quicktime'],
'fp': undefined
}
},
'sfp': undefined,
}
];

assert.deepEqual(serverRequestInfo.data.bids, [...expectedBannerBids, ...expectedVideoBids]);
});
});

describe('optional fields', () => {
it('should skip viz field when unable to determine visibility of placement', () => {
placementElements.length = 0;
Expand Down Expand Up @@ -898,6 +902,39 @@ describe('stroeerCore bid adapter', function () {

assert.deepEqual(sentOrtb2, ortb2);
});

it('should add the special format parameters', () => {
const bidReq = buildBidderRequest();

const sfp0 = {
'field1': {
'abc': '123',
}
};

const sfp1 = {
'field3': 'xyz'
};

bidReq.bids[0].params.sfp = utils.deepClone(sfp0);
bidReq.bids[1].params.sfp = utils.deepClone(sfp1);

const serverRequestInfo = spec.buildRequests(bidReq.bids, bidReq);

assert.deepEqual(serverRequestInfo.data.bids[0].sfp, sfp0);
assert.deepEqual(serverRequestInfo.data.bids[1].sfp, sfp1);
});

it('should add the special format parameters even when it is an empty object', () => {
const bidReq = buildBidderRequest();

bidReq.bids[0].params.sfp = {};

const serverRequestInfo = spec.buildRequests(bidReq.bids, bidReq);

assert.deepEqual(serverRequestInfo.data.bids[0].sfp, {});
assert.isUndefined(serverRequestInfo.data.bids[1].sfp);
});
});
});
});
Expand Down

0 comments on commit 7b21ed5

Please sign in to comment.