From a21ca1c67d243673a255bd2222463363509fa37e Mon Sep 17 00:00:00 2001 From: Demetrio Girardi Date: Mon, 18 Sep 2023 14:54:32 -0700 Subject: [PATCH] Core: fix bug where the PBS adapter always times out (#10501) --- src/adapterManager.js | 2 +- test/spec/unit/core/adapterManager_spec.js | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/adapterManager.js b/src/adapterManager.js index 554fde21734..93cbb8a071b 100644 --- a/src/adapterManager.js +++ b/src/adapterManager.js @@ -422,7 +422,7 @@ adapterManager.callBids = (adUnits, bidRequests, addBidResponse, doneCb, request bidRequest.start = timestamp(); return function () { onTimelyResponse(bidRequest.bidderRequestId); - doneCbs.apply(bidRequest, arguments); + doneCb.apply(bidRequest, arguments); } }); diff --git a/test/spec/unit/core/adapterManager_spec.js b/test/spec/unit/core/adapterManager_spec.js index cff26df2e4d..98d841d9c7c 100644 --- a/test/spec/unit/core/adapterManager_spec.js +++ b/test/spec/unit/core/adapterManager_spec.js @@ -965,13 +965,23 @@ describe('adapterManager tests', function () { }]; it('invokes callBids on the S2S adapter', function () { + const done = sinon.stub(); + const onTimelyResponse = sinon.stub(); + prebidServerAdapterMock.callBids.callsFake((_1, _2, _3, done) => { + done(); + }); adapterManager.callBids( getAdUnits(), bidRequests, () => {}, - () => () => {} + done, + undefined, + undefined, + onTimelyResponse ); sinon.assert.calledTwice(prebidServerAdapterMock.callBids); + sinon.assert.calledTwice(done); + bidRequests.forEach(br => sinon.assert.calledWith(onTimelyResponse, br.bidderRequestId)); }); // Enable this test when prebidServer adapter is made 1.0 compliant