diff --git a/src/prebid.js b/src/prebid.js index ee511e5378b..bf11f56d5dd 100644 --- a/src/prebid.js +++ b/src/prebid.js @@ -935,9 +935,11 @@ pbjsInstance.getAllWinningBids = function () { /** * Get all of the bids that have won their respective auctions. - * @return {Array} A list of bids that have won their respective auctions. + * @deprecated + * @return {Array} A list of bids that have won their respective auctions but failed to win the ad server auction. */ pbjsInstance.getAllPrebidWinningBids = function () { + logWarn('getAllPrebidWinningBids may be removed or renamed in a future version. This function returns bids that have won in prebid and have had targeting set but have not (yet?) won in the ad server. It excludes bids that have been rendered.'); return auctionManager.getBidsReceived() .filter(bid => bid.status === BID_STATUS.BID_TARGETING_SET); }; diff --git a/test/spec/unit/pbjs_api_spec.js b/test/spec/unit/pbjs_api_spec.js index 659f3599248..4827f8f7d21 100644 --- a/test/spec/unit/pbjs_api_spec.js +++ b/test/spec/unit/pbjs_api_spec.js @@ -3874,15 +3874,18 @@ describe('Unit: Prebid Module', function () { describe('getAllPrebidWinningBids', function () { let auctionManagerStub; + let logWarnSpy; beforeEach(function () { auctionManagerStub = sinon.stub(auctionManager, 'getBidsReceived'); + logWarnSpy = sandbox.spy(utils, 'logWarn'); }); afterEach(function () { auctionManagerStub.restore(); + logWarnSpy.restore(); }); - it('should return prebid auction winning bids', function () { + it('should warn and return prebid auction winning bids', function () { let bidsReceived = [ createBidReceived({bidder: 'appnexus', cpm: 7, auctionId: 1, responseTimestamp: 100, adUnitCode: 'code-0', adId: 'adid-1', status: 'targetingSet', requestId: 'reqid-1'}), createBidReceived({bidder: 'rubicon', cpm: 6, auctionId: 1, responseTimestamp: 101, adUnitCode: 'code-1', adId: 'adid-2', requestId: 'reqid-2'}), @@ -3892,8 +3895,9 @@ describe('Unit: Prebid Module', function () { auctionManagerStub.returns(bidsReceived) let bids = $$PREBID_GLOBAL$$.getAllPrebidWinningBids(); - expect(bids.length).to.equal(1); sandbox + expect(bids.length).to.equal(1); expect(bids[0].adId).to.equal('adid-1'); + sinon.assert.calledOnce(logWarnSpy); }); });