Skip to content

Commit

Permalink
add bid ttl to cache call (prebid#3163)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkendall07 authored and Isaac Dettman committed Nov 12, 2018
1 parent 0c49c73 commit aa8b2ef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/videoCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ function toStorageRequest(bid) {
const vastValue = bid.vastXml ? bid.vastXml : wrapURI(bid.vastUrl, bid.vastImpUrl);
return {
type: 'xml',
value: vastValue
value: vastValue,
ttlseconds: Number(bid.ttl)
};
}

Expand Down
7 changes: 4 additions & 3 deletions test/spec/videoCache_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ describe('The video cache', function () {
</Wrapper>
</Ad>
</VAST>`;
assertRequestMade({ vastUrl: 'my-mock-url.com' }, expectedValue)
assertRequestMade({ vastUrl: 'my-mock-url.com', ttl: 25 }, expectedValue)
});

it('should make the expected request when store() is called on an ad with a vastUrl and a vastImpUrl', function () {
Expand All @@ -114,12 +114,12 @@ describe('The video cache', function () {
</Wrapper>
</Ad>
</VAST>`;
assertRequestMade({ vastUrl: 'my-mock-url.com', vastImpUrl: 'imptracker.com' }, expectedValue)
assertRequestMade({ vastUrl: 'my-mock-url.com', vastImpUrl: 'imptracker.com', ttl: 25 }, expectedValue)
});

it('should make the expected request when store() is called on an ad with vastXml', function () {
const vastXml = '<VAST version="3.0"></VAST>';
assertRequestMade({ vastXml: vastXml }, vastXml);
assertRequestMade({ vastXml: vastXml, ttl: 25 }, vastXml);
});

function assertRequestMade(bid, expectedValue) {
Expand All @@ -134,6 +134,7 @@ describe('The video cache', function () {
puts: [{
type: 'xml',
value: expectedValue,
ttlseconds: 25
}],
});
}
Expand Down

0 comments on commit aa8b2ef

Please sign in to comment.