Skip to content

Commit

Permalink
AdagioBidAdapter: remove auctionId override
Browse files Browse the repository at this point in the history
  • Loading branch information
Abyfall committed Jul 10, 2024
1 parent 8287d77 commit c7d6472
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
1 change: 0 additions & 1 deletion modules/adagioBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,6 @@ export const spec = {
// Those params are not sent to the server.
// They are used for further operations on analytics adapter.
validBidRequests.forEach(rawBidRequest => {
rawBidRequest.params.adagioAuctionId = aucId
rawBidRequest.params.pageviewId = pageviewId
});

Expand Down
31 changes: 25 additions & 6 deletions test/spec/modules/adagioBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,6 @@ describe('Adagio bid adapter', () => {
it('should send bid request to ENDPOINT_PB via POST', function() {
sandbox.stub(_internal, 'getDevice').returns({ a: 'a' });
sandbox.stub(_internal, 'getSite').returns({ domain: 'adagio.io', 'page': 'https://adagio.io/hb' });
// sandbox.stub(_internal, 'getPageviewId').returns('1234-567');
// sandbox.stub(utils, 'generateUUID').returns('blabla');

const bid01 = new BidRequestBuilder().withParams().build();
const bidderRequest = new BidderRequestBuilder().build();
Expand All @@ -292,7 +290,31 @@ describe('Adagio bid adapter', () => {
expect(requests[0].data).to.have.all.keys(expectedDataKeys);
});

it('should use a custom generated auctionId and remove transactionId', function() {
it('should use a custom generated auctionId from ortb2.site.ext.data.adg_rtd.uid when available', function() {
const expectedAuctionId = '373bcda7-9794-4f1c-be2c-0d223d11d579'

const bid01 = new BidRequestBuilder().withParams().build();
let ortb = {
ortb2: {
site: {
ext: {
data: {
adg_rtd: {
uid: expectedAuctionId
}
}
}
}
}
}
const bidderRequest = new BidderRequestBuilder(ortb).build();

const requests = spec.buildRequests([bid01], bidderRequest);
expect(requests[0].data.adUnits[0].auctionId).eq(expectedAuctionId);
expect(requests[0].data.adUnits[0].transactionId).to.not.exist;
});

it('should use a custom generated auctionId when ortb2.site.ext.data.adg_rtd.uid is absent and remove transactionId', function() {
const expectedAuctionId = '373bcda7-9794-4f1c-be2c-0d223d11d579'
sandbox.stub(utils, 'generateUUID').returns(expectedAuctionId);

Expand All @@ -305,17 +327,14 @@ describe('Adagio bid adapter', () => {
});

it('should enrich prebid bid requests params', function() {
const expectedAuctionId = '373bcda7-9794-4f1c-be2c-0d223d11d579'
const expectedPageviewId = '56befc26-8cf0-472d-b105-73896df8eb89';
sandbox.stub(utils, 'generateUUID').returns(expectedAuctionId);
sandbox.stub(_internal, 'getAdagioNs').returns({ pageviewId: expectedPageviewId });

const bid01 = new BidRequestBuilder().withParams().build();
const bidderRequest = new BidderRequestBuilder().build();

spec.buildRequests([bid01], bidderRequest);

expect(bid01.params.adagioAuctionId).eq(expectedAuctionId);
expect(bid01.params.pageviewId).eq(expectedPageviewId);
});

Expand Down

0 comments on commit c7d6472

Please sign in to comment.