diff --git a/modules/yieldmoBidAdapter.js b/modules/yieldmoBidAdapter.js index d904791d29a2..b2d13e88c808 100644 --- a/modules/yieldmoBidAdapter.js +++ b/modules/yieldmoBidAdapter.js @@ -47,7 +47,7 @@ export const spec = { if (userId) { const pubcid = userId.pubcid; serverRequest.pubcid = pubcid; - } else { + } else if (request.crumbs) { serverRequest.pubcid = request.crumbs.pubcid; } }); diff --git a/test/spec/modules/yieldmoBidAdapter_spec.js b/test/spec/modules/yieldmoBidAdapter_spec.js index 80a9265a5c26..12dd87e15176 100644 --- a/test/spec/modules/yieldmoBidAdapter_spec.js +++ b/test/spec/modules/yieldmoBidAdapter_spec.js @@ -1,6 +1,6 @@ import { expect } from 'chai'; import { spec } from 'modules/yieldmoBidAdapter'; -import {newBidder} from 'src/adapters/bidderFactory'; +import { newBidder } from 'src/adapters/bidderFactory'; import * as utils from 'src/utils'; describe('YieldmoAdapter', function () { @@ -50,6 +50,13 @@ describe('YieldmoAdapter', function () { expect(request.url).to.be.equal(ENDPOINT); }); + it('should not blow up if crumbs is undefined', function () { + let bidArray = [ + { ...bid, crumbs: undefined } + ] + expect(function () { spec.buildRequests(bidArray) }).not.to.throw() + }) + it('should place bid information into the p parameter of data', function () { let placementInfo = spec.buildRequests(bidArray).data.p; expect(placementInfo).to.equal('[{"placement_id":"adunit-code","callback_id":"30b31c1838de1e","sizes":[[300,250],[300,600]]}]');