Skip to content

Commit

Permalink
Underdogmedia Bid Adapter: Update pbTimeout Assignment (#10466)
Browse files Browse the repository at this point in the history
* Update assigning pbTimeout to our payload

* Revert unintended change

* Add appropriate unit tests for timeout
  • Loading branch information
kevpark02 authored Oct 10, 2023
1 parent 6c7f17f commit e86dfcf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modules/underdogmediaBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const spec = {
let data = {
dt: 10,
gdpr: {},
pbTimeout: config.getConfig('bidderTimeout'),
pbTimeout: +config.getConfig('bidderTimeout') || 3001, // KP: convert to number and if NaN we default to 3001. Particular value to let us know that there was a problem in converting pbTimeout
pbjsVersion: prebidVersion,
placements: [],
ref: deepAccess(bidderRequest, 'refererInfo.page') ? bidderRequest.refererInfo.page : undefined,
Expand Down
15 changes: 15 additions & 0 deletions test/spec/modules/underdogmediaBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
spec,
resetUserSync
} from 'modules/underdogmediaBidAdapter.js';
import { config } from '../../../src/config';

describe('UnderdogMedia adapter', function () {
let bidRequests;
Expand Down Expand Up @@ -763,6 +764,20 @@ describe('UnderdogMedia adapter', function () {
expect(request.data.ref).to.equal(undefined);
});

it('should have pbTimeout to be 3001 if bidder timeout does not exists', function () {
config.setConfig({ bidderTimeout: '' })
const request = spec.buildRequests(bidRequests, bidderRequest);

expect(request.data.pbTimeout).to.equal(3001)
})

it('should have pbTimeout to be a numerical value if bidder timeout is in a string', function () {
config.setConfig({ bidderTimeout: '1000' })
const request = spec.buildRequests(bidRequests, bidderRequest);

expect(request.data.pbTimeout).to.equal(1000)
})

it('should have pubcid if it exists', function () {
let bidRequests = [{
adUnitCode: 'div-gpt-ad-1460505748561-0',
Expand Down

0 comments on commit e86dfcf

Please sign in to comment.