Skip to content

Commit

Permalink
add global clearAllAuctions method (prebid#11912)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoschovas authored and DecayConstant committed Jul 18, 2024
1 parent d352f98 commit 15455b0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/prebid.js
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,10 @@ pbjsInstance.getHighestCpmBids = function (adUnitCode) {
return targeting.getWinningBids(adUnitCode);
};

pbjsInstance.clearAllAuctions = function () {
auctionManager.clearAllAuctions();
};

if (FEATURES.VIDEO) {
/**
* Mark the winning bid as used, should only be used in conjunction with video
Expand Down
11 changes: 11 additions & 0 deletions test/spec/unit/pbjs_api_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3757,4 +3757,15 @@ describe('Unit: Prebid Module', function () {
sinon.assert.calledOnce(adapterManager.callBidBillableBidder);
});
});

describe('clearAllAuctions', () => {
after(() => {
resetAuction();
});
it('clears auction data', function () {
expect(auctionManager.getBidsReceived().length).to.not.equal(0);
$$PREBID_GLOBAL$$.clearAllAuctions();
expect(auctionManager.getBidsReceived().length).to.equal(0);
});
});
});

0 comments on commit 15455b0

Please sign in to comment.