Skip to content

Commit

Permalink
A4G Bid Adapter: add meta adomain (prebid#6878)
Browse files Browse the repository at this point in the history
* A4G adapter: add meta.advertiserDomains

* added another test
  • Loading branch information
Junus authored and agrandes-tappx committed Sep 29, 2021
1 parent ddc5be5 commit dbac2ef
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
5 changes: 4 additions & 1 deletion modules/a4gBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ export const spec = {
currency: A4G_CURRENCY,
netRevenue: true,
ttl: A4G_TTL,
ad: response.ad
ad: response.ad,
meta: {
advertiserDomains: response.adomain && response.adomain.length > 0 ? response.adomain : []
}
};
bidResponses.push(bidResponse);
}
Expand Down
22 changes: 19 additions & 3 deletions test/spec/modules/a4gBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,11 @@ describe('a4gAdapterTests', function () {
ad: 'test ad',
currency: 'USD',
ttl: 120,
netRevenue: true
netRevenue: true,
meta: {
advertiserDomains: []
}

}
];
const result = spec.interpretResponse(bidResponse, bidRequest);
Expand All @@ -181,7 +185,10 @@ describe('a4gAdapterTests', function () {
ad: 'test ad',
currency: 'USD',
ttl: 120,
netRevenue: true
netRevenue: true,
meta: {
advertiserDomains: []
}
}
];
const result = spec.interpretResponse(bidResponseWithoutCrid, bidRequest);
Expand All @@ -201,7 +208,8 @@ describe('a4gAdapterTests', function () {
'currency',
'netRevenue',
'ttl',
'ad'
'ad',
'meta'
];

let resultKeys = Object.keys(result[0]);
Expand All @@ -215,5 +223,13 @@ describe('a4gAdapterTests', function () {

expect(result[0].requestId).to.not.equal(result[0].adId);
})

it('advertiserDomains is included when sent by server', function () {
bidResponse.body[0].adomain = ['test_adomain'];
let response = spec.interpretResponse(bidResponse, bidRequest);
expect(Object.keys(response[0].meta)).to.include.members(['advertiserDomains']);
expect(response[0].meta.advertiserDomains).to.deep.equal(['test_adomain']);
delete bidResponse.body[0].adomain;
});
});
});

0 comments on commit dbac2ef

Please sign in to comment.