Skip to content

Commit

Permalink
Yieldmo Bid Adapter: Adding tmax to banner bid requests (prebid#10689)
Browse files Browse the repository at this point in the history
* Adding tmax to banner

* Adding unit test

adding unit tests for timeout
  • Loading branch information
desidiver authored Nov 9, 2023
1 parent e3b99f8 commit 015f12b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 6 additions & 3 deletions modules/yieldmoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,17 @@ export const spec = {
bust: new Date().getTime().toString(),
dnt: getDNT(),
description: getPageDescription(),
tmax: bidderRequest.timeout || 400,
userConsent: JSON.stringify({
// case of undefined, stringify will remove param
gdprApplies: deepAccess(bidderRequest, 'gdprConsent.gdprApplies') || '',
gdprApplies:
deepAccess(bidderRequest, 'gdprConsent.gdprApplies') || '',
cmp: deepAccess(bidderRequest, 'gdprConsent.consentString') || '',
gpp: deepAccess(bidderRequest, 'gppConsent.gppString') || '',
gpp_sid: deepAccess(bidderRequest, 'gppConsent.applicableSections') || []
gpp_sid:
deepAccess(bidderRequest, 'gppConsent.applicableSections') || [],
}),
us_privacy: deepAccess(bidderRequest, 'uspConsent') || ''
us_privacy: deepAccess(bidderRequest, 'uspConsent') || '',
};

if (canAccessTopWindow()) {
Expand Down
9 changes: 8 additions & 1 deletion test/spec/modules/yieldmoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ describe('YieldmoAdapter', function () {
bidderRequestId: '14c4ede8c693f',
bids,
auctionStart: 1520001292880,
timeout: 3000,
start: 1520001292884,
doneCbCallCount: 0,
refererInfo: {
Expand Down Expand Up @@ -169,6 +168,14 @@ describe('YieldmoAdapter', function () {
expect(requests[0].url).to.be.equal(BANNER_ENDPOINT);
});

it('should pass default timeout in bid request', function () {
const requests = build([mockBannerBid()]);
expect(requests[0].data.tmax).to.equal(400);
});
it('should pass tmax to bid request', function () {
const requests = build([mockBannerBid()], mockBidderRequest({timeout: 1000}));
expect(requests[0].data.tmax).to.equal(1000);
});
it('should not blow up if crumbs is undefined', function () {
expect(function () {
build([mockBannerBid({crumbs: undefined})]);
Expand Down

0 comments on commit 015f12b

Please sign in to comment.