Skip to content

Commit

Permalink
SmartyadsBidAdapter/send_notifics_noly_on_prebid_host (#10457)
Browse files Browse the repository at this point in the history
Co-authored-by: vrishko <[email protected]>
  • Loading branch information
rishko00 and vrishko committed Sep 11, 2023
1 parent 64349d9 commit 36eadbd
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 6 deletions.
12 changes: 9 additions & 3 deletions modules/smartyadsBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,22 @@ export const spec = {
if (bid.winUrl) {
ajax(bid.winUrl, () => {}, JSON.stringify(bid));
} else {
ajax('https://et-nd43.itdsmr.com/?c=o&m=prebid&secret_key=prebid_js&winTest=1', () => {}, JSON.stringify(bid));
if (bid?.postData && bid?.postData[0] && bid?.postData[0].params && bid?.postData[0].params[0].host == 'prebid') {
ajax('https://et-nd43.itdsmr.com/?c=o&m=prebid&secret_key=prebid_js&winTest=1', () => {}, JSON.stringify(bid));
}
}
},

onTimeout: function(bid) {
ajax('https://et-nd43.itdsmr.com/?c=o&m=prebid&secret_key=prebid_js&bidTimeout=1', () => {}, JSON.stringify(bid));
if (bid?.postData && bid?.postData[0] && bid?.postData[0].params && bid?.postData[0].params[0].host == 'prebid') {
ajax('https://et-nd43.itdsmr.com/?c=o&m=prebid&secret_key=prebid_js&bidTimeout=1', () => {}, JSON.stringify(bid));
}
},

onBidderError: function(bid) {
ajax('https://et-nd43.itdsmr.com/?c=o&m=prebid&secret_key=prebid_js&bidderError=1', () => {}, JSON.stringify(bid));
if (bid?.postData && bid?.postData[0] && bid?.postData[0].params && bid?.postData[0].params[0].host == 'prebid') {
ajax('https://et-nd43.itdsmr.com/?c=o&m=prebid&secret_key=prebid_js&bidderError=1', () => {}, JSON.stringify(bid));
}
},

};
Expand Down
48 changes: 45 additions & 3 deletions test/spec/modules/smartyadsBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,21 @@ describe('SmartyadsAdapter', function () {
});

it('should send a valid bid won notice', function () {
spec.onBidWon(bidResponse);
const bid = {
'c': 'o',
'm': 'prebid',
'secret_key': 'prebid_js',
'winTest': '1',
'postData': [{
'bidder': 'smartyads',
'params': [
{'host': 'prebid',
'accountid': '123',
'sourceid': '12345'
}]
}]
};
spec.onBidWon(bid);
expect(server.requests.length).to.equal(1);
});
});
Expand All @@ -291,7 +305,21 @@ describe('SmartyadsAdapter', function () {
});

it('should send a valid bid timeout notice', function () {
spec.onTimeout({});
const bid = {
'c': 'o',
'm': 'prebid',
'secret_key': 'prebid_js',
'bidTimeout': '1',
'postData': [{
'bidder': 'smartyads',
'params': [
{'host': 'prebid',
'accountid': '123',
'sourceid': '12345'
}]
}]
};
spec.onTimeout(bid);
expect(server.requests.length).to.equal(1);
});
});
Expand All @@ -302,7 +330,21 @@ describe('SmartyadsAdapter', function () {
});

it('should send a valid bidder error notice', function () {
spec.onBidderError({});
const bid = {
'c': 'o',
'm': 'prebid',
'secret_key': 'prebid_js',
'bidderError': '1',
'postData': [{
'bidder': 'smartyads',
'params': [
{'host': 'prebid',
'accountid': '123',
'sourceid': '12345'
}]
}]
};
spec.onBidderError(bid);
expect(server.requests.length).to.equal(1);
});
});
Expand Down

0 comments on commit 36eadbd

Please sign in to comment.