Skip to content

Commit 57f7453

Browse files
authored
add global clearAllAuctions method (#11912)
1 parent 6a85621 commit 57f7453

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/prebid.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -869,6 +869,10 @@ pbjsInstance.getHighestCpmBids = function (adUnitCode) {
869869
return targeting.getWinningBids(adUnitCode);
870870
};
871871

872+
pbjsInstance.clearAllAuctions = function () {
873+
auctionManager.clearAllAuctions();
874+
};
875+
872876
if (FEATURES.VIDEO) {
873877
/**
874878
* Mark the winning bid as used, should only be used in conjunction with video

test/spec/unit/pbjs_api_spec.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3757,4 +3757,15 @@ describe('Unit: Prebid Module', function () {
37573757
sinon.assert.calledOnce(adapterManager.callBidBillableBidder);
37583758
});
37593759
});
3760+
3761+
describe('clearAllAuctions', () => {
3762+
after(() => {
3763+
resetAuction();
3764+
});
3765+
it('clears auction data', function () {
3766+
expect(auctionManager.getBidsReceived().length).to.not.equal(0);
3767+
$$PREBID_GLOBAL$$.clearAllAuctions();
3768+
expect(auctionManager.getBidsReceived().length).to.equal(0);
3769+
});
3770+
});
37603771
});

0 commit comments

Comments
 (0)