Skip to content

Commit

Permalink
Concert Bid Adapter: Add dealId Property to Bid Responses (#22)
Browse files Browse the repository at this point in the history
* adds dealid property to bid responses

* updates tests

* use first bid for tests

* adds dealid at the correct level
  • Loading branch information
BrettBlox authored May 28, 2024
1 parent c13d1e1 commit e197133
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/concertBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ export const spec = {
meta: { advertiserDomains: bid && bid.adomain ? bid.adomain : [] },
creativeId: bid.creativeId,
netRevenue: bid.netRevenue,
currency: bid.currency
currency: bid.currency,
...(bid.dealid && { dealId: bid.dealid }),
};
});

Expand Down
16 changes: 16 additions & 0 deletions test/spec/modules/concertBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,22 @@ describe('ConcertAdapter', function () {
});
});

it('should include dealId when present in bidResponse', function() {
const bids = spec.interpretResponse({
body: {
bids: [
{ ...bidResponse.body.bids[0], dealid: 'CON-123' }
]
}
}, bidRequest);
expect(bids[0]).to.have.property('dealId');
});

it('should exclude dealId when absent in bidResponse', function() {
const bids = spec.interpretResponse(bidResponse, bidRequest);
expect(bids[0]).to.not.have.property('dealId');
});

it('should return empty bids if there is no response from server', function() {
const bids = spec.interpretResponse({ body: null }, bidRequest);
expect(bids).to.have.lengthOf(0);
Expand Down

0 comments on commit e197133

Please sign in to comment.