Skip to content
Closed
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
2 changes: 2 additions & 0 deletions modules/seedtagBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { _map, getWinDimensions, isArray, triggerPixel } from '../src/utils.js';
import { getViewportCoordinates } from '../libraries/viewport/viewport.js';
import { getConnectionInfo } from '../libraries/connectionInfo/connectionUtils.js';
import { isAutoplayEnabled } from '../libraries/autoplayDetection/autoplay.js';
import { getAdUnitElement } from '../src/utils/adUnits.js';

/**
Expand Down Expand Up @@ -59,10 +60,10 @@
switch (connectionType) {
case 'wifi':
case 'ethernet':
return deviceConnection.FIXED;

Check warning on line 63 in modules/seedtagBidAdapter.js

View workflow job for this annotation

GitHub Actions / Coverage

63 line is not covered with tests
case 'cellular':
case 'wimax':
return deviceConnection.MOBILE;

Check warning on line 66 in modules/seedtagBidAdapter.js

View workflow job for this annotation

GitHub Actions / Coverage

66 line is not covered with tests
default:
const isMobile =
/iPad|iPhone|iPod/.test(navigator.userAgent) ||
Expand All @@ -74,7 +75,7 @@
function mapMediaType(seedtagMediaType) {
if (seedtagMediaType === 'display') return BANNER;
if (seedtagMediaType === 'video') return VIDEO;
else return seedtagMediaType;

Check warning on line 78 in modules/seedtagBidAdapter.js

View workflow job for this annotation

GitHub Actions / Coverage

78 line is not covered with tests
}

function hasVideoMediaType(bid) {
Expand Down Expand Up @@ -199,12 +200,12 @@
return Math.round(entry.responseStart - entry.startTime);
} catch (e) {
// Timing API V1
try {
const entry = performance.timing;
return Math.round(entry.responseStart - entry.fetchStart);

Check warning on line 205 in modules/seedtagBidAdapter.js

View workflow job for this annotation

GitHub Actions / Coverage

203-205 lines are not covered with tests
} catch (e) {
// Timing API not available
return 0;

Check warning on line 208 in modules/seedtagBidAdapter.js

View workflow job for this annotation

GitHub Actions / Coverage

208 line is not covered with tests
}
}
})();
Expand Down Expand Up @@ -282,7 +283,7 @@
} else if (hasBanner) {
return hasMandatoryDisplayParams(bid);
} else {
return false;

Check warning on line 286 in modules/seedtagBidAdapter.js

View workflow job for this annotation

GitHub Actions / Coverage

286 line is not covered with tests
}
},

Expand All @@ -304,6 +305,7 @@
timeout: bidderRequest.timeout,
version: '$prebid.version$',
connectionType: getConnectionType(),
autoplay: isAutoplayEnabled(),
auctionStart: bidderRequest.auctionStart || Date.now(),
ttfb: ttfb(),
bidRequests: _map(validBidRequests, buildBidRequest),
Expand Down
21 changes: 21 additions & 0 deletions test/spec/modules/seedtagBidAdapter_spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { expect } from 'chai';
import { getTimeoutUrl, spec, BIDFLOOR_CURRENCY } from 'modules/seedtagBidAdapter.js';
import * as utils from 'src/utils.js';
import * as autoplay from 'libraries/autoplayDetection/autoplay.js';
import * as mockGpt from 'test/spec/integration/faker/googletag.js';
import * as adUnits from 'src/utils/adUnits';

Expand Down Expand Up @@ -750,6 +751,26 @@ describe('Seedtag Adapter', function () {
expect(data.ortb).to.be.undefined;
});
});

describe('autoplay param', function () {
let isAutoplayEnabledStub;

afterEach(function () {
isAutoplayEnabledStub.restore();
});

it('should send autoplay = true when autoplay is not forbidden', function () {
isAutoplayEnabledStub = sinon.stub(autoplay, 'isAutoplayEnabled').returns(true);
const data = JSON.parse(spec.buildRequests(validBidRequests, bidderRequest).data);
expect(data.autoplay).to.equal(true);
});

it('should send autoplay = false when autoplay is forbidden', function () {
isAutoplayEnabledStub = sinon.stub(autoplay, 'isAutoplayEnabled').returns(false);
const data = JSON.parse(spec.buildRequests(validBidRequests, bidderRequest).data);
expect(data.autoplay).to.equal(false);
});
});
});
describe('interpret response method', function () {
it('should return a void array, when the server response are not correct.', function () {
Expand Down
Loading