Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust TTL for MANTIS adapter #3676

Merged
merged 2 commits into from
Mar 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions modules/mantisBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ function buildMantisUrl(path, data, domain) {
tz: new Date().getTimezoneOffset(),
buster: new Date().getTime(),
secure: isSecure(),
version: 8
version: 9
};
if (!inIframe() || isAmp()) {
params.mobile = !isAmp() && isDesktop(true) ? 'false' : 'true';
Expand Down Expand Up @@ -252,7 +252,7 @@ const spec = {
width: ad.width,
height: ad.height,
ad: ad.html,
ttl: 86400,
ttl: ad.ttl || serverResponse.body.ttl || 86400,
creativeId: ad.view,
netRevenue: true,
currency: 'USD'
Expand Down
75 changes: 75 additions & 0 deletions test/spec/modules/mantisBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,81 @@ describe('MantisAdapter', function () {
});

describe('interpretResponse', function () {
it('use ad ttl if provided', function () {
let response = {
body: {
ttl: 360,
uuid: 'uuid',
ads: [
{
bid: 'bid',
cpm: 1,
view: 'view',
width: 300,
ttl: 250,
height: 250,
html: '<!-- Creative -->'
}
]
}
};

let expectedResponse = [
{
requestId: 'bid',
cpm: 1,
width: 300,
height: 250,
ttl: 250,
ad: '<!-- Creative -->',
creativeId: 'view',
netRevenue: true,
currency: 'USD'
}
];
let bidderRequest;

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

it('use global ttl if provded', function () {
let response = {
body: {
ttl: 360,
uuid: 'uuid',
ads: [
{
bid: 'bid',
cpm: 1,
view: 'view',
width: 300,
height: 250,
html: '<!-- Creative -->'
}
]
}
};

let expectedResponse = [
{
requestId: 'bid',
cpm: 1,
width: 300,
height: 250,
ttl: 360,
ad: '<!-- Creative -->',
creativeId: 'view',
netRevenue: true,
currency: 'USD'
}
];
let bidderRequest;

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

it('display ads returned', function () {
let response = {
body: {
Expand Down