Skip to content

Commit

Permalink
configurable TTL for impressions (#5880)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrosendahl committed Oct 21, 2020
1 parent 73d880f commit d3c0ded
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 8 deletions.
2 changes: 1 addition & 1 deletion modules/sovrnBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export const spec = {
netRevenue: true,
mediaType: BANNER,
ad: decodeURIComponent(`${sovrnBid.adm}<img src="${sovrnBid.nurl}">`),
ttl: 60
ttl: sovrnBid.ttl || 90
});
});
}
Expand Down
35 changes: 28 additions & 7 deletions test/spec/modules/sovrnBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,16 +331,16 @@ describe('sovrnBidAdapter', function() {
'currency': 'USD',
'netRevenue': true,
'mediaType': 'banner',
'ad': decodeURIComponent(`<!-- Creative --><img src=<!-- NURL -->>`),
'ttl': 60000
'ad': decodeURIComponent(`<!-- Creative --><img src="<!-- NURL -->">`),
'ttl': 90
}];

let result = spec.interpretResponse(response);
expect(Object.keys(result[0])).to.deep.equal(Object.keys(expectedResponse[0]));
expect(result[0]).to.deep.equal(expectedResponse[0]);
});

it('should get correct bid response when dealId is passed', function () {
response.body.dealid = 'baking';
response.body.seatbid[0].bid[0].dealid = 'baking';

let expectedResponse = [{
'requestId': '263c448586f5a1',
Expand All @@ -352,12 +352,33 @@ describe('sovrnBidAdapter', function() {
'currency': 'USD',
'netRevenue': true,
'mediaType': 'banner',
'ad': decodeURIComponent(`<!-- Creative --><img src=<!-- NURL -->>`),
'ttl': 60000
'ad': decodeURIComponent(`<!-- Creative --><img src="<!-- NURL -->">`),
'ttl': 90
}];

let result = spec.interpretResponse(response);
expect(Object.keys(result[0])).to.deep.equal(Object.keys(expectedResponse[0]));
expect(result[0]).to.deep.equal(expectedResponse[0]);
});

it('should get correct bid response when ttl is set', function () {
response.body.seatbid[0].bid[0].ttl = 480;

let expectedResponse = [{
'requestId': '263c448586f5a1',
'cpm': 0.45882675,
'width': 728,
'height': 90,
'creativeId': 'creativelycreatedcreativecreative',
'dealId': null,
'currency': 'USD',
'netRevenue': true,
'mediaType': 'banner',
'ad': decodeURIComponent(`<!-- Creative --><img src="<!-- NURL -->">`),
'ttl': 480
}];

let result = spec.interpretResponse(response);
expect(result[0]).to.deep.equal(expectedResponse[0]);
});

it('handles empty bid response', function () {
Expand Down

0 comments on commit d3c0ded

Please sign in to comment.