Skip to content

Commit

Permalink
StroeerCore Bid Adapter: remove redundant param 'yl2'
Browse files Browse the repository at this point in the history
  • Loading branch information
philipwatson committed May 23, 2024
1 parent 8f5b8b5 commit 2a11898
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 38 deletions.
16 changes: 3 additions & 13 deletions modules/stroeerCoreBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,11 @@ export const spec = {

function createPayload(bidRequests, customAttrsFn) {
const bidRequestWithSsat = bidRequests.find(bidRequest => bidRequest.params.ssat);
const bidRequestWithYl2 = bidRequests.find(bidRequest => bidRequest.params.yl2);

const payload = Object.assign({
const payload = {
ssat: bidRequestWithSsat ? bidRequestWithSsat.params.ssat : undefined,
yl2: bidRequestWithYl2 ? bidRequestWithYl2.params.yl2 : (getFromLocalStorage('sdgYieldtest') === '1'),
}, commonPayload);
...commonPayload
}

payload.bids = bidRequests.map(bidRequest => {
const metaTagPosition = win.YLHH?.bidder?.tag?.getMetaTagPositionBy(bidRequest.adUnitCode) ?? bidRequest.adUnitCode;
Expand All @@ -276,15 +275,6 @@ export const spec = {
return payload;
}

function getFromLocalStorage(itemName) {
let result;
try {
// Browser may restrict access by throwing error
result = localStorage[itemName];
} catch (ignore) { }
return result;
}

function getContextFromSDG(metaTagPosition) {
if (win.SDG) {
return {
Expand Down
25 changes: 0 additions & 25 deletions test/spec/modules/stroeerCoreBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,6 @@ describe('stroeerCore bid adapter', function() {
'ref': 'https://www.example.com/?search=monkey',
'mpa': true,
'ssl': false,
'yl2': false,
'url': 'https://www.example.com/monkey/index.html',
'bids': [{
'sid': 'NDA=',
Expand Down Expand Up @@ -945,30 +944,6 @@ describe('stroeerCore bid adapter', function() {
assert.equal(serverRequestInfo.data.ssat, 99);
});

it('yl2 defaults to false', () => {
const bidReq = buildBidderRequest();
bidReq.bids.length = 1;
const serverRequestInfo = spec.buildRequests(bidReq.bids, bidReq)[0];
assert.equal(serverRequestInfo.data.yl2, false);
});

it('should use yl2 value from config', () => {
const bidReq = buildBidderRequest();
bidReq.bids.length = 1;
bidReq.bids[0].params.yl2 = true;
const serverRequestInfo = spec.buildRequests(bidReq.bids, bidReq)[0];
assert.equal(serverRequestInfo.data.yl2, true);
});

it('should use yl2 value from localStorage', () => {
localStorage.sdgYieldtest = '1';
const bidReq = buildBidderRequest();
bidReq.bids.length = 1;
bidReq.bids[0].params.yl2 = false;
const serverRequestInfo = spec.buildRequests(bidReq.bids, bidReq)[0];
assert.equal(serverRequestInfo.data.yl2, true);
});

it('should not have ssat by default', () => {
const bidReq = buildBidderRequest();
bidReq.bids.length = 1;
Expand Down

0 comments on commit 2a11898

Please sign in to comment.