Skip to content

Commit

Permalink
Currency module: Don't block 'responsesReady' when rates are present …
Browse files Browse the repository at this point in the history
…and no conversion is done (#10736)

* Currency module: Don't block 'responsesReady' when rates are present and no conversion is needed

* Add test case for currency unnecessarily blocking auctions

* Update currency_spec.js

---------

Co-authored-by: Demetrio Girardi <[email protected]>
  • Loading branch information
samuel-palmer-relevant-digital and dgirardi authored Nov 27, 2023
1 parent ecf4272 commit 8993f74
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions modules/currency.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ function loadRates() {
}
}
);
} else {
processBidResponseQueue();
}
}

Expand Down
13 changes: 13 additions & 0 deletions test/spec/modules/currency_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,19 @@ describe('currency', function () {
expect(innerBid.getCpmInNewCurrency('JPY')).to.equal('100.000');
});

it('does not block auctions if rates do not need to be fetched', () => {
sandbox.stub(responseReady, 'resolve');
setConfig({
adServerCurrency: 'USD',
rates: {
USD: {
JPY: 100
}
}
});
sinon.assert.called(responseReady.resolve);
})

it('uses rates specified in json when provided and consider boosted bid', function () {
setConfig({
adServerCurrency: 'USD',
Expand Down

0 comments on commit 8993f74

Please sign in to comment.