diff --git a/integrationExamples/gpt/hello_world_adikteev.html b/integrationExamples/gpt/hello_world_adikteev.html index 7372ff12d7f..4603b9321f0 100644 --- a/integrationExamples/gpt/hello_world_adikteev.html +++ b/integrationExamples/gpt/hello_world_adikteev.html @@ -21,12 +21,10 @@ } }, bids: [{ - bidder: 'adikteev', - params: { - placementId: 13144370, - stagingEnvironment: true, - bidFloorPrice: 0.1, - } + bidder: 'adikteev', + params: { + placementId: 4567, + } }] }]; diff --git a/modules/adikteevBidAdapter.js b/modules/adikteevBidAdapter.js index 12d502de94a..b997087802b 100644 --- a/modules/adikteevBidAdapter.js +++ b/modules/adikteevBidAdapter.js @@ -1,27 +1,169 @@ import {registerBidder} from 'src/adapters/bidderFactory'; import {BANNER} from 'src/mediaTypes'; import * as utils from '../src/utils'; -import {config} from 'src/config'; +import {config} from '../src/config'; export const BIDDER_CODE = 'adikteev'; -export const ENDPOINT_URL = 'https://serve-adserver.adikteev.com/api/prebid/bid'; -export const ENDPOINT_URL_STAGING = 'https://serve-adserver-staging.adikteev.com/api/prebid/bid'; -export const USER_SYNC_IFRAME_URL = 'https://serve-adserver.adikteev.com/api/prebid/sync-iframe'; -export const USER_SYNC_IFRAME_URL_STAGING = 'https://serve-adserver-staging.adikteev.com/api/prebid/sync-iframe'; -export const USER_SYNC_IMAGE_URL = 'https://serve-adserver.adikteev.com/api/prebid/sync-image'; -export const USER_SYNC_IMAGE_URL_STAGING = 'https://serve-adserver-staging.adikteev.com/api/prebid/sync-image'; +export const AK_PBJS_VERSION = '1.35.0'; -export let stagingEnvironmentSwitch = false; // Don't use it. Allow us to make tests on staging +export const AK_BASE_URL = 'https://prebid.adikteev.com'; +export const AK_BASE_URL_STAGING = 'https://prebid-staging.adikteev.com'; +export const AK_BASE_URL_DEVELOPMENT = 'http://localhost:3000'; -export function setstagingEnvironmentSwitch(value) { - stagingEnvironmentSwitch = value; -} +export const ENDPOINT_PATH = '/api/prebid/bid'; +export const USER_SYNC_IFRAME_URL_PATH = '/api/prebid/sync-iframe'; +export const USER_SYNC_IMAGE_URL_PATH = '/api/prebid/sync-image'; + +export const PRODUCTION = 'production'; +export const STAGING = 'staging'; +export const DEVELOPMENT = 'development'; +export const DEFAULT_ENV = PRODUCTION; + +export const conformBidRequest = bidRequest => { + return { + params: bidRequest.params, + crumbs: bidRequest.crumbs, + sizes: bidRequest.sizes, + bidId: bidRequest.bidId, + bidderRequestId: bidRequest.bidderRequestId, + }; +}; + +export const akDebug = (parameterDebug, configDebug) => { + if (parameterDebug && parameterDebug.length && parameterDebug.length > 0) return JSON.parse(parameterDebug); + else if (configDebug) return configDebug; + else return false; +}; + +export const akEnv = (parameterAkEnv, configAkEnv) => { + if (utils.contains([PRODUCTION, STAGING, DEVELOPMENT], parameterAkEnv)) return parameterAkEnv; + else if (utils.contains([PRODUCTION, STAGING, DEVELOPMENT], configAkEnv)) return configAkEnv; + else return DEFAULT_ENV; +}; + +export const akOverrides = (parameterAkOverrides, configAkOverrides) => { + if (parameterAkOverrides && parameterAkOverrides.length !== 0) { + let parsedParams = null; + try { + parsedParams = JSON.parse(parameterAkOverrides); + } catch (error) { + parsedParams = null; + } + if (parsedParams) return parsedParams; + } + if (configAkOverrides && Object.keys(configAkOverrides).length !== 0) return configAkOverrides; + else return {}; +}; + +export const akUrl = (environment) => { + switch (environment) { + case DEVELOPMENT: + return AK_BASE_URL_DEVELOPMENT; + case STAGING: + return AK_BASE_URL_STAGING; + default: + return AK_BASE_URL; + } +}; + +export const endpointUrl = (parameterAkEnv, configAkEnv) => akUrl(akEnv(parameterAkEnv, configAkEnv)).concat(ENDPOINT_PATH); +export const userSyncIframeUrl = (parameterAkEnv, configAkEnv) => akUrl(akEnv(parameterAkEnv, configAkEnv)).concat(USER_SYNC_IFRAME_URL_PATH); +export const userSyncImageUrl = (parameterAkEnv, configAkEnv) => akUrl(akEnv(parameterAkEnv, configAkEnv)).concat(USER_SYNC_IMAGE_URL_PATH); + +export const getViewDimensions = () => { + let w = window; + let prefix = 'inner'; + + if (window.innerWidth === undefined || window.innerWidth === null) { + w = document.documentElement || document.body; + prefix = 'client'; + } + + return { + width: w[`${prefix}Width`], + height: w[`${prefix}Height`], + }; +}; -function validateSizes(sizes) { - if (!utils.isArray(sizes) || typeof sizes[0] === 'undefined') { +export const getDeviceDimensions = () => { + return { + width: window.screen ? window.screen.width : '', + height: window.screen ? window.screen.height : '', + }; +}; + +export const getDocumentDimensions = () => { + const de = document.documentElement; + const be = document.body; + + const bodyHeight = be ? Math.max(be.offsetHeight, be.scrollHeight) : 0; + + const w = Math.max(de.clientWidth, de.offsetWidth, de.scrollWidth); + const h = Math.max( + de.clientHeight, + de.offsetHeight, + de.scrollHeight, + bodyHeight + ); + + return { + width: isNaN(w) ? '' : w, + height: isNaN(h) ? '' : h, + }; +}; + +export const isWebGLEnabled = () => { + // Create test canvas + let canvas = document.createElement('canvas'); + + // The gl context + let gl = null; + + // Try to get the regular WebGL + try { + gl = canvas.getContext('webgl'); + } catch (ex) { + canvas = undefined; return false; } - return sizes.every(size => utils.isArray(size) && size.length === 2); + + // No regular WebGL found + if (!gl) { + // Try experimental WebGL + try { + gl = canvas.getContext('experimental-webgl'); + } catch (ex) { + canvas = undefined; + return false; + } + } + + return !!gl; +}; + +export const getDeviceInfo = (deviceDimensions, viewDimensions, documentDimensions, webGL) => { + return { + browserWidth: viewDimensions.width, + browserHeight: viewDimensions.height, + deviceWidth: deviceDimensions.width, + deviceHeight: deviceDimensions.height, + documentWidth: documentDimensions.width, + documentHeight: documentDimensions.height, + webGL: webGL, + }; +}; + +const validateSizes = sizes => utils.isArray(sizes) && sizes.some(size => utils.isArray(size) && size.length === 2); + +export function conformCookies(documentCookie) { + return documentCookie + .split('; ') + .filter(i => i.indexOf('=') !== -1) + .reduce((acc, kv) => { + const [k, v] = kv.split('='); + acc[k] = v; + return acc; + }, {}); } export const spec = { @@ -29,11 +171,9 @@ export const spec = { supportedMediaTypes: [BANNER], isBidRequestValid: (bid) => { - setstagingEnvironmentSwitch(stagingEnvironmentSwitch || !!bid.params.stagingEnvironment); return !!( bid && bid.params && - bid.params.bidFloorPrice && bid.params.placementId && bid.bidder === BIDDER_CODE && validateSizes(bid.mediaTypes.banner.sizes) @@ -41,51 +181,43 @@ export const spec = { }, buildRequests: (validBidRequests, bidderRequest) => { - const payload = { - validBidRequests, - bidderRequest, - refererInfo: bidderRequest.refererInfo, - currency: config.getConfig('currency'), - userAgent: navigator.userAgent, - screen: { - width: window.screen.width, - height: window.screen.height + const payload = Object.assign({}, + { + akPbjsVersion: AK_PBJS_VERSION, + bidRequests: validBidRequests.map(conformBidRequest), + cookies: conformCookies(document.cookie), + currency: config.getConfig('currency'), + debug: akDebug(utils.getParameterByName('akDebug'), config.getConfig('akDebug')), + language: navigator.language, + refererInfo: bidderRequest.refererInfo, + deviceInfo: getDeviceInfo(getDeviceDimensions(), getViewDimensions(), getDocumentDimensions(), isWebGLEnabled()), + userAgent: navigator.userAgent, }, - language: navigator.language, - cookies: document.cookie.split(';'), - prebidUpdateVersion: '1.29.0', - }; + akOverrides(utils.getParameterByName('akOverrides'), config.getConfig('akOverrides'))); + return { method: 'POST', - url: stagingEnvironmentSwitch ? ENDPOINT_URL_STAGING : ENDPOINT_URL, + url: endpointUrl(utils.getParameterByName('akEnv'), config.getConfig('akEnv')), data: JSON.stringify(payload), }; }, - interpretResponse: (serverResponse, bidRequests) => { - const returnedBids = []; - const validBidRequests = JSON.parse(bidRequests.data).validBidRequests; - serverResponse.body.forEach((value, index) => { - const overrides = { - requestId: validBidRequests[index].bidId, - }; - returnedBids.push(Object.assign({}, value, overrides)); - }); - return returnedBids; - }, + interpretResponse: (serverResponse) => serverResponse.body, getUserSyncs: (syncOptions, serverResponses) => { + const parameterAkEnv = utils.getParameterByName('akEnv'); + const configAkEnv = config.getConfig('akEnv'); const syncs = []; if (syncOptions.iframeEnabled) { syncs.push({ type: 'iframe', - url: stagingEnvironmentSwitch ? USER_SYNC_IFRAME_URL_STAGING : USER_SYNC_IFRAME_URL, + url: userSyncIframeUrl(parameterAkEnv, configAkEnv), }); } if (syncOptions.pixelEnabled && serverResponses.length > 0) { syncs.push({ type: 'image', - url: stagingEnvironmentSwitch ? USER_SYNC_IMAGE_URL_STAGING : USER_SYNC_IMAGE_URL, + url: userSyncImageUrl(parameterAkEnv, configAkEnv), }); } return syncs; diff --git a/modules/adikteevBidAdapter.md b/modules/adikteevBidAdapter.md index d5008f61b03..651831c82c9 100644 --- a/modules/adikteevBidAdapter.md +++ b/modules/adikteevBidAdapter.md @@ -18,15 +18,14 @@ Module that connects to Adikteev's demand sources code: 'test-div', mediaTypes: { banner: { - sizes: [[750, 200]], // a display size + sizes: [[750, 200]], } }, bids: [ { bidder: 'adikteev', params: { - placementId: 12345, - bidFloorPrice: 0.1, + placementId: 12345 } } ] diff --git a/test/spec/modules/adikteevBidAdapter_spec.js b/test/spec/modules/adikteevBidAdapter_spec.js index 243cbe2a9c5..e87a85b2b96 100644 --- a/test/spec/modules/adikteevBidAdapter_spec.js +++ b/test/spec/modules/adikteevBidAdapter_spec.js @@ -1,17 +1,72 @@ import {expect} from 'chai'; import { - ENDPOINT_URL, - ENDPOINT_URL_STAGING, - setstagingEnvironmentSwitch, + AK_PBJS_VERSION, + AK_BASE_URL, + AK_BASE_URL_STAGING, + akDebug, + akEnv, + akOverrides, + akUrl, + conformBidRequest, + conformCookies, + DEFAULT_ENV, + ENDPOINT_PATH, + endpointUrl, + PRODUCTION, spec, - stagingEnvironmentSwitch, - USER_SYNC_IFRAME_URL, - USER_SYNC_IFRAME_URL_STAGING, - USER_SYNC_IMAGE_URL, - USER_SYNC_IMAGE_URL_STAGING, + STAGING, + USER_SYNC_IFRAME_URL_PATH, + USER_SYNC_IMAGE_URL_PATH, + userSyncIframeUrl, + userSyncImageUrl, } from 'modules/adikteevBidAdapter'; import {newBidder} from 'src/adapters/bidderFactory'; -import * as utils from '../../../src/utils'; +import {config} from '../../../src/config'; + +const cannedValidBidRequests = [{ + adUnitCode: '/19968336/header-bid-tag-1', + auctionId: 'fcbf2b27-a951-496f-b5bb-1324ce7c0558', + bidId: '2b8de6572e8193', + bidRequestsCount: 1, + bidder: 'adikteev', + bidderRequestId: '1203b39fecc6a5', + crumbs: {pubcid: 'f3371d16-4e8b-42b5-a770-7e5be1fdf03d'}, + params: {placementId: 4567}, + sizes: [[300, 250], [250, 300], [300, 600]], + transactionId: '58dbd732-7a39-45f1-b23e-1c24051a941c', +}]; +const cannedBidderRequest = { + auctionId: 'fcbf2b27-a951-496f-b5bb-1324ce7c0558', + auctionStart: 1544200122837, + bidderCode: 'adikteev', + bidderRequestId: '1203b39fecc6a5', + doneCbCallCount: 0, + refererInfo: { + canonicalUrl: undefined, + numIframes: 0, + reachedTop: true, + referer: 'http://localhost:9999/integrationExamples/gpt/hello_world_adikteev.html', + stack: ['http://localhost:9999/integrationExamples/gpt/hello_world_adikteev.html'] + }, + start: 1544200012839, + timeout: 3000 +}; +const serverResponse = + { + body: [ + { + requestId: cannedValidBidRequests[0].bidId, + cpm: 1, + width: cannedValidBidRequests[0].sizes[0][0], + height: cannedValidBidRequests[0].sizes[0][1], + ad: '
', + ttl: 360, + creativeId: 123, + netRevenue: false, + currency: 'EUR', + } + ] + }; describe('adikteevBidAdapter', () => { const adapter = newBidder(spec); @@ -20,21 +75,65 @@ describe('adikteevBidAdapter', () => { it('exists and is a function', () => { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); - it('exists and is a function', () => { - expect(setstagingEnvironmentSwitch).to.exist.and.to.be.a('function'); - }); - it('exists and is correctly set', () => { - expect(stagingEnvironmentSwitch).to.exist.and.to.equal(false); - }); }); + describe('conformCookies', () => { + it('parse cookie string into an object', () => { + expect(conformCookies('ak_id=ebf68e82-75bd-4a11-ad3b-0a4e36cef4e4; _pubcid=f3371d16-4e8b-42b5-a770-7e5be1fdf03d')).to.deep.equal({ + ak_id: 'ebf68e82-75bd-4a11-ad3b-0a4e36cef4e4', + _pubcid: 'f3371d16-4e8b-42b5-a770-7e5be1fdf03d' + }); + }) + }); + + describe('conformBidRequest', () => { + it('parse cookie string into an object', () => { + expect(conformBidRequest(cannedValidBidRequests[0])).to.deep.equal({ + params: cannedValidBidRequests[0].params, + crumbs: cannedValidBidRequests[0].crumbs, + sizes: cannedValidBidRequests[0].sizes, + bidId: cannedValidBidRequests[0].bidId, + bidderRequestId: cannedValidBidRequests[0].bidderRequestId, + }); + }) + }); + + describe('akDebug', () => expect(akDebug(null, null)).to.deep.equal(false)); + describe('akDebug', () => expect(akDebug(null, true)).to.deep.equal(true)); + describe('akDebug', () => expect(akDebug(JSON.stringify(true), null)).to.deep.equal(true)); + + describe('akEnv', () => expect(akEnv(null, null)).to.deep.equal(DEFAULT_ENV)); + describe('akEnv', () => expect(akEnv(null, 'staging')).to.deep.equal(STAGING)); + describe('akEnv', () => expect(akEnv('staging', null)).to.deep.equal(STAGING)); + + describe('akOverrides', () => expect(akOverrides(null, null)).to.deep.equal({})); + describe('akOverrides', () => expect(akOverrides(JSON.stringify({a: 1}), null)).to.deep.equal({a: 1})); + describe('akOverrides', () => expect(akOverrides('incorrect', null)).to.deep.equal({})); // expect no exception + describe('akOverrides', () => expect(akOverrides(null, {a: 1})).to.deep.equal({a: 1})); + + describe('akUrl', () => expect(akUrl(null)).to.deep.equal(AK_BASE_URL)); + describe('akUrl', () => expect(akUrl('anything')).to.deep.equal(AK_BASE_URL)); + describe('akUrl', () => expect(akUrl('staging')).to.deep.equal(AK_BASE_URL_STAGING)); + describe('akUrl', () => expect(akUrl('production')).to.deep.equal(AK_BASE_URL)); + + describe('endpointUrl', () => expect(endpointUrl(null, null)).to.deep.equal(AK_BASE_URL.concat(ENDPOINT_PATH))); + describe('endpointUrl', () => expect(endpointUrl(null, 'staging')).to.deep.equal(AK_BASE_URL_STAGING.concat(ENDPOINT_PATH))); + describe('endpointUrl', () => expect(endpointUrl('staging', null)).to.deep.equal(AK_BASE_URL_STAGING.concat(ENDPOINT_PATH))); + + describe('userSyncIframeUrl', () => expect(userSyncIframeUrl(null, null)).to.deep.equal(AK_BASE_URL.concat(USER_SYNC_IFRAME_URL_PATH))); + describe('userSyncIframeUrl', () => expect(userSyncIframeUrl(null, 'staging')).to.deep.equal(AK_BASE_URL_STAGING.concat(USER_SYNC_IFRAME_URL_PATH))); + describe('userSyncIframeUrl', () => expect(userSyncIframeUrl('staging', null)).to.deep.equal(AK_BASE_URL_STAGING.concat(USER_SYNC_IFRAME_URL_PATH))); + + describe('userSyncImageUrl', () => expect(userSyncImageUrl(null, null)).to.deep.equal(AK_BASE_URL.concat(USER_SYNC_IMAGE_URL_PATH))); + describe('userSyncImageUrl', () => expect(userSyncImageUrl(null, 'staging')).to.deep.equal(AK_BASE_URL_STAGING.concat(USER_SYNC_IMAGE_URL_PATH))); + describe('userSyncImageUrl', () => expect(userSyncImageUrl('staging', null)).to.deep.equal(AK_BASE_URL_STAGING.concat(USER_SYNC_IMAGE_URL_PATH))); + describe('isBidRequestValid', () => { it('should return true when required params found', () => { const validBid = { bidder: 'adikteev', params: { placementId: 12345, - bidFloorPrice: 0.1, }, mediaTypes: { banner: { @@ -45,23 +144,11 @@ describe('adikteevBidAdapter', () => { expect(spec.isBidRequestValid(validBid)).to.equal(true); }); - it('should mutate stagingEnvironmentSwitch when required params found', () => { - const withstagingEnvironmentSwitch = { - params: { - stagingEnvironment: true, - }, - }; - spec.isBidRequestValid(withstagingEnvironmentSwitch); - expect(stagingEnvironmentSwitch).to.equal(true); - setstagingEnvironmentSwitch(false); - }); - it('should return false when required params are invalid', () => { expect(spec.isBidRequestValid({ bidder: '', // invalid bidder params: { placementId: 12345, - bidFloorPrice: 0.1, }, mediaTypes: { banner: { @@ -73,7 +160,6 @@ describe('adikteevBidAdapter', () => { bidder: 'adikteev', params: { placementId: '', // invalid placementId - bidFloorPrice: 0.1, }, mediaTypes: { banner: { @@ -85,7 +171,6 @@ describe('adikteevBidAdapter', () => { bidder: 'adikteev', params: { placementId: 12345, - bidFloorPrice: 0.1, }, mediaTypes: { banner: { @@ -97,75 +182,79 @@ describe('adikteevBidAdapter', () => { }); describe('buildRequests', () => { - const validBidRequests = []; - const bidderRequest = {}; - const serverRequest = spec.buildRequests(validBidRequests, bidderRequest); + const + currency = 'EUR', + akEnv = 'staging', + akDebug = true, + akOverrides = { + iAmOverride: 'iAmOverride' + }; + config.setConfig({ + currency, + akEnv, + akDebug, + akOverrides + }); + + const request = spec.buildRequests(cannedValidBidRequests, cannedBidderRequest); + it('creates a request object with correct method, url and data', () => { - expect(serverRequest).to.exist.and.have.all.keys( + expect(request).to.exist.and.have.all.keys( 'method', 'url', 'data', ); - expect(serverRequest.method).to.equal('POST'); - expect(serverRequest.url).to.equal(ENDPOINT_URL); + expect(request.method).to.equal('POST'); + expect(request.url).to.equal(endpointUrl('staging', 'staging')); - let requestData = JSON.parse(serverRequest.data); + let requestData = JSON.parse(request.data); expect(requestData).to.exist.and.have.all.keys( - 'validBidRequests', - 'bidderRequest', - 'userAgent', - 'screen', - 'language', + 'akPbjsVersion', + 'bidRequests', 'cookies', - // 'refererInfo', - // 'currency', - 'prebidUpdateVersion', + 'currency', + 'debug', + 'iAmOverride', + 'language', + 'refererInfo', + 'deviceInfo', + 'userAgent', + ); + + expect(requestData.bidRequests[0]).to.exist.and.have.all.keys( + 'params', + 'crumbs', + 'sizes', + 'bidId', + 'bidderRequestId', ); - expect(requestData.validBidRequests).to.deep.equal(validBidRequests); - expect(requestData.bidderRequest).to.deep.equal(bidderRequest); - expect(requestData.userAgent).to.deep.equal(navigator.userAgent); - expect(requestData.screen.width).to.deep.equal(window.screen.width); - expect(requestData.screen.height).to.deep.equal(window.screen.height); - expect(requestData.language).to.deep.equal(navigator.language); - expect(requestData.prebidUpdateVersion).to.deep.equal('1.29.0'); - }); - describe('staging environment', () => { - setstagingEnvironmentSwitch(true); - const serverRequest = spec.buildRequests(validBidRequests, bidderRequest); - expect(serverRequest.url).to.equal(ENDPOINT_URL_STAGING); - setstagingEnvironmentSwitch(false); + expect(requestData.akPbjsVersion).to.deep.equal(AK_PBJS_VERSION); + expect(requestData.bidRequests[0].params).to.deep.equal(cannedValidBidRequests[0].params); + expect(requestData.bidRequests[0].crumbs).to.deep.equal(cannedValidBidRequests[0].crumbs); + expect(requestData.bidRequests[0].mediaTypes).to.deep.equal(cannedValidBidRequests[0].mediaTypes); + expect(requestData.bidRequests[0].bidId).to.deep.equal(cannedValidBidRequests[0].bidId); + expect(requestData.bidRequests[0].bidderRequestId).to.deep.equal(cannedValidBidRequests[0].bidderRequestId); + expect(requestData.currency).to.deep.equal(currency); + expect(requestData.debug).to.deep.equal(akDebug); + expect(requestData.iAmOverride).to.deep.equal('iAmOverride'); + expect(requestData.language).to.deep.equal(navigator.language); + expect(requestData.deviceInfo).to.exist.and.have.all.keys( + 'browserWidth', + 'browserHeight', + 'deviceWidth', + 'deviceHeight', + 'documentWidth', + 'documentHeight', + 'webGL', + ); + expect(requestData.userAgent).to.deep.equal(navigator.userAgent); }); }); describe('interpretResponse', () => { it('bid objects from response', () => { - const serverResponse = - { - body: [ - { - cpm: 1, - width: 300, - height: 250, - ad: '
', - ttl: 360, - creativeId: 123, - netRevenue: false, - currency: 'EUR', - } - ] - }; - const payload = { - validBidRequests: [{ - bidId: '2ef7bb021ac847' - }], - }; - const bidRequests = { - method: 'POST', - url: stagingEnvironmentSwitch ? ENDPOINT_URL_STAGING : ENDPOINT_URL, - data: JSON.stringify(payload), - }; - const bidResponses = spec.interpretResponse(serverResponse, bidRequests); + const bidResponses = spec.interpretResponse(serverResponse); expect(bidResponses).to.be.an('array').that.is.not.empty; // yes, syntax is correct expect(bidResponses[0]).to.have.all.keys( 'requestId', @@ -179,7 +268,7 @@ describe('adikteevBidAdapter', () => { 'currency', ); - expect(bidResponses[0].requestId).to.equal(payload.validBidRequests[0].bidId); + expect(bidResponses[0].requestId).to.equal(cannedValidBidRequests[0].bidId); expect(bidResponses[0].cpm).to.equal(serverResponse.body[0].cpm); expect(bidResponses[0].width).to.equal(serverResponse.body[0].width); expect(bidResponses[0].height).to.equal(serverResponse.body[0].height); @@ -192,18 +281,19 @@ describe('adikteevBidAdapter', () => { }); describe('getUserSyncs', () => { + config.setConfig({akEnv: PRODUCTION}); expect(spec.getUserSyncs({ iframeEnabled: true }, [{}])).to.deep.equal([{ type: 'iframe', - url: USER_SYNC_IFRAME_URL + url: AK_BASE_URL.concat(USER_SYNC_IFRAME_URL_PATH) }]); expect(spec.getUserSyncs({ pixelEnabled: true }, [{}])).to.deep.equal([{ type: 'image', - url: USER_SYNC_IMAGE_URL + url: AK_BASE_URL.concat(USER_SYNC_IMAGE_URL_PATH) }]); expect(spec.getUserSyncs({ @@ -211,25 +301,10 @@ describe('adikteevBidAdapter', () => { pixelEnabled: true }, [{}])).to.deep.equal([{ type: 'iframe', - url: USER_SYNC_IFRAME_URL + url: AK_BASE_URL.concat(USER_SYNC_IFRAME_URL_PATH) }, { type: 'image', - url: USER_SYNC_IMAGE_URL + url: AK_BASE_URL.concat(USER_SYNC_IMAGE_URL_PATH) }]); - - describe('staging environment', () => { - setstagingEnvironmentSwitch(true); - expect(spec.getUserSyncs({ - iframeEnabled: true, - pixelEnabled: true - }, [{}])).to.deep.equal([{ - type: 'iframe', - url: USER_SYNC_IFRAME_URL_STAGING - }, { - type: 'image', - url: USER_SYNC_IMAGE_URL_STAGING - }]); - setstagingEnvironmentSwitch(false); - }); }); });