From 198013edf0506126e1f7a99378a5da00e2256d7c Mon Sep 17 00:00:00 2001 From: John Rosendahl Date: Fri, 3 Aug 2018 06:11:44 -0600 Subject: [PATCH 01/83] 1206 eslint repair camel case (#2925) * Camel Case issues addresed * after merge cleanup * updated between adapter --- .eslintrc.js | 1 - modules/adkernelAdnBidAdapter.js | 2 +- modules/adkernelBidAdapter.js | 2 +- modules/andbeyondBidAdapter.js | 2 +- modules/audienceNetworkBidAdapter.js | 12 ++++---- modules/betweenBidAdapter.js | 12 ++++---- modules/bridgewellBidAdapter.js | 40 +++++++++++++------------- modules/etargetBidAdapter.js | 10 +++---- modules/nasmediaAdmixerBidAdapter.js | 4 +-- modules/polluxBidAdapter.js | 24 ++++++++-------- modules/realvuAnalyticsAdapter.js | 42 ++++++++++++++-------------- modules/rtbdemandadkBidAdapter.js | 2 +- modules/rtbhouseBidAdapter.js | 4 +-- modules/rubiconBidAdapter.js | 10 +++---- modules/sekindoUMBidAdapter.js | 2 +- modules/sonobiBidAdapter.js | 10 +++---- modules/trionBidAdapter.js | 20 ++++++------- modules/underdogmediaBidAdapter.js | 6 ++-- modules/widespaceBidAdapter.js | 2 +- package-lock.json | 5 +++- src/auction.js | 22 +++++++-------- src/utils.js | 24 ++++++++-------- 22 files changed, 130 insertions(+), 128 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index e6975951f06..02ff81614c7 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -26,7 +26,6 @@ module.exports = { // Violations of these styles should be fixed, and the exceptions removed over time. // // See Issue #1111. - "camelcase": "off", "eqeqeq": "off", "no-return-assign": "off", "no-throw-literal": "off", diff --git a/modules/adkernelAdnBidAdapter.js b/modules/adkernelAdnBidAdapter.js index e20f58d43f6..60c33170b3c 100644 --- a/modules/adkernelAdnBidAdapter.js +++ b/modules/adkernelAdnBidAdapter.js @@ -165,7 +165,7 @@ export const spec = { return serverResponses.filter(rps => rps.body && rps.body.syncpages) .map(rsp => rsp.body.syncpages) .reduce((a, b) => a.concat(b), []) - .map(sync_url => ({type: 'iframe', url: sync_url})); + .map(syncUrl => ({type: 'iframe', url: syncUrl})); } }; diff --git a/modules/adkernelBidAdapter.js b/modules/adkernelBidAdapter.js index e9f88e9a3ef..dffcaacec3d 100644 --- a/modules/adkernelBidAdapter.js +++ b/modules/adkernelBidAdapter.js @@ -87,7 +87,7 @@ export const spec = { return serverResponses.filter(rsp => rsp.body && rsp.body.ext && rsp.body.ext.adk_usersync) .map(rsp => rsp.body.ext.adk_usersync) .reduce((a, b) => a.concat(b), []) - .map(sync_url => ({type: 'iframe', url: sync_url})); + .map(syncUrl => ({type: 'iframe', url: syncUrl})); } }; diff --git a/modules/andbeyondBidAdapter.js b/modules/andbeyondBidAdapter.js index 1a3535f4704..710d75aec6d 100644 --- a/modules/andbeyondBidAdapter.js +++ b/modules/andbeyondBidAdapter.js @@ -86,7 +86,7 @@ export const spec = { return serverResponses.filter(rsp => rsp.body && rsp.body.ext && rsp.body.ext.adk_usersync) .map(rsp => rsp.body.ext.adk_usersync) .reduce((a, b) => a.concat(b), []) - .map(sync_url => ({type: 'iframe', url: sync_url})); + .map(syncUrl => ({type: 'iframe', url: syncUrl})); } }; diff --git a/modules/audienceNetworkBidAdapter.js b/modules/audienceNetworkBidAdapter.js index 7256ce99e73..5e9053dfc40 100644 --- a/modules/audienceNetworkBidAdapter.js +++ b/modules/audienceNetworkBidAdapter.js @@ -14,7 +14,7 @@ const method = 'GET'; const url = 'https://an.facebook.com/v2/placementbid.json'; const supportedMediaTypes = ['banner', 'video']; const netRevenue = true; -const hb_bidder = 'fan'; +const hbBidder = 'fan'; const platver = '$prebid.version$'; const platform = '241394079772386'; const adapterver = '1.0.0'; @@ -205,14 +205,14 @@ const interpretResponse = ({ body }, { adformats, requestIds, sizes }) => { // transform to bidResponse .map((bid, i) => { const { - bid_id: fb_bidid, + bid_id: fbBidid, placement_id: creativeId, bid_price_cents: cpm } = bid; const format = adformats[i]; const [width, height] = expandSize(flattenSize(sizes[i])); - const ad = createAdHtml(creativeId, format, fb_bidid); + const ad = createAdHtml(creativeId, format, fbBidid); const requestId = requestIds[i]; const bidResponse = { @@ -227,8 +227,8 @@ const interpretResponse = ({ body }, { adformats, requestIds, sizes }) => { netRevenue, currency, // Audience Network attributes - hb_bidder, - fb_bidid, + hb_bidder: hbBidder, + fb_bidid: fbBidid, fb_format: format, fb_placementid: creativeId }; @@ -236,7 +236,7 @@ const interpretResponse = ({ body }, { adformats, requestIds, sizes }) => { if (isVideo(format)) { const pageurl = getTopWindowUrlEncoded(); bidResponse.mediaType = 'video'; - bidResponse.vastUrl = `https://an.facebook.com/v1/instream/vast.xml?placementid=${creativeId}&pageurl=${pageurl}&playerwidth=${width}&playerheight=${height}&bidid=${fb_bidid}`; + bidResponse.vastUrl = `https://an.facebook.com/v1/instream/vast.xml?placementid=${creativeId}&pageurl=${pageurl}&playerwidth=${width}&playerheight=${height}&bidid=${fbBidid}`; } return bidResponse; }); diff --git a/modules/betweenBidAdapter.js b/modules/betweenBidAdapter.js index 005b7cdfe86..98140fe68e6 100644 --- a/modules/betweenBidAdapter.js +++ b/modules/betweenBidAdapter.js @@ -27,9 +27,9 @@ export const spec = { let params = { jst: 'hb', ord: Math.random() * 10000000000000000, - tz: get_tz(), - fl: get_fl(), - rr: get_rr(), + tz: getTz(), + fl: getFl(), + rr: getRr(), w: i.params.w, h: i.params.h, s: i.params.s, @@ -114,7 +114,7 @@ export const spec = { } } -function get_rr() { +function getRr() { try { var td = top.document; var rr = td.referrer; @@ -127,7 +127,7 @@ function get_rr() { } } -function get_fl() { +function getFl() { if (navigator.plugins !== undefined && navigator.plugins !== null) { if (navigator.plugins['Shockwave Flash'] !== undefined && navigator.plugins['Shockwave Flash'] !== null && typeof navigator.plugins['Shockwave Flash'] === 'object') { var description = navigator.plugins['Shockwave Flash'].description; @@ -142,7 +142,7 @@ function get_fl() { return 0; } -function get_tz() { +function getTz() { return new Date().getTimezoneOffset(); } diff --git a/modules/bridgewellBidAdapter.js b/modules/bridgewellBidAdapter.js index 222f904f276..65fa49a25f8 100644 --- a/modules/bridgewellBidAdapter.js +++ b/modules/bridgewellBidAdapter.js @@ -164,35 +164,35 @@ export const spec = { return; } - let req_nativeLayout = req.mediaTypes.native; - let res_native = matchedResponse.native; + let reqNativeLayout = req.mediaTypes.native; + let resNative = matchedResponse.native; // check title - let title = req_nativeLayout.title; + let title = reqNativeLayout.title; if (title && title.required) { - if (typeof res_native.title !== 'string') { + if (typeof resNative.title !== 'string') { return; - } else if (title.len && title.len < res_native.title.length) { + } else if (title.len && title.len < resNative.title.length) { return; } } // check body - let body = req_nativeLayout.body; + let body = reqNativeLayout.body; if (body && body.required) { - if (typeof res_native.body !== 'string') { + if (typeof resNative.body !== 'string') { return; } } // check image - let image = req_nativeLayout.image; + let image = reqNativeLayout.image; if (image && image.required) { - if (res_native.image) { - if (typeof res_native.image.url !== 'string') { // check image url + if (resNative.image) { + if (typeof resNative.image.url !== 'string') { // check image url return; } else { - if (res_native.image.width !== image.sizes[0] || res_native.image.height !== image.sizes[1]) { // check image sizes + if (resNative.image.width !== image.sizes[0] || resNative.image.height !== image.sizes[1]) { // check image sizes return; } } @@ -202,21 +202,21 @@ export const spec = { } // check sponsoredBy - let sponsoredBy = req_nativeLayout.sponsoredBy; + let sponsoredBy = reqNativeLayout.sponsoredBy; if (sponsoredBy && sponsoredBy.required) { - if (typeof res_native.sponsoredBy !== 'string') { + if (typeof resNative.sponsoredBy !== 'string') { return; } } // check icon - let icon = req_nativeLayout.icon; + let icon = reqNativeLayout.icon; if (icon && icon.required) { - if (res_native.icon) { - if (typeof res_native.icon.url !== 'string') { // check icon url + if (resNative.icon) { + if (typeof resNative.icon.url !== 'string') { // check icon url return; } else { - if (res_native.icon.width !== icon.sizes[0] || res_native.icon.height !== icon.sizes[0]) { // check image sizes + if (resNative.icon.width !== icon.sizes[0] || resNative.icon.height !== icon.sizes[0]) { // check image sizes return; } } @@ -226,12 +226,12 @@ export const spec = { } // check clickUrl - if (typeof res_native.clickUrl !== 'string') { + if (typeof resNative.clickUrl !== 'string') { return; } // check clickTracker - let clickTrackers = res_native.clickTrackers; + let clickTrackers = resNative.clickTrackers; if (clickTrackers) { if (clickTrackers.length === 0) { return; @@ -241,7 +241,7 @@ export const spec = { } // check impressionTrackers - let impressionTrackers = res_native.impressionTrackers; + let impressionTrackers = resNative.impressionTrackers; if (impressionTrackers) { if (impressionTrackers.length === 0) { return; diff --git a/modules/etargetBidAdapter.js b/modules/etargetBidAdapter.js index 2ad524613c2..0804fa25e87 100644 --- a/modules/etargetBidAdapter.js +++ b/modules/etargetBidAdapter.js @@ -4,7 +4,7 @@ import {registerBidder} from 'src/adapters/bidderFactory'; import { BANNER, VIDEO } from 'src/mediaTypes'; const BIDDER_CODE = 'etarget'; -const country_map = { +const countryMap = { 1: 'sk', 2: 'cz', 3: 'hu', @@ -28,18 +28,18 @@ export const spec = { var i, l, bid, reqParams, netRevenue, gdprObject; var request = []; var bids = JSON.parse(JSON.stringify(validBidRequests)); - var last_contry = 'sk'; + var lastContry = 'sk'; for (i = 0, l = bids.length; i < l; i++) { bid = bids[i]; - if (country_map[bid.params.country]) { - last_contry = country_map[bid.params.country]; + if (countryMap[bid.params.country]) { + lastContry = countryMap[bid.params.country]; } reqParams = bid.params; reqParams.transactionId = bid.transactionId; request.push(formRequestUrl(reqParams)); } - request.unshift('//' + last_contry + '.search.etargetnet.com/hb/?hbget=1'); + request.unshift('//' + lastContry + '.search.etargetnet.com/hb/?hbget=1'); netRevenue = 'net'; if (bidderRequest && bidderRequest.gdprConsent && bidderRequest.gdprConsent.gdprApplies) { diff --git a/modules/nasmediaAdmixerBidAdapter.js b/modules/nasmediaAdmixerBidAdapter.js index 7de5c638c9e..5b403b21b08 100644 --- a/modules/nasmediaAdmixerBidAdapter.js +++ b/modules/nasmediaAdmixerBidAdapter.js @@ -61,10 +61,10 @@ export const spec = { function getOsType() { let ua = navigator.userAgent.toLowerCase(); let os = ['android', 'ios', 'mac', 'linux', 'window']; - let regexp_os = [/android/i, /iphone|ipad/i, /mac/i, /linux/i, /window/i]; + let regexpOs = [/android/i, /iphone|ipad/i, /mac/i, /linux/i, /window/i]; return find(os, (tos, idx) => { - if (ua.match(regexp_os[idx])) { + if (ua.match(regexpOs[idx])) { return os[idx]; } }) || 'etc'; diff --git a/modules/polluxBidAdapter.js b/modules/polluxBidAdapter.js index 463de07341c..577ff57670e 100644 --- a/modules/polluxBidAdapter.js +++ b/modules/polluxBidAdapter.js @@ -34,7 +34,7 @@ export const spec = { return []; } const payload = []; - let custom_url = null; + let customUrl = null; for (let i = 0; i < validBidRequests.length; i++) { const bid = validBidRequests[i]; const request = { @@ -42,8 +42,8 @@ export const spec = { zones: bid.params.zone, sizes: bid.sizes }; - if (bid.bidderUrl && !custom_url) { - custom_url = bid.bidderUrl; + if (bid.bidderUrl && !customUrl) { + customUrl = bid.bidderUrl; } payload.push(request); } @@ -51,24 +51,24 @@ export const spec = { // build url parameters const domain = utils.getParameterByName('domain'); const tracker2 = utils.getParameterByName('tracker2'); - const url_params = {}; + const urlParams = {}; if (domain) { - url_params.domain = domain; + urlParams.domain = domain; } else { - url_params.domain = utils.getTopWindowUrl(); + urlParams.domain = utils.getTopWindowUrl(); } if (tracker2) { - url_params.tracker2 = tracker2; + urlParams.tracker2 = tracker2; } // build url - let bidder_url = custom_url || PLX_ENDPOINT_URL; - if (url_params) { - bidder_url = bidder_url + '?' + utils.parseQueryStringParameters(url_params); + let bidderUrl = customUrl || PLX_ENDPOINT_URL; + if (urlParams) { + bidderUrl = bidderUrl + '?' + utils.parseQueryStringParameters(urlParams); } - utils.logMessage('== ' + BIDDER_CODE + ' == request built: ' + bidder_url); + utils.logMessage('== ' + BIDDER_CODE + ' == request built: ' + bidderUrl); return { method: 'POST', - url: bidder_url, + url: bidderUrl, data: payloadString }; }, diff --git a/modules/realvuAnalyticsAdapter.js b/modules/realvuAnalyticsAdapter.js index 7dbb309ea18..1ce854b539e 100644 --- a/modules/realvuAnalyticsAdapter.js +++ b/modules/realvuAnalyticsAdapter.js @@ -356,15 +356,15 @@ window.top1.realvu_aa = window.top1.realvu_aa || { } if (a.riff === '') { a.riff = a.r; - let vr_score = z.score(a, 'v:r'); - if (vr_score != null) { - if (a.r == 'no' && vr_score > 75) { + let vrScore = z.score(a, 'v:r'); + if (vrScore != null) { + if (a.r == 'no' && vrScore > 75) { a.riff = 'yes'; } } - let vv0_score = z.score(a, 'v:v0'); - if (vv0_score != null) { - if (a.r == 'yes' && vv0_score < (30 + 25 * Math.random())) { + let vv0Score = z.score(a, 'v:v0'); + if (vv0Score != null) { + if (a.r == 'yes' && vv0Score < (30 + 25 * Math.random())) { a.riff = 'no'; } } @@ -439,20 +439,20 @@ window.top1.realvu_aa = window.top1.realvu_aa || { return par.offsetParent; } } - let not_friendly = false; + let notFriendly = false; let ain = null; let tn = a.tagName; if (tn == 'HEAD' || tn == 'SCRIPT') return null; if (tn == 'IFRAME') { ain = this.doc(a); if (ain == null) { - not_friendly = true; + notFriendly = true; } else { a = ain; tn = a.tagName; } } - if (not_friendly || tn == 'OBJECT' || tn == 'IMG' || tn == 'EMBED' || tn == 'SVG' || tn == 'CANVAS' || + if (notFriendly || tn == 'OBJECT' || tn == 'IMG' || tn == 'EMBED' || tn == 'SVG' || tn == 'CANVAS' || (tn == 'DIV' && a.style.backgroundImage)) { let w1 = a.offsetWidth; let h1 = a.offsetHeight; @@ -658,12 +658,12 @@ window.top1.realvu_aa = window.top1.realvu_aa || { return null; }, // API functions - addUnitById: function (partner_id, unit_id, callback, delay) { - let p1 = partner_id; + addUnitById: function (partnerId, unitId, callback, delay) { + let p1 = partnerId; if (typeof (p1) == 'string') { p1 = { - partner_id: partner_id, - unit_id: unit_id, + partner_id: partnerId, + unit_id: unitId, callback: callback, delay: delay }; @@ -676,25 +676,25 @@ window.top1.realvu_aa = window.top1.realvu_aa || { // b==true - add/update, b==false - update only if (args.cpm == 0) return; // collect only bids submitted const boost = window.top1.realvu_aa; - let push_bid = false; + let pushBid = false; let adi = null; if (!b) { // update only if already checked in by xyzBidAdapter for (let i = 0; i < boost.ads.length; i++) { adi = boost.ads[i]; if (adi.unit_id == args.adUnitCode) { - push_bid = true; + pushBid = true; break; } } } else { - push_bid = true; + pushBid = true; adi = window.top1.realvu_aa.check({ unit_id: args.adUnitCode, size: args.size, partner_id: partnerId }); } - if (push_bid) { + if (pushBid) { let pb = { bidder: args.bidder, cpm: args.cpm, @@ -715,10 +715,10 @@ window.top1.realvu_aa = window.top1.realvu_aa || { checkBidWon: function(partnerId, args, b) { // b==true - add/update, b==false - update only const z = this; - const unit_id = args.adUnitCode; + const unitId = args.adUnitCode; for (let i = 0; i < z.ads.length; i++) { let adi = z.ads[i]; - if (adi.unit_id == unit_id) { + if (adi.unit_id == unitId) { for (let j = 0; j < adi.bids.length; j++) { let bj = adi.bids[j]; if (bj.adId == args.adId) { @@ -754,10 +754,10 @@ window.top1.realvu_aa = window.top1.realvu_aa || { return rpt; }, - getStatusById: function (unit_id) { // return status object + getStatusById: function (unitId) { // return status object for (let i = 0; i < this.ads.length; i++) { let adi = this.ads[i]; - if (adi.unit_id == unit_id) return this.fmt(adi); + if (adi.unit_id == unitId) return this.fmt(adi); } return null; }, diff --git a/modules/rtbdemandadkBidAdapter.js b/modules/rtbdemandadkBidAdapter.js index a7ec8463c17..f199f20be56 100644 --- a/modules/rtbdemandadkBidAdapter.js +++ b/modules/rtbdemandadkBidAdapter.js @@ -96,7 +96,7 @@ export const spec = { return serverResponses.filter(rsp => rsp.body && rsp.body.ext && rsp.body.ext.adk_usersync) .map(rsp => rsp.body.ext.adk_usersync) .reduce((a, b) => a.concat(b), []) - .map(sync_url => ({type: 'iframe', url: sync_url})); + .map(syncUrl => ({type: 'iframe', url: syncUrl})); } }; diff --git a/modules/rtbhouseBidAdapter.js b/modules/rtbhouseBidAdapter.js index 678e156c5e6..bb527528e43 100644 --- a/modules/rtbhouseBidAdapter.js +++ b/modules/rtbhouseBidAdapter.js @@ -41,9 +41,9 @@ function mapBanner(slot) { /** * Produce openRTB banner.format object */ -function mapSizes(slot_sizes) { +function mapSizes(slotSizes) { const format = []; - slot_sizes.forEach(elem => { + slotSizes.forEach(elem => { format.push({ w: elem[0], h: elem[1] diff --git a/modules/rubiconBidAdapter.js b/modules/rubiconBidAdapter.js index e5e3c390740..e77b247a349 100644 --- a/modules/rubiconBidAdapter.js +++ b/modules/rubiconBidAdapter.js @@ -506,13 +506,13 @@ function _getDigiTrustQueryParams() { * @returns {string} */ function _getPageUrl(bidRequest) { - let page_url = config.getConfig('pageUrl'); + let pageUrl = config.getConfig('pageUrl'); if (bidRequest.params.referrer) { - page_url = bidRequest.params.referrer; - } else if (!page_url) { - page_url = utils.getTopWindowUrl(); + pageUrl = bidRequest.params.referrer; + } else if (!pageUrl) { + pageUrl = utils.getTopWindowUrl(); } - return bidRequest.params.secure ? page_url.replace(/^http:/i, 'https:') : page_url; + return bidRequest.params.secure ? pageUrl.replace(/^http:/i, 'https:') : pageUrl; } function _renderCreative(script, impId) { diff --git a/modules/sekindoUMBidAdapter.js b/modules/sekindoUMBidAdapter.js index ffaaa2c1c62..66002ba7e1b 100644 --- a/modules/sekindoUMBidAdapter.js +++ b/modules/sekindoUMBidAdapter.js @@ -62,7 +62,7 @@ export const spec = { if (bidRequest.mediaType === 'video' || (typeof bidRequest.mediaTypes == 'object' && typeof bidRequest.mediaTypes.video == 'object')) { queryString = utils.tryAppendQueryString(queryString, 'x', bidRequest.params.playerWidth); queryString = utils.tryAppendQueryString(queryString, 'y', bidRequest.params.playerHeight); - if (typeof vid_vastType != 'undefined') { + if (typeof vid_vastType != 'undefined') { // eslint-disable-line camelcase queryString = utils.tryAppendQueryString(queryString, 'vid_vastType', bidRequest.params.vid_vastType); } if (typeof bidRequest.mediaTypes == 'object' && typeof bidRequest.mediaTypes.video == 'object' && typeof bidRequest.mediaTypes.video.context == 'string') { diff --git a/modules/sonobiBidAdapter.js b/modules/sonobiBidAdapter.js index 289d42d1719..3d9ad2ce976 100644 --- a/modules/sonobiBidAdapter.js +++ b/modules/sonobiBidAdapter.js @@ -185,16 +185,16 @@ function _validateFloor (bid) { return ''; } -const _creative = (mediaType) => (sbi_dc, sbi_aid) => { +const _creative = (mediaType) => (sbiDc, sbiAid) => { if (mediaType === 'video') { - return _videoCreative(sbi_dc, sbi_aid) + return _videoCreative(sbiDc, sbiAid) } - const src = 'https://' + sbi_dc + 'apex.go.sonobi.com/sbi.js?aid=' + sbi_aid + '&as=null' + '&ref=' + getTopWindowLocation().href; + const src = 'https://' + sbiDc + 'apex.go.sonobi.com/sbi.js?aid=' + sbiAid + '&as=null' + '&ref=' + getTopWindowLocation().href; return ''; }; -function _videoCreative(sbi_dc, sbi_aid) { - return `https://${sbi_dc}apex.go.sonobi.com/vast.xml?vid=${sbi_aid}&ref=${getTopWindowLocation().href}` +function _videoCreative(sbiDc, sbiAid) { + return `https://${sbiDc}apex.go.sonobi.com/vast.xml?vid=${sbiAid}&ref=${getTopWindowLocation().href}` } function _getBidIdFromTrinityKey (key) { diff --git a/modules/trionBidAdapter.js b/modules/trionBidAdapter.js index c2488bd351a..e5acba1bf5e 100644 --- a/modules/trionBidAdapter.js +++ b/modules/trionBidAdapter.js @@ -85,12 +85,12 @@ function buildTrionUrlParams(bid) { var url = utils.getTopWindowUrl(); var sizes = utils.parseSizesInput(bid.sizes).join(','); - var int_t = window.TR_INT_T && window.TR_INT_T != -1 ? window.TR_INT_T : null; - if (!int_t) { - int_t = getStorageData(BASE_KEY + 'int_t'); + var intT = window.TR_INT_T && window.TR_INT_T != -1 ? window.TR_INT_T : null; + if (!intT) { + intT = getStorageData(BASE_KEY + 'int_t'); } - if (int_t) { - setStorageData(BASE_KEY + 'int_t', int_t) + if (intT) { + setStorageData(BASE_KEY + 'int_t', intT) } setStorageData(BASE_KEY + 'lps', pubId + ':' + sectionId); var trionUrl = ''; @@ -105,8 +105,8 @@ function buildTrionUrlParams(bid) { if (sizes) { trionUrl += 'sizes=' + sizes + '&'; } - if (int_t) { - trionUrl = utils.tryAppendQueryString(trionUrl, 'int_t', encodeURIComponent(int_t)); + if (intT) { + trionUrl = utils.tryAppendQueryString(trionUrl, 'int_t', encodeURIComponent(intT)); } // remove the trailing "&" @@ -150,8 +150,8 @@ export function acceptPostMessage(e) { if (message.indexOf(BASE_KEY + 'userId') !== 0) { return; } - var int_t = message.split(BASE_KEY + 'userId=')[1]; - if (int_t) { - setStorageData(BASE_KEY + 'int_t', int_t); + var intT = message.split(BASE_KEY + 'userId=')[1]; + if (intT) { + setStorageData(BASE_KEY + 'int_t', intT); } } diff --git a/modules/underdogmediaBidAdapter.js b/modules/underdogmediaBidAdapter.js index a4531968d31..184ecb6e930 100644 --- a/modules/underdogmediaBidAdapter.js +++ b/modules/underdogmediaBidAdapter.js @@ -66,14 +66,14 @@ export const spec = { mid.useCount = 0; } - var size_not_found = true; + var sizeNotFound = true; utils.parseSizesInput(bidParam.sizes).forEach(size => { if (size === mid.width + 'x' + mid.height) { - size_not_found = false; + sizeNotFound = false; } }); - if (size_not_found) { + if (sizeNotFound) { return; } diff --git a/modules/widespaceBidAdapter.js b/modules/widespaceBidAdapter.js index 2fb6c87c8df..f40a541aeb0 100644 --- a/modules/widespaceBidAdapter.js +++ b/modules/widespaceBidAdapter.js @@ -38,7 +38,7 @@ export const spec = { let serverRequests = []; const REQUEST_SERVER_URL = getEngineUrl(); const DEMO_DATA_PARAMS = ['gender', 'country', 'region', 'postal', 'city', 'yob']; - const PERF_DATA = getData(LS_KEYS.PERF_DATA).map(perf_data => JSON.parse(perf_data)); + const PERF_DATA = getData(LS_KEYS.PERF_DATA).map(perfData => JSON.parse(perfData)); const CUST_DATA = getData(LS_KEYS.CUST_DATA, false)[0]; const LC_UID = getLcuid(); diff --git a/package-lock.json b/package-lock.json index ae24e70fc80..4366f57423a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9339,7 +9339,10 @@ "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz", "integrity": "sha1-cVuW6phBWTzDMGeSP17GDr2k99c=", "dev": true, - "optional": true + "optional": true, + "requires": { + "readable-stream": "2.0.6" + } }, "form-data": { "version": "2.0.0", diff --git a/src/auction.js b/src/auction.js index 49632fddcf0..e2db713dd93 100644 --- a/src/auction.js +++ b/src/auction.js @@ -425,12 +425,12 @@ export function getStandardBidderSettings(mediaType) { const mediaTypeGranularity = config.getConfig(`mediaTypePriceGranularity.${mediaType}`); const granularity = (typeof mediaType === 'string' && mediaTypeGranularity) ? ((typeof mediaTypeGranularity === 'string') ? mediaTypeGranularity : 'custom') : config.getConfig('priceGranularity'); - let bidder_settings = $$PREBID_GLOBAL$$.bidderSettings; - if (!bidder_settings[CONSTANTS.JSON_MAPPING.BD_SETTING_STANDARD]) { - bidder_settings[CONSTANTS.JSON_MAPPING.BD_SETTING_STANDARD] = {}; + let bidderSettings = $$PREBID_GLOBAL$$.bidderSettings; + if (!bidderSettings[CONSTANTS.JSON_MAPPING.BD_SETTING_STANDARD]) { + bidderSettings[CONSTANTS.JSON_MAPPING.BD_SETTING_STANDARD] = {}; } - if (!bidder_settings[CONSTANTS.JSON_MAPPING.BD_SETTING_STANDARD][CONSTANTS.JSON_MAPPING.ADSERVER_TARGETING]) { - bidder_settings[CONSTANTS.JSON_MAPPING.BD_SETTING_STANDARD][CONSTANTS.JSON_MAPPING.ADSERVER_TARGETING] = [ + if (!bidderSettings[CONSTANTS.JSON_MAPPING.BD_SETTING_STANDARD][CONSTANTS.JSON_MAPPING.ADSERVER_TARGETING]) { + bidderSettings[CONSTANTS.JSON_MAPPING.BD_SETTING_STANDARD][CONSTANTS.JSON_MAPPING.ADSERVER_TARGETING] = [ { key: 'hb_bidder', val: function (bidResponse) { @@ -483,7 +483,7 @@ export function getStandardBidderSettings(mediaType) { }, ] } - return bidder_settings[CONSTANTS.JSON_MAPPING.BD_SETTING_STANDARD]; + return bidderSettings[CONSTANTS.JSON_MAPPING.BD_SETTING_STANDARD]; } export function getKeyValueTargetingPairs(bidderCode, custBidObj) { @@ -492,18 +492,18 @@ export function getKeyValueTargetingPairs(bidderCode, custBidObj) { } var keyValues = {}; - var bidder_settings = $$PREBID_GLOBAL$$.bidderSettings; + var bidderSettings = $$PREBID_GLOBAL$$.bidderSettings; // 1) set the keys from "standard" setting or from prebid defaults - if (bidder_settings) { + if (bidderSettings) { // initialize default if not set const standardSettings = getStandardBidderSettings(custBidObj.mediaType); setKeys(keyValues, standardSettings, custBidObj); // 2) set keys from specific bidder setting override if they exist - if (bidderCode && bidder_settings[bidderCode] && bidder_settings[bidderCode][CONSTANTS.JSON_MAPPING.ADSERVER_TARGETING]) { - setKeys(keyValues, bidder_settings[bidderCode], custBidObj); - custBidObj.sendStandardTargeting = bidder_settings[bidderCode].sendStandardTargeting; + if (bidderCode && bidderSettings[bidderCode] && bidderSettings[bidderCode][CONSTANTS.JSON_MAPPING.ADSERVER_TARGETING]) { + setKeys(keyValues, bidderSettings[bidderCode], custBidObj); + custBidObj.sendStandardTargeting = bidderSettings[bidderCode].sendStandardTargeting; } } diff --git a/src/utils.js b/src/utils.js index be1b3fbf5e2..7845e1e9bb0 100644 --- a/src/utils.js +++ b/src/utils.js @@ -7,12 +7,12 @@ const CONSTANTS = require('./constants'); var _loggingChecked = false; -var t_Arr = 'Array'; -var t_Str = 'String'; -var t_Fn = 'Function'; -var t_Numb = 'Number'; -var t_Object = 'Object'; -var t_Boolean = 'Boolean'; +var tArr = 'Array'; +var tStr = 'String'; +var tFn = 'Function'; +var tNumb = 'Number'; +var tObject = 'Object'; +var tBoolean = 'Boolean'; var toString = Object.prototype.toString; let infoLogger = null; let warnLogger = null; @@ -405,27 +405,27 @@ exports.isA = function (object, _t) { }; exports.isFn = function (object) { - return exports.isA(object, t_Fn); + return exports.isA(object, tFn); }; exports.isStr = function (object) { - return exports.isA(object, t_Str); + return exports.isA(object, tStr); }; exports.isArray = function (object) { - return exports.isA(object, t_Arr); + return exports.isA(object, tArr); }; exports.isNumber = function(object) { - return exports.isA(object, t_Numb); + return exports.isA(object, tNumb); }; exports.isPlainObject = function(object) { - return exports.isA(object, t_Object); + return exports.isA(object, tObject); } exports.isBoolean = function(object) { - return exports.isA(object, t_Boolean); + return exports.isA(object, tBoolean); } /** From aca5fb77268d7fdb6ef3549eeef7a98cba40272b Mon Sep 17 00:00:00 2001 From: Omer Koren Date: Fri, 3 Aug 2018 23:34:43 +0300 Subject: [PATCH 02/83] fix domain extraction in undertone adapter (#2921) * fix domain extraction in undertone adapter There was a bug when trying to extract domain from hostnames with two letter suffixes such as .co / .io / etc This fix solves this issue * fix lint issues --- modules/undertoneBidAdapter.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/undertoneBidAdapter.js b/modules/undertoneBidAdapter.js index 1f32fe0347a..d7e063b85f5 100644 --- a/modules/undertoneBidAdapter.js +++ b/modules/undertoneBidAdapter.js @@ -21,11 +21,15 @@ export const spec = { 'x-ut-hb-params': [] }; const location = utils.getTopWindowLocation(); - let domain = /[-\w]+\.(?:[-\w]+\.xn--[-\w]+|[-\w]{3,}|[-\w]+\.[-\w]{2})$/i.exec(location.host); - if (domain == null || domain.length == 0) { - domain = null; - } else { - domain = domain[0]; + let domains = /[-\w]+\.([-\w]+|[-\w]{3,}|[-\w]{1,3}\.[-\w]{2})$/i.exec(location.host); + let domain = null; + if (domains != null && domains.length > 0) { + domain = domains[0]; + for (let i = 1; i < domains.length; i++) { + if (domains[i].length > domain.length) { + domain = domains[i]; + } + } } const pubid = validBidRequests[0].params.publisherId; From d303d1db27528ad742a25864072577dcc618ad62 Mon Sep 17 00:00:00 2001 From: telariaEng <36203956+telariaEng@users.noreply.github.com> Date: Mon, 6 Aug 2018 06:54:36 -0700 Subject: [PATCH 03/83] Telaria Bid Adapter (#2924) * Added telaria bid adapter * more documentation * Added more test cases. And improved some code in the adapter * Removed the check for optional params, they are handled in the server. Also updated certain param names used in the test spec. * added some spaces to fix CircleCI tests * added some spaces to fix CircleCI tests * fixed code indentation in /spec/AnalyticsAdapter_spec.js which causing the CircleCI tests to fail. * Reverted the changes * merged with prebid master. * creative Id is required when we build a response but our server doesn't always have the crid, so using a sentinel value when we don't have the crid. * - removed an un used method - Removed the package-lock file. --- modules/telariaBidAdapter.js | 190 ++++++++++++++++++++ modules/telariaBidAdapter.md | 35 ++++ test/spec/modules/telariaBidAdapter_spec.js | 190 ++++++++++++++++++++ 3 files changed, 415 insertions(+) create mode 100644 modules/telariaBidAdapter.js create mode 100644 modules/telariaBidAdapter.md create mode 100644 test/spec/modules/telariaBidAdapter_spec.js diff --git a/modules/telariaBidAdapter.js b/modules/telariaBidAdapter.js new file mode 100644 index 00000000000..e59ed6cd0f6 --- /dev/null +++ b/modules/telariaBidAdapter.js @@ -0,0 +1,190 @@ +import * as utils from 'src/utils'; +import * as bidfactory from 'src/bidfactory'; +import {registerBidder} from 'src/adapters/bidderFactory'; +import {config} from 'src/config'; +import {VIDEO} from '../src/mediaTypes'; +import {STATUS} from 'src/constants'; + +const BIDDER_CODE = 'telaria'; +const ENDPOINT = '.ads.tremorhub.com/ad/tag'; + +export const spec = { + code: BIDDER_CODE, + aliases: ['tremor', 'tremorvideo'], + supportedMediaTypes: [VIDEO], + /** + * Determines if the request is valid + * @param bid + * @returns {*|string} + */ + isBidRequestValid: function (bid) { + return !!(bid && bid.params && bid.params.adCode && bid.params.supplyCode); + }, + + /** + * Make a server request from the list of BidRequests. + * @param validBidRequests list of valid bid requests that have passed isBidRequestValid check + * @returns {Array} of url objects + */ + buildRequests: function (validBidRequests) { + let requests = []; + + validBidRequests.forEach(bid => { + let url = generateUrl(bid); + if (url) { + requests.push({ + method: 'GET', + url: generateUrl(bid), + bidId: bid.bidId, + vastUrl: url.split('&fmt=json')[0] + }); + } + }); + + return requests; + }, + + /** + * convert the server response into a list of BidObjects that prebid accepts + * http://prebid.org/dev-docs/bidder-adaptor.html#interpreting-the-response + * @param serverResponse + * @param bidderRequest + * @returns {Array} + */ + interpretResponse: function (serverResponse, bidderRequest) { + let bidResult; + let width, height; + + let bids = []; + + try { + bidResult = serverResponse.body; + + bidderRequest.url.split('&').forEach(param => { + let lower = param.toLowerCase(); + if (lower.indexOf('player') > -1) { + if (lower.indexOf('width') > -1) { + width = param.split('=')[1]; + } else if (lower.indexOf('height') > -1) { + height = param.split('=')[1]; + } + } + }); + } catch (error) { + utils.logError(error); + width = 0; + height = 0; + } + + if (!bidResult || bidResult.error) { + let errorMessage = `in response for ${bidderRequest.bidderCode} adapter`; + if (bidResult && bidResult.error) { + errorMessage += `: ${bidResult.error}`; + } + utils.logError(errorMessage); + } else if (bidResult.seatbid && bidResult.seatbid.length > 0) { + bidResult.seatbid[0].bid.forEach(tag => { + bids.push(createBid(STATUS.GOOD, bidderRequest, tag, width, height, bidResult.seatbid[0].seat)); + }); + } + + return bids; + }, + /** + * We support pixel syncing only at the moment. Telaria ad server returns 'ext' + * as an optional parameter if the tag has 'incIdSync' parameter set to true + * @param syncOptions + * @param serverResponses + * @returns {Array} + */ + getUserSyncs: function (syncOptions, serverResponses) { + const syncs = []; + if (syncOptions.pixelEnabled && serverResponses.length) { + try { + serverResponses[0].body.ext.telaria.userSync.forEach(url => syncs.push({type: 'image', url: url})); + } catch (e) {} + } + return syncs; + } +}; + +/** + * Generates the url based on the parameters given. Sizes, supplyCode & adCode are required. + * The format is: [L,W] or [[L1,W1],...] + * @param bid + * @returns {string} + */ +function generateUrl(bid) { + let width, height; + if (!bid.sizes) { + return ''; + } + + if (utils.isArray(bid.sizes) && (bid.sizes.length === 2) && (!isNaN(bid.sizes[0]) && !isNaN(bid.sizes[1]))) { + width = bid.sizes[0]; + height = bid.sizes[1]; + } else if (typeof bid.sizes === 'object') { + // take the primary (first) size from the array + width = bid.sizes[0][0]; + height = bid.sizes[0][1]; + } + if (width && height && bid.params.supplyCode && bid.params.adCode) { + let scheme = ((document.location.protocol === 'https:') ? 'https' : 'http') + '://'; + let url = scheme + bid.params.supplyCode + ENDPOINT + '?adCode=' + bid.params.adCode; + + url += ('&playerWidth=' + width); + url += ('&playerHeight=' + height); + + for (let key in bid.params) { + if (bid.params.hasOwnProperty(key) && bid.params[key]) { + url += ('&' + key + '=' + bid.params[key]); + } + } + + if (!bid.params['srcPageUrl']) { + url += ('&srcPageUrl=' + encodeURIComponent(document.location.href)); + } + + url += ('&transactionId=' + bid.transactionId); + url += ('&referrer=' + config.getConfig('pageUrl') || utils.getTopWindowUrl()); + + return (url + '&fmt=json'); + } +} + +/** + * Create and return a bid object based on status and tag + * @param status + * @param reqBid + * @param response + * @param width + * @param height + * @param bidderCode + */ +function createBid(status, reqBid, response, width, height, bidderCode) { + let bid = bidfactory.createBid(status, reqBid); + + // TTL 5 mins by default, future support for extended imp wait time + if (response) { + Object.assign(bid, { + requestId: reqBid.bidId, + cpm: response.price, + creativeId: response.crid || '-1', + vastXml: response.adm, + vastUrl: reqBid.vastUrl, + mediaType: 'video', + width: width, + height: height, + bidderCode: bidderCode, + adId: response.id, + currency: 'USD', + netRevenue: true, + ttl: 300, + ad: response.adm + }); + } + + return bid; +} + +registerBidder(spec); diff --git a/modules/telariaBidAdapter.md b/modules/telariaBidAdapter.md new file mode 100644 index 00000000000..6a34a14a6b2 --- /dev/null +++ b/modules/telariaBidAdapter.md @@ -0,0 +1,35 @@ +# Overview + +``` +Module Name: Telaria Bid Adapter +Module Type: Bidder Adapter +Maintainer: github@telaria.com +``` + +# Description + +Connects to Telaria's exchange. + +Telaria bid adapter supports insteream Video. + +# Test Parameters +``` +{ + code: 'video1', + mediaTypes: { + 'video': { + playerSize: [640, 480], + context: 'instream' + } + }, + bids: [{ + bidder: 'tremor', + params: { + supplyCode: 'ssp-demo-rm6rh', + adCode: 'ssp-!demo!-lufip', + videoId: 'MyCoolVideo' + } + }] +} +``` + diff --git a/test/spec/modules/telariaBidAdapter_spec.js b/test/spec/modules/telariaBidAdapter_spec.js new file mode 100644 index 00000000000..2483ec70e76 --- /dev/null +++ b/test/spec/modules/telariaBidAdapter_spec.js @@ -0,0 +1,190 @@ +import {expect} from 'chai'; +import {newBidder} from 'src/adapters/bidderFactory'; +import {spec} from 'modules/telariaBidAdapter'; + +const ENDPOINT = '.ads.tremorhub.com/ad/tag'; +const AD_CODE = 'ssp-!demo!-lufip'; +const SUPPLY_CODE = 'ssp-demo-rm6rh'; +const SIZES = [640, 480]; +const REQUEST = { + 'code': 'video1', + 'sizes': [640, 480], + 'mediaType': 'video', + 'bids': [{ + 'bidder': 'tremor', + 'params': { + 'videoId': 'MyCoolVideo', + 'inclSync': true + } + }] +}; + +const RESPONSE = { + 'cur': 'USD', + 'id': '3dba13e35f3d42f998bc7e65fd871889', + 'seatbid': [{ + 'seat': 'TremorVideo', + 'bid': [{ + 'adomain': [], + 'price': 0.50000, + 'id': '3dba13e35f3d42f998bc7e65fd871889', + 'adm': '\n Tremor Video Test MP4 Creative \n\n \n\n\n\n\n\n \n\n \n\n', + 'impid': '1' + }] + }] +}; + +describe('TelariaAdapter', () => { + const adapter = newBidder(spec); + + describe('inherited functions', () => { + it('exists and is a function', () => { + expect(adapter.callBids).to.exist.and.to.be.a('function'); + }); + }); + + describe('isBidRequestValid', () => { + let bid = REQUEST.bids[0]; + + it('should return true when required params found', () => { + let tempBid = bid; + tempBid.params.adCode = 'ssp-!demo!-lufip'; + tempBid.params.supplyCode = 'ssp-demo-rm6rh'; + expect(spec.isBidRequestValid(bid)).to.equal(true); + }); + + it('should return true when required params found', () => { + let tempBid = bid; + delete tempBid.params; + tempBid.params = { + supplyCode: 'ssp-demo-rm6rh', + adCode: 'ssp-!demo!-lufip', + }; + + expect(spec.isBidRequestValid(tempBid)).to.equal(true); + }); + + it('should return false when required params are not passed', () => { + let tempBid = bid; + tempBid.params = {}; + expect(spec.isBidRequestValid(tempBid)).to.equal(false); + }); + }); + + describe('buildRequests', () => { + const stub = [{ + bidder: 'tremor', + sizes: [[300, 250], [300, 600]], + params: { + supplyCode: 'ssp-demo-rm6rh', + adCode: 'ssp-!demo!-lufip', + videoId: 'MyCoolVideo' + } + }]; + + it('exists and is a function', () => { + expect(spec.buildRequests).to.exist.and.to.be.a('function'); + }); + + it('requires supply code, ad code and sizes to make a request', () => { + const tempRequest = spec.buildRequests(stub); + expect(tempRequest.length).to.equal(1); + }); + + it('generates an array of requests with 4 params, method, url, bidId and vastUrl', () => { + const tempRequest = spec.buildRequests(stub); + + expect(tempRequest.length).to.equal(1); + expect(tempRequest[0].method).to.equal('GET'); + expect(tempRequest[0].url).to.exist; + expect(tempRequest[0].bidId).to.equal(undefined); + expect(tempRequest[0].vastUrl).to.exist; + }); + + it('requires sizes to make a request', () => { + let tempBid = stub; + tempBid[0].sizes = null; + const tempRequest = spec.buildRequests(tempBid); + + expect(tempRequest.length).to.equal(0); + }); + + it('generates a valid request with sizes as an array of two elements', () => { + let tempBid = stub; + tempBid[0].sizes = [640, 480]; + expect(spec.buildRequests(tempBid).length).to.equal(1); + }); + + it('requires ad code and supply code to make a request', () => { + let tempBid = stub; + tempBid[0].params.adCode = null; + tempBid[0].params.supplyCode = null; + + const tempRequest = spec.buildRequests(tempBid); + + expect(tempRequest.length).to.equal(0); + }); + }); + + describe('interpretResponse', () => { + const responseStub = RESPONSE; + const stub = [{ + bidder: 'tremor', + sizes: [[300, 250], [300, 600]], + params: { + supplyCode: 'ssp-demo-rm6rh', + adCode: 'ssp-!demo!-lufip', + videoId: 'MyCoolVideo' + } + }]; + + it('should get correct bid response', () => { + let expectedResponseKeys = ['bidderCode', 'width', 'height', 'statusMessage', 'adId', 'mediaType', 'source', + 'getStatusCode', 'getSize', 'requestId', 'cpm', 'creativeId', 'vastXml', + 'vastUrl', 'currency', 'netRevenue', 'ttl', 'ad']; + + let bidRequest = spec.buildRequests(stub)[0]; + bidRequest.bidId = '1234'; + let result = spec.interpretResponse({body: responseStub}, bidRequest); + expect(Object.keys(result[0])).to.have.members(expectedResponseKeys); + }); + + it('handles nobid responses', () => { + let tempResponse = responseStub; + tempResponse.seatbid = []; + + let bidRequest = spec.buildRequests(stub)[0]; + bidRequest.bidId = '1234'; + + let result = spec.interpretResponse({body: tempResponse}, bidRequest); + expect(result.length).to.equal(0); + }); + + it('handles invalid responses', () => { + let result = spec.interpretResponse(null, {bbidderCode: 'telaria'}); + expect(result.length).to.equal(0); + }); + + it('handles error responses', () => { + let result = spec.interpretResponse({body: {error: 'Invalid request'}}, {bbidderCode: 'telaria'}); + expect(result.length).to.equal(0); + }); + }); + + describe('getUserSyncs', () => { + const responses = [{body: RESPONSE}]; + responses[0].body.ext = { + telaria: { + userSync: [ + 'https://url.com', + 'https://url2.com' + ] + } + }; + + it('should get the correct number of sync urls', () => { + let urls = spec.getUserSyncs({pixelEnabled: true}, responses); + expect(urls.length).to.equal(2); + }); + }); +}); From 752e234f54f8f4de09f541e6c0d4acd63bd12d61 Mon Sep 17 00:00:00 2001 From: PROPS IPAX <41884470+PROPSIPAX@users.noreply.github.com> Date: Tue, 7 Aug 2018 22:38:56 +0700 Subject: [PATCH 04/83] PROPS IPAX - GIANTS Adapter (#2933) * add giants bidder * add giants bidder spec * newline end file newline end file * add GDPR Module --- modules/giantsBidAdapter.js | 343 +++++++++++++++++++++ modules/giantsBidAdapter.md | 30 ++ test/spec/modules/giantsBidAdapter_spec.js | 301 ++++++++++++++++++ 3 files changed, 674 insertions(+) create mode 100644 modules/giantsBidAdapter.js create mode 100644 modules/giantsBidAdapter.md create mode 100644 test/spec/modules/giantsBidAdapter_spec.js diff --git a/modules/giantsBidAdapter.js b/modules/giantsBidAdapter.js new file mode 100644 index 00000000000..6844cb684bc --- /dev/null +++ b/modules/giantsBidAdapter.js @@ -0,0 +1,343 @@ +import * as utils from 'src/utils'; +import { registerBidder } from 'src/adapters/bidderFactory'; +import { BANNER, NATIVE, VIDEO } from 'src/mediaTypes'; +import includes from 'core-js/library/fn/array/includes'; + +const BIDDER_CODE = 'giants'; +const URL = '//d.admp.io/hb'; +const VIDEO_TARGETING = ['id', 'mimes', 'minduration', 'maxduration', + 'startdelay', 'skippable', 'playback_method', 'frameworks']; +const NATIVE_MAPPING = { + body: 'description', + cta: 'ctatext', + image: { + serverName: 'main_image', + requiredParams: { required: true }, + minimumParams: { sizes: [{}] }, + }, + icon: { + serverName: 'icon', + requiredParams: { required: true }, + minimumParams: { sizes: [{}] }, + }, + sponsoredBy: 'sponsored_by', +}; +const SOURCE = 'pbjs'; + +export const spec = { + code: BIDDER_CODE, + aliases: [], + supportedMediaTypes: [BANNER, VIDEO, NATIVE], + + /** + * Determines whether or not the given bid request is valid. + * + * @param {object} bid The bid to validate. + * @return boolean True if this is a valid bid, and false otherwise. + */ + isBidRequestValid: function(bid) { + return !!(bid.params.zoneId); + }, + + /** + * Make a server request from the list of BidRequests. + * + * @param {BidRequest[]} bidRequests A non-empty list of bid requests which should be sent to the Server. + * @return ServerRequest Info describing the request to the server. + */ + buildRequests: function(bidRequests, bidderRequest) { + const tags = bidRequests.map(bidToTag); + // const zoneIds = bidRequests.map(bidToZoneId); + // var firstBid = bidRequests[0]; + var ref = utils.getTopWindowUrl(); + const url = URL + '/multi?url=' + ref; + // + '&callback=window.$$PREBID_GLOBAL$$.giantsResponse&callback_uid=' + bid.bidId; + + const payload = { + tags: [...tags], + // user: userObj, + sdk: { + source: SOURCE, + version: '$prebid.version$' + } + }; + // if (member > 0) { + // payload.member_id = member; + // } + + if (bidderRequest && bidderRequest.gdprConsent) { + // note - objects for impbus use underscore instead of camelCase + payload.gdpr_consent = { + consent_string: bidderRequest.gdprConsent.consentString, + consent_required: bidderRequest.gdprConsent.gdprApplies + }; + } + + const payloadString = JSON.stringify(payload); + + return { + method: 'POST', + // url: URL, + url: url, + data: payloadString, + bidderRequest + }; + }, + + /** + * Unpack the response from the server into a list of bids. + * + * @param {*} serverResponse A successful response from the server. + * @return {Bid[]} An array of bids which were nested inside the server. + */ + interpretResponse: function(serverResponse, {bidderRequest}) { + serverResponse = serverResponse.body; + const bids = []; + if (!serverResponse || serverResponse.error) { + let errorMessage = `in response for ${bidderRequest.bidderCode} adapter`; + if (serverResponse && serverResponse.error) { errorMessage += `: ${serverResponse.error}`; } + utils.logError(errorMessage); + return bids; + } + if (serverResponse.tags) { + serverResponse.tags.forEach(serverBid => { + if (serverBid.cpm && serverBid.cpm !== 0) { + const bid = newBid(serverBid, bidderRequest); + bid.mediaType = BANNER; + bids.push(bid); + } + }); + } + return bids; + }, + + getUserSyncs: function(syncOptions) { + if (syncOptions.iframeEnabled) { + return [{ + type: 'iframe', + url: '//d.admp.io/ping' + }]; + } + } +} + +/* Turn keywords parameter into ut-compatible format */ +function getKeywords(keywords) { + let arrs = []; + + utils._each(keywords, (v, k) => { + if (utils.isArray(v)) { + let values = []; + utils._each(v, (val) => { + val = utils.getValueString('keywords.' + k, val); + if (val) { values.push(val); } + }); + v = values; + } else { + v = utils.getValueString('keywords.' + k, v); + if (utils.isStr(v)) { + v = [v]; + } else { + return; + } // unsuported types - don't send a key + } + arrs.push({key: k, value: v}); + }); + + return arrs; +} + +/** + * Unpack the Server's Bid into a Prebid-compatible one. + * @param serverBid + * @param rtbBid + * @param bidderRequest + * @return Bid + */ +function newBid(serverBid, bidderRequest) { + const bid = { + requestId: serverBid.uuid, + cpm: serverBid.cpm, + creativeId: serverBid.creative_id, + // dealId: rtbBid.deal_id, + currency: 'USD', + netRevenue: true, + ttl: 300 + }; + + Object.assign(bid, { + width: serverBid.width, + height: serverBid.height, + // ad: serverBid.ad + ad: _renderCreative(serverBid.adUrl, serverBid.width, serverBid.height) + }); + // try { + // const url = rtbBid.rtb.trackers[0].impression_urls[0]; + // const tracker = utils.createTrackPixelHtml(url); + // bid.ad += tracker; + // } catch (error) { + // utils.logError('Error appending tracking pixel', error); + // } + + return bid; +} + +function bidToTag(bid) { + const tag = {}; + tag.sizes = transformSizes(bid.sizes); + tag.primary_size = tag.sizes[0]; + tag.ad_types = []; + tag.uuid = bid.bidId; + if (bid.params.zoneId) { + tag.id = bid.params.zoneId; + } else { + tag.code = bid.params.invCode; + } + tag.allow_smaller_sizes = bid.params.allowSmallerSizes || false; + tag.use_pmt_rule = bid.params.usePaymentRule || false + tag.prebid = true; + tag.disable_psa = true; + if (bid.params.reserve) { + tag.reserve = bid.params.reserve; + } + if (bid.params.position) { + tag.position = {'above': 1, 'below': 2}[bid.params.position] || 0; + } + if (bid.params.trafficSourceCode) { + tag.traffic_source_code = bid.params.trafficSourceCode; + } + if (bid.params.privateSizes) { + tag.private_sizes = transformSizes(bid.params.privateSizes); + } + if (bid.params.supplyType) { + tag.supply_type = bid.params.supplyType; + } + if (bid.params.pubClick) { + tag.pubclick = bid.params.pubClick; + } + if (bid.params.extInvCode) { + tag.ext_inv_code = bid.params.extInvCode; + } + if (bid.params.externalImpId) { + tag.external_imp_id = bid.params.externalImpId; + } + if (!utils.isEmpty(bid.params.keywords)) { + tag.keywords = getKeywords(bid.params.keywords); + } + + if (bid.mediaType === NATIVE || utils.deepAccess(bid, `mediaTypes.${NATIVE}`)) { + tag.ad_types.push(NATIVE); + + if (bid.nativeParams) { + const nativeRequest = buildNativeRequest(bid.nativeParams); + tag[NATIVE] = {layouts: [nativeRequest]}; + } + } + + const videoMediaType = utils.deepAccess(bid, `mediaTypes.${VIDEO}`); + const context = utils.deepAccess(bid, 'mediaTypes.video.context'); + + if (bid.mediaType === VIDEO || videoMediaType) { + tag.ad_types.push(VIDEO); + } + + // instream gets vastUrl, outstream gets vastXml + if (bid.mediaType === VIDEO || (videoMediaType && context !== 'outstream')) { + tag.require_asset_url = true; + } + + if (bid.params.video) { + tag.video = {}; + // place any valid video params on the tag + Object.keys(bid.params.video) + .filter(param => includes(VIDEO_TARGETING, param)) + .forEach(param => tag.video[param] = bid.params.video[param]); + } + + if ( + (utils.isEmpty(bid.mediaType) && utils.isEmpty(bid.mediaTypes)) || + (bid.mediaType === BANNER || (bid.mediaTypes && bid.mediaTypes[BANNER])) + ) { + tag.ad_types.push(BANNER); + } + + return tag; +} + +// function bidToZoneId(bid) { +// return bid.params.zoneId; +// } + +/* Turn bid request sizes into ut-compatible format */ +function transformSizes(requestSizes) { + let sizes = []; + let sizeObj = {}; + + if (utils.isArray(requestSizes) && requestSizes.length === 2 && + !utils.isArray(requestSizes[0])) { + sizeObj.width = parseInt(requestSizes[0], 10); + sizeObj.height = parseInt(requestSizes[1], 10); + sizes.push(sizeObj); + } else if (typeof requestSizes === 'object') { + for (let i = 0; i < requestSizes.length; i++) { + let size = requestSizes[i]; + sizeObj = {}; + sizeObj.width = parseInt(size[0], 10); + sizeObj.height = parseInt(size[1], 10); + sizes.push(sizeObj); + } + } + + return sizes; +} + +function buildNativeRequest(params) { + const request = {}; + + // map standard prebid native asset identifier to /ut parameters + // e.g., tag specifies `body` but /ut only knows `description`. + // mapping may be in form {tag: ''} or + // {tag: {serverName: '', requiredParams: {...}}} + Object.keys(params).forEach(key => { + // check if one of the forms is used, otherwise + // a mapping wasn't specified so pass the key straight through + const requestKey = + (NATIVE_MAPPING[key] && NATIVE_MAPPING[key].serverName) || + NATIVE_MAPPING[key] || + key; + + // required params are always passed on request + const requiredParams = NATIVE_MAPPING[key] && NATIVE_MAPPING[key].requiredParams; + request[requestKey] = Object.assign({}, requiredParams, params[key]); + + // minimum params are passed if no non-required params given on adunit + const minimumParams = NATIVE_MAPPING[key] && NATIVE_MAPPING[key].minimumParams; + + if (requiredParams && minimumParams) { + // subtract required keys from adunit keys + const adunitKeys = Object.keys(params[key]); + const requiredKeys = Object.keys(requiredParams); + const remaining = adunitKeys.filter(key => !includes(requiredKeys, key)); + + // if none are left over, the minimum params needs to be sent + if (remaining.length === 0) { + request[requestKey] = Object.assign({}, request[requestKey], minimumParams); + } + } + }); + + return request; +} + +function _renderCreative(adUrl, width, height) { + return ` + + + + ' + - '\');'; +const REQUEST = { + 'bidderCode': 'consumable', + 'auctionId': 'a4713c32-3762-4798-b342-4ab810ca770d', + 'bidderRequestId': '109f2a181342a9', + 'bidRequest': [{ + 'bidder': 'consumable', + 'params': { + 'networkId': 9969, + 'siteId': 730181, + 'unitId': 123456, + 'unitName': 'cnsmbl-unit' + }, + 'placementCode': 'div-gpt-ad-1487778092495-0', + 'sizes': [ + [728, 90], + [970, 90] + ], + 'bidId': '2b0f82502298c9', + 'bidderRequestId': '109f2a181342a9', + 'auctionId': 'a4713c32-3762-4798-b342-4ab810ca770d' + }, + { + 'bidder': 'consumable', + 'params': { + 'networkId': 9969, + 'siteId': 730181, + 'unitId': 123456, + 'unitName': 'cnsmbl-unit' + }, + 'placementCode': 'div-gpt-ad-1487778092495-0', + 'sizes': [ + [728, 90], + [970, 90] + ], + 'bidId': '123', + 'bidderRequestId': '109f2a181342a9', + 'auctionId': 'a4713c32-3762-4798-b342-4ab810ca770d' + }], + 'start': 1487883186070, + 'auctionStart': 1487883186069, + 'timeout': 3000 }; -describe('ConsumableAdapter', () => { - const CONSUMABLE_URL = '//adserver-us.adtech.advertising.com/pubapi/3.0/'; - const CONSUMABLE_TTL = 60; - - function createCustomBidRequest({bids, params} = {}) { - var bidderRequest = getDefaultBidRequest(); - if (bids && Array.isArray(bids)) { - bidderRequest.bids = bids; - } - if (params) { - bidderRequest.bids.forEach(bid => bid.params = params); +const RESPONSE = { + 'headers': null, + 'body': { + 'user': { 'key': 'ue1-2d33e91b71e74929b4aeecc23f4376f1' }, + 'decisions': { + '2b0f82502298c9': { + 'adId': 2364764, + 'creativeId': 1950991, + 'flightId': 2788300, + 'campaignId': 542982, + 'clickUrl': 'https://e.serverbid.com/r', + 'impressionUrl': 'https://e.serverbid.com/i.gif', + 'contents': [{ + 'type': 'html', + 'body': '', + 'data': { + 'height': 90, + 'width': 728, + 'imageUrl': 'https://static.adzerk.net/Advertisers/b0ab77db8a7848c8b78931aed022a5ef.gif', + 'fileName': 'b0ab77db8a7848c8b78931aed022a5ef.gif' + }, + 'template': 'image' + }], + 'height': 90, + 'width': 728, + 'events': [], + 'pricing': {'price': 0.5, 'clearPrice': 0.5, 'revenue': 0.0005, 'rateType': 2, 'eCPM': 0.5} + }, + '123': { + 'adId': 2364764, + 'creativeId': 1950991, + 'flightId': 2788300, + 'campaignId': 542982, + 'clickUrl': 'https://e.serverbid.com/r', + 'impressionUrl': 'https://e.serverbid.com/i.gif', + 'contents': [{ + 'type': 'html', + 'body': '', + 'data': { + 'height': 90, + 'width': 728, + 'imageUrl': 'https://static.adzerk.net/Advertisers/b0ab77db8a7848c8b78931aed022a5ef.gif', + 'fileName': 'b0ab77db8a7848c8b78931aed022a5ef.gif' + }, + 'template': 'image' + }], + 'height': 90, + 'width': 728, + 'events': [], + 'pricing': {'price': 0.5, 'clearPrice': 0.5, 'revenue': 0.0005, 'rateType': 2, 'eCPM': 0.5} + } } - return bidderRequest; } +}; - describe('interpretResponse()', () => { - let bidderSettingsBackup; - let bidResponse; - let bidRequest; - let logWarnSpy; - - beforeEach(() => { - bidderSettingsBackup = $$PREBID_GLOBAL$$.bidderSettings; - bidRequest = { - bidderCode: 'test-bidder-code', - bidId: 'bid-id', - unitName: 'unitname', - unitId: '987654', - zoneId: '9599.1', - network: '9599.1' - }; - bidResponse = { - body: getDefaultBidResponse() +describe('Consumable BidAdapter', () => { + let bidRequests; + let adapter = spec; + + beforeEach(() => { + bidRequests = [ + { + bidder: 'consumable', + params: { + networkId: '9969', + siteId: '730181', + unitId: '123456', + unitName: 'cnsmbl-unit' + }, + placementCode: 'header-bid-tag-1', + sizes: [[300, 250], [300, 600]], + bidId: '23acc48ad47af5', + auctionId: '0fb4905b-9456-4152-86be-c6f6d259ba99', + bidderRequestId: '1c56ad30b9b8ca8', + transactionId: '92489f71-1bf2-49a0-adf9-000cea934729' + } + ]; + }); + + describe('bid request validation', () => { + it('should accept valid bid requests', () => { + let bid = { + bidder: 'consumable', + params: { + networkId: '9969', + siteId: '123', + unitId: '123456', + unitName: 'cnsmbl-unit' + } }; - logWarnSpy = sinon.spy(utils, 'logWarn'); + expect(spec.isBidRequestValid(bid)).to.equal(true); }); - afterEach(() => { - $$PREBID_GLOBAL$$.bidderSettings = bidderSettingsBackup; - logWarnSpy.restore(); + it('should accept valid bid requests with extra fields', () => { + let bid = { + bidder: 'consumable', + params: { + networkId: '9969', + siteId: '123', + unitId: '123456', + unitName: 'cnsmbl-unit', + zoneId: '123' + } + }; + expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return formatted bid response with required properties', () => { - let formattedBidResponse = spec.interpretResponse(bidResponse, bidRequest); - expect(formattedBidResponse).to.deep.equal({ - bidderCode: bidRequest.bidderCode, - requestId: 'bid-id', - ad: DEFAULT_AD_CONTENT, - cpm: 0.09, - width: 728, - height: 90, - creativeId: 'creative-id', - pubapiId: '245730051428950632', - currency: 'USD', - dealId: 'deal-id', - netRevenue: true, - ttl: 60 - }); + it('should reject bid requests without siteId', () => { + let bid = { + bidder: 'consumable', + params: { + networkId: '9969', + unitId: '123456', + unitName: 'cnsmbl-unit' + } + }; + expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should add formatted pixels to ad content when pixels are present in the response', () => { - bidResponse.body.ext = { - pixels: 'pixels-content' + it('should reject bid requests without networkId', () => { + let bid = { + bidder: 'consumable', + params: { + siteId: '9969', + unitId: '123456', + unitName: 'cnsmbl-unit' + } }; - - let formattedBidResponse = spec.interpretResponse(bidResponse, bidRequest); - - expect(formattedBidResponse.ad).to.equal(DEFAULT_AD_CONTENT + ''); - return true; + expect(spec.isBidRequestValid(bid)).to.equal(false); }); }); - describe('buildRequests()', () => { - it('method exists and is a function', () => { - expect(spec.buildRequests).to.exist.and.to.be.a('function'); + describe('buildRequests validation', () => { + it('creates request data', () => { + let request = spec.buildRequests(bidRequests); + + expect(request).to.exist.and.to.be.a('object'); }); - describe('Consumable', () => { - it('should not return request when no bids are present', () => { - let [request] = spec.buildRequests([]); - expect(request).to.be.empty; - }); + it('request to consumable should contain a url', () => { + let request = spec.buildRequests(bidRequests); - it('should return request for endpoint', () => { - let bidRequest = getDefaultBidRequest(); - let [request] = spec.buildRequests(bidRequest.bids); - expect(request.url).to.contain(CONSUMABLE_URL); - }); + expect(request.url).to.have.string('serverbid.com'); + }); - it('should return url with pubapi bid option', () => { - let bidRequest = getDefaultBidRequest(); - let [request] = spec.buildRequests(bidRequest.bids); - expect(request.url).to.contain('cmd=bid;'); - }); + it('requires valid bids to make request', () => { + let request = spec.buildRequests([]); + expect(request.bidRequest).to.be.empty; + }); - it('should return url with version 2 of pubapi', () => { - let bidRequest = getDefaultBidRequest(); - let [request] = spec.buildRequests(bidRequest.bids); - expect(request.url).to.contain('v=2;'); - }); + it('sends bid request to ENDPOINT via POST', () => { + let request = spec.buildRequests(bidRequests); - it('should return url with cache busting option', () => { - let bidRequest = getDefaultBidRequest(); - let [request] = spec.buildRequests(bidRequest.bids); - expect(request.url).to.match(/misc=\d+/); - }); + expect(request.method).to.have.string('POST'); }); }); + describe('interpretResponse validation', () => { + it('response should have valid bidderCode', () => { + let bidRequest = spec.buildRequests(REQUEST.bidRequest); + let bid = bidFactory.createBid(1, bidRequest.bidRequest[0]); + + expect(bid.bidderCode).to.equal('consumable'); + }); - describe('getUserSyncs()', () => { - let bidResponse; - let bidRequest; + it('response should include objects for all bids', () => { + let bids = spec.interpretResponse(RESPONSE, REQUEST); + expect(bids.length).to.equal(2); + }); - beforeEach(() => { - $$PREBID_GLOBAL$$.consumableGlobals.pixelsDropped = false; - config.setConfig({ - consumable: { - userSyncOn: 'bidResponse' - }, + it('registers bids', () => { + let bids = spec.interpretResponse(RESPONSE, REQUEST); + bids.forEach(b => { + expect(b).to.have.property('cpm'); + expect(b.cpm).to.be.above(0); + expect(b).to.have.property('requestId'); + expect(b).to.have.property('unitId'); + expect(b).to.have.property('unitName'); + expect(b).to.have.property('cpm'); + expect(b).to.have.property('width'); + expect(b).to.have.property('height'); + expect(b).to.have.property('ad'); + expect(b).to.have.property('currency', 'USD'); + expect(b).to.have.property('creativeId'); + expect(b).to.have.property('ttl', 360); + expect(b).to.have.property('netRevenue', true); + expect(b).to.have.property('referrer'); }); - bidResponse = getDefaultBidResponse(); - bidResponse.ext = { - pixels: getPixels() - }; }); - it('should return user syncs only if userSyncOn equals to "bidResponse"', () => { - let userSyncs = spec.getUserSyncs({}, [bidResponse], bidRequest); + it('handles nobid responses', () => { + let EMPTY_RESP = Object.assign({}, RESPONSE, {'body': {'decisions': null}}) + let bids = spec.interpretResponse(EMPTY_RESP, REQUEST); - expect($$PREBID_GLOBAL$$.consumableGlobals.pixelsDropped).to.be.true; - expect(userSyncs).to.deep.equal([ - {type: 'image', url: 'img.org'}, - {type: 'iframe', url: 'pixels1.org'} - ]); + expect(bids).to.be.empty; }); - it('should not return user syncs if it has already been returned', () => { - $$PREBID_GLOBAL$$.consumableGlobals.pixelsDropped = true; + it('handles no server response', () => { + let bids = spec.interpretResponse(null, REQUEST); - let userSyncs = spec.getUserSyncs({}, [bidResponse], bidRequest); - - expect($$PREBID_GLOBAL$$.consumableGlobals.pixelsDropped).to.be.true; - expect(userSyncs).to.deep.equal([]); + expect(bids).to.be.empty; }); + }); + describe('getUserSyncs', () => { + let syncOptions = {'iframeEnabled': true}; - it('should not return user syncs if pixels are not present', () => { - bidResponse.ext.pixels = null; + it('handles empty sync options', () => { + let opts = spec.getUserSyncs({}); + + expect(opts).to.be.empty; + }); - let userSyncs = spec.getUserSyncs({}, [bidResponse], bidRequest); + it('should return a sync url if iframe syncs are enabled', () => { + let opts = spec.getUserSyncs(syncOptions); - expect($$PREBID_GLOBAL$$.consumableGlobals.pixelsDropped).to.be.false; - expect(userSyncs).to.deep.equal([]); + expect(opts.length).to.equal(1); }); }); }); From 10b318a3526f43ef5d4c4fdc1bef8911f3b13c1e Mon Sep 17 00:00:00 2001 From: nwlosinski Date: Mon, 13 Aug 2018 17:08:47 +0200 Subject: [PATCH 15/83] returning tracking pixels (#2876) * returning tracking pixels * removed event on global object --- modules/justpremiumBidAdapter.js | 57 ++++++++++++++++++- .../modules/justpremiumBidAdapter_spec.js | 32 ++++++++++- 2 files changed, 85 insertions(+), 4 deletions(-) diff --git a/modules/justpremiumBidAdapter.js b/modules/justpremiumBidAdapter.js index 406fc166483..0f38f586a4d 100644 --- a/modules/justpremiumBidAdapter.js +++ b/modules/justpremiumBidAdapter.js @@ -3,8 +3,11 @@ import { getTopWindowLocation } from 'src/utils' const BIDDER_CODE = 'justpremium' const ENDPOINT_URL = getTopWindowLocation().protocol + '//pre.ads.justpremium.com/v/2.0/t/xhr' -const JP_ADAPTER_VERSION = '1.1' +const JP_ADAPTER_VERSION = '1.2' const pixels = [] +const TRACK_START_TIME = Date.now() +let LAST_PAYLOAD = {} +let AD_UNIT_IDS = [] export const spec = { code: BIDDER_CODE, @@ -17,6 +20,11 @@ export const spec = { buildRequests: (validBidRequests, bidderRequest) => { const c = preparePubCond(validBidRequests) const dim = getWebsiteDim() + AD_UNIT_IDS = validBidRequests.map(b => { + return b.adUnitCode + }).filter((value, index, self) => { + return self.indexOf(value) === index + }) const payload = { zone: validBidRequests.map(b => { return parseInt(b.params.zone) @@ -44,7 +52,7 @@ export const spec = { payload.gdpr_consent = { consent_string: bidderRequest.gdprConsent.consentString, consent_required: (typeof bidderRequest.gdprConsent.gdprApplies === 'boolean') ? bidderRequest.gdprConsent.gdprApplies : true - }; + } } payload.version = { @@ -54,6 +62,8 @@ export const spec = { const payloadString = JSON.stringify(payload) + LAST_PAYLOAD = payload + return { method: 'POST', url: ENDPOINT_URL + '?i=' + (+new Date()), @@ -97,10 +107,51 @@ export const spec = { pixels.push({ type: 'iframe', url: url - }); + }) } return pixels + }, + + onTimeout: (timeoutData) => { + timeoutData.forEach((data) => { + if (AD_UNIT_IDS.indexOf(data.adUnitCode) != -1) { + track(data, LAST_PAYLOAD, 'btm') + } + }) + }, + +} + +function track (data, payload, type) { + let pubUrl = '' + + let jp = { + auc: data.adUnitCode, + to: data.timeout } + + if (window.top == window) { + pubUrl = window.location.href + } else { + try { + pubUrl = window.top.location.href + } catch (e) { + pubUrl = document.referrer + } + } + + let duration = Date.now() - TRACK_START_TIME + + const pixelUrl = `${getTopWindowLocation().protocol}//emea-v3.tracking.justpremium.com/tracking.gif?rid=&sid=&uid=&vr=& +ru=${encodeURIComponent(pubUrl)}&tt=&siw=&sh=${payload.sh}&sw=${payload.sw}&wh=${payload.wh}&ww=${payload.ww}&an=&vn=& +sd=&_c=&et=&aid=&said=&ei=&fc=&sp=&at=bidder&cid=&ist=&mg=&dl=&dlt=&ev=&vt=&zid=${payload.id}&dr=${duration}&di=&pr=& +cw=&ch=&nt=&st=&jp=${encodeURIComponent(JSON.stringify(jp))}&ty=${type}` + + let img = document.createElement('img') + img.src = pixelUrl + img.id = 'jp-pixel-track' + img.style.cssText = 'display:none !important;' + document.body.appendChild(img) } function findBid (params, bids) { diff --git a/test/spec/modules/justpremiumBidAdapter_spec.js b/test/spec/modules/justpremiumBidAdapter_spec.js index 3b74b730044..eb6d17d7a32 100644 --- a/test/spec/modules/justpremiumBidAdapter_spec.js +++ b/test/spec/modules/justpremiumBidAdapter_spec.js @@ -4,6 +4,7 @@ import { spec } from 'modules/justpremiumBidAdapter' describe('justpremium adapter', () => { let adUnits = [ { + adUnitCode: 'div-gpt-ad-1471513102552-1', bidder: 'justpremium', params: { zone: 28313, @@ -11,6 +12,7 @@ describe('justpremium adapter', () => { } }, { + adUnitCode: 'div-gpt-ad-1471513102552-2', bidder: 'justpremium', params: { zone: 32831, @@ -51,7 +53,7 @@ describe('justpremium adapter', () => { expect(jpxRequest.id).to.equal(adUnits[0].params.zone) expect(jpxRequest.sizes).to.not.equal('undefined') expect(jpxRequest.version.prebid).to.equal('$prebid.version$') - expect(jpxRequest.version.jp_adapter).to.equal('1.1') + expect(jpxRequest.version.jp_adapter).to.equal('1.2') }) }) @@ -128,4 +130,32 @@ describe('justpremium adapter', () => { expect(options[0].url).to.match(/\/\/pre.ads.justpremium.com\/v\/1.0\/t\/sync/) }) }) + + describe('onTimeout', () => { + it('onTimeout', (done) => { + spec.onTimeout([{ + 'bidId': '25cd3ec3fd6ed7', + 'bidder': 'justpremium', + 'adUnitCode': 'div-gpt-ad-1471513102552-1', + 'auctionId': '6fbd0562-f613-4151-a6df-6cb446fc717b', + 'params': [{ + 'adType': 'iab', + 'zone': 21521 + }], + 'timeout': 1 + }, { + 'bidId': '3b51df1f254e32', + 'bidder': 'justpremium', + 'adUnitCode': 'div-gpt-ad-1471513102552-3', + 'auctionId': '6fbd0562-f613-4151-a6df-6cb446fc717b', + 'params': [{ + 'adType': 'iab', + 'zone': 21521 + }], + 'timeout': 1 + }]) + + done() + }) + }) }) From bd607504cf208563b42d41742c9f3686fde3d182 Mon Sep 17 00:00:00 2001 From: onaydenov Date: Mon, 13 Aug 2018 17:12:27 +0200 Subject: [PATCH 16/83] Fidelity Media fmxSSP. Adding GDPR Support (#2935) * Add GDPR support * Add GDPR Support * Add GDPR support. Amended .js --- modules/fidelityBidAdapter.js | 42 +++++++++++++++----- test/spec/modules/fidelityBidAdapter_spec.js | 28 +++++++++++-- 2 files changed, 56 insertions(+), 14 deletions(-) diff --git a/modules/fidelityBidAdapter.js b/modules/fidelityBidAdapter.js index ca7dc9d6fd6..fbe5e4b01cd 100644 --- a/modules/fidelityBidAdapter.js +++ b/modules/fidelityBidAdapter.js @@ -3,6 +3,7 @@ import {registerBidder} from 'src/adapters/bidderFactory'; const BIDDER_CODE = 'fidelity'; const BIDDER_SERVER = 'x.fidelity-media.com'; +const FIDELITY_VENDOR_ID = 408; export const spec = { code: BIDDER_CODE, isBidRequestValid: function(bid) { @@ -20,16 +21,14 @@ export const spec = { zoneid: bidRequest.params.zoneid, floor: parseFloat(bidRequest.params.floor) > 0 ? bidRequest.params.floor : 0, charset: document.charSet || document.characterSet, - defloc: utils.getTopWindowUrl(), - altloc: window.location.href, subid: 'hb', flashver: getFlashVersion(), tmax: bidderRequest.timeout, + defloc: utils.getTopWindowUrl(), + referrer: utils.getTopWindowReferrer(), }; - if (document.referrer) { - payload.referrer = document.referrer; - } - + setConsentParams(bidderRequest.gdprConsent, payload); + return { method: 'GET', url: '//' + server + '/delivery/hb.php', @@ -59,12 +58,18 @@ export const spec = { } return bidResponses; }, - getUserSyncs: function getUserSyncs(syncOptions) { - if (syncOptions.iframeEnabled) { + getUserSyncs: function getUserSyncs(syncOptions, serverResponses, gdprConsent) { + if (syncOptions.iframeEnabled) { + var url = '//' + BIDDER_SERVER + '/delivery/matches.php'; + var payload = { + type: 'iframe' + }; + setConsentParams(gdprConsent, payload); + return [{ type: 'iframe', - url: '//' + BIDDER_SERVER + '/delivery/matches.php?type=iframe', - }]; + url: url + '?' + utils.parseQueryStringParameters(payload).replace(/\&$/, '') + }]; } } } @@ -84,4 +89,21 @@ function getFlashVersion() { return result || ''; } +function setConsentParams(gdprConsent, payload) { + if (gdprConsent) { + payload.gdpr = 0; + payload.consent_str = ''; + payload.consent_given = 0; + if (typeof gdprConsent.gdprApplies !== 'undefined') { + payload.gdpr = gdprConsent.gdprApplies ? 1 : 0; + } + if (typeof gdprConsent.consentString !== 'undefined') { + payload.consent_str = gdprConsent.consentString; + } + if (gdprConsent.vendorData && gdprConsent.vendorData.vendorConsents && typeof gdprConsent.vendorData.vendorConsents[FIDELITY_VENDOR_ID.toString(10)] !== 'undefined') { + payload.consent_given = gdprConsent.vendorData.vendorConsents[FIDELITY_VENDOR_ID.toString(10)] ? 1 : 0; + } + } +} + registerBidder(spec); diff --git a/test/spec/modules/fidelityBidAdapter_spec.js b/test/spec/modules/fidelityBidAdapter_spec.js index 28ea18aacac..007f4e6b480 100644 --- a/test/spec/modules/fidelityBidAdapter_spec.js +++ b/test/spec/modules/fidelityBidAdapter_spec.js @@ -52,7 +52,7 @@ describe('FidelityAdapter', () => { describe('buildRequests', () => { let bidderRequest = { bidderCode: 'fidelity', - auctionId: 'c45dd708-a418-42ec-b8a7-b70a6c6fab0a', + requestId: 'c45dd708-a418-42ec-b8a7-b70a6c6fab0a', bidderRequestId: '178e34bad3658f', bids: [ { @@ -66,7 +66,7 @@ describe('FidelityAdapter', () => { sizes: [[300, 250], [320, 50]], bidId: '2ffb201a808da7', bidderRequestId: '178e34bad3658f', - auctionId: 'c45dd708-a418-42ec-b8a7-b70a6c6fab0a', + requestId: 'c45dd708-a418-42ec-b8a7-b70a6c6fab0a', transactionId: 'd45dd707-a418-42ec-b8a7-b70a6c6fab0b' } ], @@ -85,11 +85,31 @@ describe('FidelityAdapter', () => { expect(payload.zoneid).to.exist; expect(payload.floor).to.exist; expect(payload.charset).to.exist; - expect(payload.defloc).to.exist; - expect(payload.altloc).to.exist; expect(payload.subid).to.exist; expect(payload.flashver).to.exist; expect(payload.tmax).to.exist; + expect(payload.defloc).to.exist; + }); + + it('should add gdpr consent information to the request', () => { + let consentString = 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A=='; + bidderRequest.gdprConsent = { + gdprApplies: true, + consentString: consentString, + vendorData: { + vendorConsents: { + '408': 1 + }, + }, + }; + const [request] = spec.buildRequests(bidderRequest.bids, bidderRequest); + const payload = request.data; + expect(payload.gdpr).to.exist.and.to.be.a('number'); + expect(payload.gdpr).to.equal(1); + expect(payload.consent_str).to.exist.and.to.be.a('string'); + expect(payload.consent_str).to.equal(consentString); + expect(payload.consent_given).to.exist.and.to.be.a('number'); + expect(payload.consent_given).to.equal(1); }); it('sends bid request to ENDPOINT via GET', () => { From 700d5f24cc92d9f1e3a4ede79f54cb1ce20cac48 Mon Sep 17 00:00:00 2001 From: Jaimin Panchal Date: Mon, 13 Aug 2018 11:45:11 -0400 Subject: [PATCH 17/83] lint fix (#2972) --- modules/fidelityBidAdapter.js | 106 +++++++++++++++++----------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/modules/fidelityBidAdapter.js b/modules/fidelityBidAdapter.js index fbe5e4b01cd..08a032bcba9 100644 --- a/modules/fidelityBidAdapter.js +++ b/modules/fidelityBidAdapter.js @@ -1,14 +1,14 @@ -import * as utils from 'src/utils'; -import {registerBidder} from 'src/adapters/bidderFactory'; - -const BIDDER_CODE = 'fidelity'; -const BIDDER_SERVER = 'x.fidelity-media.com'; -const FIDELITY_VENDOR_ID = 408; -export const spec = { - code: BIDDER_CODE, - isBidRequestValid: function(bid) { - return !!(bid && bid.params && bid.params.zoneid); - }, +import * as utils from 'src/utils'; +import {registerBidder} from 'src/adapters/bidderFactory'; + +const BIDDER_CODE = 'fidelity'; +const BIDDER_SERVER = 'x.fidelity-media.com'; +const FIDELITY_VENDOR_ID = 408; +export const spec = { + code: BIDDER_CODE, + isBidRequestValid: function(bid) { + return !!(bid && bid.params && bid.params.zoneid); + }, buildRequests: function(validBidRequests, bidderRequest) { return validBidRequests.map(bidRequest => { var server = bidRequest.params.server || BIDDER_SERVER; @@ -25,10 +25,10 @@ export const spec = { flashver: getFlashVersion(), tmax: bidderRequest.timeout, defloc: utils.getTopWindowUrl(), - referrer: utils.getTopWindowReferrer(), + referrer: utils.getTopWindowReferrer(), }; - setConsentParams(bidderRequest.gdprConsent, payload); - + setConsentParams(bidderRequest.gdprConsent, payload); + return { method: 'GET', url: '//' + server + '/delivery/hb.php', @@ -36,13 +36,13 @@ export const spec = { }; }); }, - interpretResponse: function(serverResponse) { - serverResponse = serverResponse.body; + interpretResponse: function(serverResponse) { + serverResponse = serverResponse.body; const bidResponses = []; if (serverResponse && serverResponse.seatbid) { serverResponse.seatbid.forEach(seatBid => seatBid.bid.forEach(bid => { const bidResponse = { - requestId: bid.impid, + requestId: bid.impid, creativeId: bid.impid, cpm: bid.price, width: bid.width, @@ -50,30 +50,30 @@ export const spec = { ad: bid.adm, netRevenue: bid.netRevenue, currency: bid.cur, - ttl: bid.ttl, + ttl: bid.ttl, }; bidResponses.push(bidResponse); })); } - return bidResponses; + return bidResponses; }, getUserSyncs: function getUserSyncs(syncOptions, serverResponses, gdprConsent) { - if (syncOptions.iframeEnabled) { - var url = '//' + BIDDER_SERVER + '/delivery/matches.php'; - var payload = { - type: 'iframe' - }; - setConsentParams(gdprConsent, payload); - - return [{ - type: 'iframe', - url: url + '?' + utils.parseQueryStringParameters(payload).replace(/\&$/, '') - }]; + if (syncOptions.iframeEnabled) { + var url = '//' + BIDDER_SERVER + '/delivery/matches.php'; + var payload = { + type: 'iframe' + }; + setConsentParams(gdprConsent, payload); + + return [{ + type: 'iframe', + url: url + '?' + utils.parseQueryStringParameters(payload).replace(/\&$/, '') + }]; } - } -} - + } +} + function getFlashVersion() { var plugins, plugin, result; @@ -87,23 +87,23 @@ function getFlashVersion() { } } return result || ''; -} - -function setConsentParams(gdprConsent, payload) { - if (gdprConsent) { - payload.gdpr = 0; - payload.consent_str = ''; - payload.consent_given = 0; - if (typeof gdprConsent.gdprApplies !== 'undefined') { - payload.gdpr = gdprConsent.gdprApplies ? 1 : 0; - } - if (typeof gdprConsent.consentString !== 'undefined') { - payload.consent_str = gdprConsent.consentString; - } - if (gdprConsent.vendorData && gdprConsent.vendorData.vendorConsents && typeof gdprConsent.vendorData.vendorConsents[FIDELITY_VENDOR_ID.toString(10)] !== 'undefined') { - payload.consent_given = gdprConsent.vendorData.vendorConsents[FIDELITY_VENDOR_ID.toString(10)] ? 1 : 0; - } - } -} - -registerBidder(spec); +} + +function setConsentParams(gdprConsent, payload) { + if (gdprConsent) { + payload.gdpr = 0; + payload.consent_str = ''; + payload.consent_given = 0; + if (typeof gdprConsent.gdprApplies !== 'undefined') { + payload.gdpr = gdprConsent.gdprApplies ? 1 : 0; + } + if (typeof gdprConsent.consentString !== 'undefined') { + payload.consent_str = gdprConsent.consentString; + } + if (gdprConsent.vendorData && gdprConsent.vendorData.vendorConsents && typeof gdprConsent.vendorData.vendorConsents[FIDELITY_VENDOR_ID.toString(10)] !== 'undefined') { + payload.consent_given = gdprConsent.vendorData.vendorConsents[FIDELITY_VENDOR_ID.toString(10)] ? 1 : 0; + } + } +} + +registerBidder(spec); From 5b4e3828111dd3b9a6c5965fdcd67800c0bd838e Mon Sep 17 00:00:00 2001 From: Matt Kendall <1870166+mkendall07@users.noreply.github.com> Date: Mon, 13 Aug 2018 12:03:42 -0400 Subject: [PATCH 18/83] Fix safeFrame resize issue (#2947) * the dfp container div was not being resized, which results in content overlap * little cleanup --- src/secureCreatives.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/secureCreatives.js b/src/secureCreatives.js index 424d1402831..2204a6e7643 100644 --- a/src/secureCreatives.js +++ b/src/secureCreatives.js @@ -69,10 +69,14 @@ function sendAdToCreative(adObject, remoteDomain, source) { } function resizeRemoteCreative({ adUnitCode, width, height }) { - const iframe = document.getElementById( - find(window.googletag.pubads().getSlots().filter(isSlotMatchingAdUnitCode(adUnitCode)), slot => slot) - .getSlotElementId()).querySelector('iframe'); - - iframe.width = '' + width; - iframe.height = '' + height; + // resize both container div + iframe + ['div', 'iframe'].forEach(elmType => { + let elementStyle = getElementByAdUnit(elmType).style; + elementStyle.width = width; + elementStyle.height = height; + }); + function getElementByAdUnit(elmType) { + return document.getElementById(find(window.googletag.pubads().getSlots().filter(isSlotMatchingAdUnitCode(adUnitCode)), slot => slot) + .getSlotElementId()).querySelector(elmType); + } } From aa2860095b210f982013c720cd245424c0662dcb Mon Sep 17 00:00:00 2001 From: Samuel Horwitz Date: Mon, 13 Aug 2018 13:54:18 -0400 Subject: [PATCH 19/83] kargo analytics adapter (#2939) --- modules/kargoAnalyticsAdapter.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 modules/kargoAnalyticsAdapter.js diff --git a/modules/kargoAnalyticsAdapter.js b/modules/kargoAnalyticsAdapter.js new file mode 100644 index 00000000000..6bb77d926b5 --- /dev/null +++ b/modules/kargoAnalyticsAdapter.js @@ -0,0 +1,14 @@ +import adapter from 'src/AnalyticsAdapter'; +import adaptermanager from 'src/adaptermanager'; + +var kargoAdapter = adapter({ + analyticsType: 'endpoint', + url: 'https://krk.kargo.com/api/v1/event/prebid' +}); + +adaptermanager.registerAnalyticsAdapter({ + adapter: kargoAdapter, + code: 'kargo' +}); + +export default kargoAdapter; From 6f43b6bb1afd1e2799541f24f54d04803105f329 Mon Sep 17 00:00:00 2001 From: PWyrembak Date: Tue, 14 Aug 2018 02:46:50 +0300 Subject: [PATCH 20/83] Add wtimeout parameter in ad request for TrustX Bid Adapter (#2968) * Add wtimeout to ad request params for TrustX Bid Adapter * TrustX Bid Adapter: remove last ampersand in the ad request --- modules/trustxBidAdapter.js | 21 ++++++----- test/spec/modules/trustxBidAdapter_spec.js | 42 +++++++++++++--------- 2 files changed, 38 insertions(+), 25 deletions(-) diff --git a/modules/trustxBidAdapter.js b/modules/trustxBidAdapter.js index 3688aa3b976..20e000e3379 100644 --- a/modules/trustxBidAdapter.js +++ b/modules/trustxBidAdapter.js @@ -60,19 +60,24 @@ export const spec = { r: reqId }; - if (bidderRequest && bidderRequest.gdprConsent) { - if (bidderRequest.gdprConsent.consentString) { - payload.gdpr_consent = bidderRequest.gdprConsent.consentString; + if (bidderRequest) { + if (bidderRequest.timeout) { + payload.wtimeout = bidderRequest.timeout; + } + if (bidderRequest.gdprConsent) { + if (bidderRequest.gdprConsent.consentString) { + payload.gdpr_consent = bidderRequest.gdprConsent.consentString; + } + payload.gdpr_applies = + (typeof bidderRequest.gdprConsent.gdprApplies === 'boolean') + ? Number(bidderRequest.gdprConsent.gdprApplies) : 1; } - payload.gdpr_applies = - (typeof bidderRequest.gdprConsent.gdprApplies === 'boolean') - ? Number(bidderRequest.gdprConsent.gdprApplies) : 1; } return { method: 'GET', url: ENDPOINT_URL, - data: payload, + data: utils.parseQueryStringParameters(payload).replace(/\&$/, ''), bidsMap: bidsMap, }; }, @@ -84,7 +89,7 @@ export const spec = { * @return {Bid[]} An array of bids which were nested inside the server. */ interpretResponse: function(serverResponse, bidRequest) { - serverResponse = serverResponse && serverResponse.body + serverResponse = serverResponse && serverResponse.body; const bidResponses = []; const bidsMap = bidRequest.bidsMap; const priceType = bidRequest.data.pt; diff --git a/test/spec/modules/trustxBidAdapter_spec.js b/test/spec/modules/trustxBidAdapter_spec.js index 75405850d7a..2e099772593 100644 --- a/test/spec/modules/trustxBidAdapter_spec.js +++ b/test/spec/modules/trustxBidAdapter_spec.js @@ -39,6 +39,14 @@ describe('TrustXAdapter', function () { }); describe('buildRequests', () => { + function parseRequest(url) { + const res = {}; + url.split('&').forEach((it) => { + const couple = it.split('='); + res[couple[0]] = decodeURIComponent(couple[1]); + }); + return res; + } let bidRequests = [ { 'bidder': 'trustx', @@ -77,8 +85,8 @@ describe('TrustXAdapter', function () { it('should attach valid params to the tag', () => { const request = spec.buildRequests([bidRequests[0]]); - const payload = request.data; - expect(payload).to.be.an('object'); + expect(request.data).to.be.an('string'); + const payload = parseRequest(request.data); expect(payload).to.have.property('u').that.is.a('string'); expect(payload).to.have.property('pt', 'net'); expect(payload).to.have.property('auids', '43'); @@ -87,8 +95,8 @@ describe('TrustXAdapter', function () { it('auids must not be duplicated', () => { const request = spec.buildRequests(bidRequests); - const payload = request.data; - expect(payload).to.be.an('object'); + expect(request.data).to.be.an('string'); + const payload = parseRequest(request.data); expect(payload).to.have.property('u').that.is.a('string'); expect(payload).to.have.property('pt', 'net'); expect(payload).to.have.property('auids', '43,45'); @@ -98,8 +106,8 @@ describe('TrustXAdapter', function () { it('pt parameter must be "gross" if params.priceType === "gross"', () => { bidRequests[1].params.priceType = 'gross'; const request = spec.buildRequests(bidRequests); - const payload = request.data; - expect(payload).to.be.an('object'); + expect(request.data).to.be.an('string'); + const payload = parseRequest(request.data); expect(payload).to.have.property('u').that.is.a('string'); expect(payload).to.have.property('pt', 'gross'); expect(payload).to.have.property('auids', '43,45'); @@ -110,8 +118,8 @@ describe('TrustXAdapter', function () { it('pt parameter must be "net" or "gross"', () => { bidRequests[1].params.priceType = 'some'; const request = spec.buildRequests(bidRequests); - const payload = request.data; - expect(payload).to.be.an('object'); + expect(request.data).to.be.an('string'); + const payload = parseRequest(request.data); expect(payload).to.have.property('u').that.is.a('string'); expect(payload).to.have.property('pt', 'net'); expect(payload).to.have.property('auids', '43,45'); @@ -121,26 +129,26 @@ describe('TrustXAdapter', function () { it('if gdprConsent is present payload must have gdpr params', () => { const request = spec.buildRequests(bidRequests, {gdprConsent: {consentString: 'AAA', gdprApplies: true}}); - const payload = request.data; - expect(payload).to.be.an('object'); + expect(request.data).to.be.an('string'); + const payload = parseRequest(request.data); expect(payload).to.have.property('gdpr_consent', 'AAA'); - expect(payload).to.have.property('gdpr_applies', 1); + expect(payload).to.have.property('gdpr_applies', '1'); }); it('if gdprApplies is false gdpr_applies must be 0', () => { const request = spec.buildRequests(bidRequests, {gdprConsent: {consentString: 'AAA', gdprApplies: false}}); - const payload = request.data; - expect(payload).to.be.an('object'); + expect(request.data).to.be.an('string'); + const payload = parseRequest(request.data); expect(payload).to.have.property('gdpr_consent', 'AAA'); - expect(payload).to.have.property('gdpr_applies', 0); + expect(payload).to.have.property('gdpr_applies', '0'); }); it('if gdprApplies is undefined gdpr_applies must be 1', () => { const request = spec.buildRequests(bidRequests, {gdprConsent: {consentString: 'AAA'}}); - const payload = request.data; - expect(payload).to.be.an('object'); + expect(request.data).to.be.an('string'); + const payload = parseRequest(request.data); expect(payload).to.have.property('gdpr_consent', 'AAA'); - expect(payload).to.have.property('gdpr_applies', 1); + expect(payload).to.have.property('gdpr_applies', '1'); }); }); From 8134b0315a7de57c70122c7ebf8e9820c18a9cf5 Mon Sep 17 00:00:00 2001 From: Bas van Schaik Date: Tue, 14 Aug 2018 15:48:40 +0100 Subject: [PATCH 21/83] Add LGTM.com alert count badge (#2956) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index fa3a11fbb88..e43833fd4d2 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ [![Code Climate](https://codeclimate.com/github/prebid/Prebid.js/badges/gpa.svg)](https://codeclimate.com/github/prebid/Prebid.js) [![Coverage Status](https://coveralls.io/repos/github/prebid/Prebid.js/badge.svg)](https://coveralls.io/github/prebid/Prebid.js) [![devDependencies Status](https://david-dm.org/prebid/Prebid.js/dev-status.svg)](https://david-dm.org/prebid/Prebid.js?type=dev) +[![Total Alerts](https://img.shields.io/lgtm/alerts/g/prebid/Prebid.js.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/prebid/Prebid.js/alerts/) # Prebid.js From e643997d45f0fbefc3e75e08e8513a080bd34ef9 Mon Sep 17 00:00:00 2001 From: Andy Blackwell Date: Tue, 14 Aug 2018 11:12:00 -0500 Subject: [PATCH 22/83] modified console logging to include a Prebid label, and normalized the calls to all work with N args like the native methods (#2966) --- src/utils.js | 70 ++++++++++++++++++++++------------------------------ 1 file changed, 30 insertions(+), 40 deletions(-) diff --git a/src/utils.js b/src/utils.js index ac7f035d652..db50745ebcc 100644 --- a/src/utils.js +++ b/src/utils.js @@ -14,13 +14,11 @@ var tNumb = 'Number'; var tObject = 'Object'; var tBoolean = 'Boolean'; var toString = Object.prototype.toString; -let infoLogger = null; -let warnLogger = null; -try { - infoLogger = console.info.bind(window.console); - warnLogger = console.warn.bind(window.console); -} catch (e) { -} +let consoleExists = Boolean(window.console); +let consoleLogExists = Boolean(consoleExists && window.console.log); +let consoleInfoExists = Boolean(consoleExists && window.console.info); +let consoleWarnExists = Boolean(consoleExists && window.console.warn); +let consoleErrorExists = Boolean(consoleExists && window.console.error); /* * Substitutes into a string from a given map using the token @@ -260,42 +258,43 @@ exports.getTopWindowReferrer = function() { } }; -exports.logWarn = function (msg, args) { - if (debugTurnedOn() && console.warn) { - if (warnLogger) { - if (!args || args.length === 0) { - args = ''; - } - - warnLogger('WARNING: ' + msg + ((args === '') ? '' : ' : params : '), args); - } +/** + * Wrappers to console.(log | info | warn | error). Takes N arguments, the same as the native methods + */ +exports.logMessage = function () { + if (debugTurnedOn() && consoleLogExists) { + console.log.apply(console, decorateLog(arguments, 'MESSAGE:')); } }; -exports.logInfo = function (msg, args) { - if (debugTurnedOn() && hasConsoleLogger()) { - if (infoLogger) { - if (!args || args.length === 0) { - args = ''; - } +exports.logInfo = function () { + if (debugTurnedOn() && consoleInfoExists) { + console.info.apply(console, decorateLog(arguments, 'INFO:')); + } +}; - infoLogger('INFO: ' + msg + ((args === '') ? '' : ' : params : '), args); - } +exports.logWarn = function () { + if (debugTurnedOn() && consoleWarnExists) { + console.warn.apply(console, decorateLog(arguments, 'WARNING:')); } }; -exports.logMessage = function (msg) { - if (debugTurnedOn() && hasConsoleLogger()) { - console.log('MESSAGE: ' + msg); +exports.logError = function () { + if (debugTurnedOn() && consoleErrorExists) { + console.error.apply(console, decorateLog(arguments, 'ERROR:')); } }; -function hasConsoleLogger() { - return (window.console && window.console.log); +function decorateLog(args, prefix) { + args = [].slice.call(args); + prefix && args.unshift(prefix); + args.unshift('display: inline-block; color: #fff; background: #3b88c3; padding: 1px 4px; border-radius: 3px;'); + args.unshift('%cPrebid'); + return args; } -function hasConsoleError() { - return (window.console && window.console.error); +function hasConsoleLogger() { + return consoleLogExists; } exports.hasConsoleLogger = hasConsoleLogger; @@ -312,15 +311,6 @@ var debugTurnedOn = function () { exports.debugTurnedOn = debugTurnedOn; -/** - * Wrapper to console.error. Takes N arguments to log the same as console.error. - */ -exports.logError = function () { - if (debugTurnedOn() && hasConsoleError()) { - console.error.apply(console, arguments); - } -}; - exports.createInvisibleIframe = function _createInvisibleIframe() { var f = document.createElement('iframe'); f.id = _getUniqueIdentifierStr(); From 6cc84aa03d7f2a830a8d0aba7e599bdada153d8f Mon Sep 17 00:00:00 2001 From: Vedant Seta Date: Tue, 14 Aug 2018 21:44:55 +0530 Subject: [PATCH 23/83] Feature : Display counter at Adslot level (#2940) * adunit refresh counter added * refresh counter added for media.net adapter * jsdoc added * renamed displayCount to bidRequestsCount --- modules/medianetBidAdapter.js | 3 +- src/adUnits.js | 34 ++++++++++++++++++ src/adaptermanager.js | 4 ++- src/prebid.js | 2 ++ test/spec/modules/medianetBidAdapter_spec.js | 36 +++++++++++++------- test/spec/unit/adUnits_spec.js | 23 +++++++++++++ 6 files changed, 88 insertions(+), 14 deletions(-) create mode 100644 src/adUnits.js create mode 100644 test/spec/unit/adUnits_spec.js diff --git a/modules/medianetBidAdapter.js b/modules/medianetBidAdapter.js index 4ff7bfd000e..07c721371bd 100644 --- a/modules/medianetBidAdapter.js +++ b/modules/medianetBidAdapter.js @@ -122,7 +122,8 @@ function slotParams(bidRequest) { let params = { id: bidRequest.bidId, ext: { - dfp_id: bidRequest.adUnitCode + dfp_id: bidRequest.adUnitCode, + display_count: bidRequest.bidRequestsCount }, banner: transformSizes(bidRequest.sizes), all: bidRequest.params diff --git a/src/adUnits.js b/src/adUnits.js new file mode 100644 index 00000000000..bbdc82b6073 --- /dev/null +++ b/src/adUnits.js @@ -0,0 +1,34 @@ +import { deepAccess } from './utils'; + +let adUnits = {}; + +/** + * Increments and returns current Adunit counter + * @param {string} adunit id + * @returns {number} current adunit count + */ +function incrementCounter(adunit) { + adUnits[adunit] = adUnits[adunit] || {}; + adUnits[adunit].counter = (deepAccess(adUnits, `${adunit}.counter`) + 1) || 1; + return adUnits[adunit].counter; +} + +/** + * Returns current Adunit counter + * @param {string} adunit id + * @returns {number} current adunit count + */ +function getCounter(adunit) { + return deepAccess(adUnits, `${adunit}.counter`) || 0; +} + +/** + * A module which counts how many times an adunit was called + * @module adunitCounter + */ +let adunitCounter = { + incrementCounter, + getCounter +} + +export { adunitCounter }; diff --git a/src/adaptermanager.js b/src/adaptermanager.js index 5f0ac5b5656..009ba18347b 100644 --- a/src/adaptermanager.js +++ b/src/adaptermanager.js @@ -8,6 +8,7 @@ import { ajaxBuilder } from 'src/ajax'; import { config, RANDOM } from 'src/config'; import includes from 'core-js/library/fn/array/includes'; import find from 'core-js/library/fn/array/find'; +import { adunitCounter } from './adUnits'; var utils = require('./utils.js'); var CONSTANTS = require('./constants.json'); @@ -95,7 +96,8 @@ function getBids({bidderCode, auctionId, bidderRequestId, adUnits, labels}) { sizes: sizes, bidId: bid.bid_id || utils.getUniqueIdentifierStr(), bidderRequestId, - auctionId + auctionId, + bidRequestsCount: adunitCounter.getCounter(adUnit.code) })); } return bids; diff --git a/src/prebid.js b/src/prebid.js index 75e1d117c2a..ac7731d92fd 100644 --- a/src/prebid.js +++ b/src/prebid.js @@ -11,6 +11,7 @@ import { targeting, getHighestCpmBidsFromBidPool, RENDERED, BID_TARGETING_SET } import { createHook } from 'src/hook'; import { sessionLoader } from 'src/debugging'; import includes from 'core-js/library/fn/array/includes'; +import { adunitCounter } from './adUnits'; const $$PREBID_GLOBAL$$ = getGlobal(); const CONSTANTS = require('./constants.json'); @@ -367,6 +368,7 @@ $$PREBID_GLOBAL$$.requestBids = createHook('asyncSeries', function ({ bidsBackHa adUnit.bids = adUnit.bids.filter(bid => bid.bidder !== bidder); } }); + adunitCounter.incrementCounter(adUnit.code); }); if (!adUnits || adUnits.length === 0) { diff --git a/test/spec/modules/medianetBidAdapter_spec.js b/test/spec/modules/medianetBidAdapter_spec.js index d94cb64c145..027b23f54bb 100644 --- a/test/spec/modules/medianetBidAdapter_spec.js +++ b/test/spec/modules/medianetBidAdapter_spec.js @@ -17,7 +17,8 @@ let VALID_BID_REQUEST = [{ 'sizes': [[300, 250]], 'bidId': '28f8f8130a583e', 'bidderRequestId': '1e9b1f07797c1c', - 'auctionId': 'aafabfd0-28c0-4ac0-aa09-99689e88b81d' + 'auctionId': 'aafabfd0-28c0-4ac0-aa09-99689e88b81d', + 'bidRequestsCount': 1 }, { 'bidder': 'medianet', 'params': { @@ -33,7 +34,8 @@ let VALID_BID_REQUEST = [{ 'sizes': [[300, 251]], 'bidId': '3f97ca71b1e5c2', 'bidderRequestId': '1e9b1f07797c1c', - 'auctionId': 'aafabfd0-28c0-4ac0-aa09-99689e88b81d' + 'auctionId': 'aafabfd0-28c0-4ac0-aa09-99689e88b81d', + 'bidRequestsCount': 1 }], VALID_BID_REQUEST_INVALID_BIDFLOOR = [{ 'bidder': 'medianet', @@ -51,7 +53,8 @@ let VALID_BID_REQUEST = [{ 'sizes': [[300, 250]], 'bidId': '28f8f8130a583e', 'bidderRequestId': '1e9b1f07797c1c', - 'auctionId': 'aafabfd0-28c0-4ac0-aa09-99689e88b81d' + 'auctionId': 'aafabfd0-28c0-4ac0-aa09-99689e88b81d', + 'bidRequestsCount': 1 }, { 'bidder': 'medianet', 'params': { @@ -67,7 +70,8 @@ let VALID_BID_REQUEST = [{ 'sizes': [[300, 251]], 'bidId': '3f97ca71b1e5c2', 'bidderRequestId': '1e9b1f07797c1c', - 'auctionId': 'aafabfd0-28c0-4ac0-aa09-99689e88b81d' + 'auctionId': 'aafabfd0-28c0-4ac0-aa09-99689e88b81d', + 'bidRequestsCount': 1 }], VALID_AUCTIONDATA = { 'timeout': config.getConfig('bidderTimeout'), @@ -103,7 +107,8 @@ let VALID_BID_REQUEST = [{ x: 100, y: 100 } - } + }, + 'display_count': 1 }, 'banner': [{ 'w': 300, @@ -133,7 +138,8 @@ let VALID_BID_REQUEST = [{ x: 100, y: 100 } - } + }, + 'display_count': 1 }, 'banner': [{ 'w': 300, @@ -181,7 +187,8 @@ let VALID_BID_REQUEST = [{ x: 100, y: 100 } - } + }, + 'display_count': 1 }, 'banner': [{ 'w': 300, @@ -210,7 +217,8 @@ let VALID_BID_REQUEST = [{ x: 100, y: 100 } - } + }, + 'display_count': 1 }, 'banner': [{ 'w': 300, @@ -372,7 +380,8 @@ let VALID_BID_REQUEST = [{ 'sizes': [300, 250], 'bidId': '28f8f8130a583e', 'bidderRequestId': '1e9b1f07797c1c', - 'auctionId': 'aafabfd0-28c0-4ac0-aa09-99689e88b81d' + 'auctionId': 'aafabfd0-28c0-4ac0-aa09-99689e88b81d', + 'bidRequestsCount': 1 }, { 'bidder': 'medianet', 'params': { @@ -388,7 +397,8 @@ let VALID_BID_REQUEST = [{ 'sizes': [300, 251], 'bidId': '3f97ca71b1e5c2', 'bidderRequestId': '1e9b1f07797c1c', - 'auctionId': 'aafabfd0-28c0-4ac0-aa09-99689e88b81d' + 'auctionId': 'aafabfd0-28c0-4ac0-aa09-99689e88b81d', + 'bidRequestsCount': 1 }], VALID_BIDDER_REQUEST_WITH_GDPR = { 'gdprConsent': { @@ -429,7 +439,8 @@ let VALID_BID_REQUEST = [{ x: 100, y: 100 } - } + }, + 'display_count': 1 }, 'banner': [{ 'w': 300, @@ -458,7 +469,8 @@ let VALID_BID_REQUEST = [{ x: 100, y: 100 } - } + }, + 'display_count': 1 }, 'banner': [{ 'w': 300, diff --git a/test/spec/unit/adUnits_spec.js b/test/spec/unit/adUnits_spec.js new file mode 100644 index 00000000000..ff77315ba4a --- /dev/null +++ b/test/spec/unit/adUnits_spec.js @@ -0,0 +1,23 @@ +import { expect } from 'chai'; +import { adunitCounter } from 'src/adUnits'; + +describe('Adunit Counter', function () { + const ADUNIT_ID_1 = 'test1'; + const ADUNIT_ID_2 = 'test2'; + + it('increments and checks counter of adunit 1', function () { + adunitCounter.incrementCounter(ADUNIT_ID_1); + expect(adunitCounter.getCounter(ADUNIT_ID_1)).to.be.equal(1); + }); + it('checks counter of adunit 2', function () { + expect(adunitCounter.getCounter(ADUNIT_ID_2)).to.be.equal(0); + }); + it('increments and checks counter of adunit 1', function () { + adunitCounter.incrementCounter(ADUNIT_ID_1); + expect(adunitCounter.getCounter(ADUNIT_ID_1)).to.be.equal(2); + }); + it('increments and checks counter of adunit 2', function () { + adunitCounter.incrementCounter(ADUNIT_ID_2); + expect(adunitCounter.getCounter(ADUNIT_ID_2)).to.be.equal(1); + }); +}); From 4ba1d4542e144c931b8b372e5b860f1c96a6d588 Mon Sep 17 00:00:00 2001 From: Samuel Horwitz Date: Tue, 14 Aug 2018 14:10:07 -0400 Subject: [PATCH 24/83] Kargo adapter BidID support (#2958) * better support for bidIDs (multiple ad slots of same type) * currency config fix --- modules/kargoBidAdapter.js | 21 +++++---- test/spec/modules/kargoBidAdapter_spec.js | 57 +++++++++++++++++------ 2 files changed, 55 insertions(+), 23 deletions(-) diff --git a/modules/kargoBidAdapter.js b/modules/kargoBidAdapter.js index dfcc3057ab7..1ba0f392d08 100644 --- a/modules/kargoBidAdapter.js +++ b/modules/kargoBidAdapter.js @@ -12,7 +12,10 @@ export const spec = { return !!bid.params.placementId; }, buildRequests: function(validBidRequests, bidderRequest) { - const currency = config.getConfig('currency'); + const currencyObj = config.getConfig('currency'); + const currency = (currencyObj && currencyObj.adServerCurrency) || 'USD'; + const bidIds = {}; + utils._each(validBidRequests, bid => bidIds[bid.bidId] = bid.params.placementId); const transformedParams = Object.assign({}, { timeout: bidderRequest.timeout, currency: currency, @@ -22,31 +25,29 @@ export const spec = { floor: 0, ceil: 20 }, - adSlotIDs: utils._map(validBidRequests, bid => bid.params.placementId) + bidIDs: bidIds }, spec._getAllMetadata()); const encodedParams = encodeURIComponent(JSON.stringify(transformedParams)); return Object.assign({}, bidderRequest, { method: 'GET', - url: `${HOST}/api/v1/bid`, + url: `${HOST}/api/v2/bid`, data: `json=${encodedParams}`, currency: currency }); }, interpretResponse: function(response, bidRequest) { - let adUnits = response.body; - let bids = {}; - utils._each(bidRequest.bids, bid => bids[bid.params.placementId] = bid); + let bids = response.body; const bidResponses = []; - for (let adUnitId in adUnits) { - let adUnit = adUnits[adUnitId]; + for (let bidId in bids) { + let adUnit = bids[bidId]; bidResponses.push({ - requestId: bids[adUnitId].bidId, + requestId: bidId, cpm: Number(adUnit.cpm), width: adUnit.width, height: adUnit.height, ad: adUnit.adm, ttl: 300, - creativeId: adUnitId, + creativeId: adUnit.id, netRevenue: true, currency: bidRequest.currency }); diff --git a/test/spec/modules/kargoBidAdapter_spec.js b/test/spec/modules/kargoBidAdapter_spec.js index bb0feeba069..432ae086511 100644 --- a/test/spec/modules/kargoBidAdapter_spec.js +++ b/test/spec/modules/kargoBidAdapter_spec.js @@ -50,13 +50,19 @@ describe('kargo adapter tests', function () { params: { placementId: 'foo' }, - placementCode: 1 + bidId: 1 }, { params: { placementId: 'bar' }, - placementCode: 2 + bidId: 2 + }, + { + params: { + placementId: 'bar' + }, + bidId: 3 } ]; }); @@ -173,10 +179,11 @@ describe('kargo adapter tests', function () { floor: 0, ceil: 20 }, - adSlotIDs: [ - 'foo', - 'bar' - ], + bidIDs: { + 1: 'foo', + 2: 'bar', + 3: 'bar' + }, userIDs: { kargoID: '5f108831-302d-11e7-bf6b-4595acd3bf6c', clientID: '2410d8f2-c111-4811-88a5-7b5e190e475f', @@ -235,7 +242,7 @@ describe('kargo adapter tests', function () { var request = spec.buildRequests(bids, {timeout: 200, foo: 'bar'}); var krakenParams = JSON.parse(decodeURIComponent(request.data.slice(5))); expect(request.data.slice(0, 5)).to.equal('json='); - expect(request.url).to.equal('https://krk.kargo.com/api/v1/bid'); + expect(request.url).to.equal('https://krk.kargo.com/api/v2/bid'); expect(request.method).to.equal('GET'); expect(request.currency).to.equal('USD'); expect(request.timeout).to.equal(200); @@ -306,13 +313,22 @@ describe('kargo adapter tests', function () { describe('response handler', function() { it('handles bid responses', function() { var resp = spec.interpretResponse({body: { - foo: { + 1: { + id: 'foo', cpm: 3, adm: '
', width: 320, height: 50 }, - bar: { + 2: { + id: 'bar', + cpm: 2.5, + adm: '
', + width: 300, + height: 250 + }, + 3: { + id: 'bar', cpm: 2.5, adm: '
', width: 300, @@ -321,19 +337,24 @@ describe('kargo adapter tests', function () { }}, { currency: 'USD', bids: [{ - bidId: 'fake bid id 1', + bidId: 1, params: { placementId: 'foo' } }, { - bidId: 'fake bid id 2', + bidId: 2, + params: { + placementId: 'bar' + } + }, { + bidId: 3, params: { placementId: 'bar' } }] }); var expectation = [{ - requestId: 'fake bid id 1', + requestId: '1', cpm: 3, width: 320, height: 50, @@ -343,7 +364,17 @@ describe('kargo adapter tests', function () { netRevenue: true, currency: 'USD' }, { - requestId: 'fake bid id 2', + requestId: '2', + cpm: 2.5, + width: 300, + height: 250, + ad: '
', + ttl: 300, + creativeId: 'bar', + netRevenue: true, + currency: 'USD' + }, { + requestId: '3', cpm: 2.5, width: 300, height: 250, From ba1671c0b112a01617ab7ab9cb5b7a827440c27c Mon Sep 17 00:00:00 2001 From: Matt Kendall <1870166+mkendall07@users.noreply.github.com> Date: Tue, 14 Aug 2018 14:26:43 -0400 Subject: [PATCH 25/83] 1.20.0 release. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 64138f4a3aa..b23544f9268 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "prebid.js", - "version": "1.20.0-pre", + "version": "1.20.0", "description": "Header Bidding Management Library", "main": "src/prebid.js", "scripts": { From caa9c0fdc4b642aa823542fd13b4f133ef269ecd Mon Sep 17 00:00:00 2001 From: Matt Kendall <1870166+mkendall07@users.noreply.github.com> Date: Tue, 14 Aug 2018 14:50:05 -0400 Subject: [PATCH 26/83] 1.21.0-pre --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b23544f9268..efb57eb9c59 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "prebid.js", - "version": "1.20.0", + "version": "1.21.0-pre", "description": "Header Bidding Management Library", "main": "src/prebid.js", "scripts": { From 5e430e382922ee16e5e0cefa88198b9a01e60ba2 Mon Sep 17 00:00:00 2001 From: Jerome Eteve Date: Wed, 15 Aug 2018 19:16:47 +0100 Subject: [PATCH 27/83] Added render param in Sonobi adapter (#2970) --- modules/sonobiBidAdapter.js | 3 +++ test/spec/modules/sonobiBidAdapter_spec.js | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/modules/sonobiBidAdapter.js b/modules/sonobiBidAdapter.js index 3d9ad2ce976..779736520cc 100644 --- a/modules/sonobiBidAdapter.js +++ b/modules/sonobiBidAdapter.js @@ -66,6 +66,9 @@ export const spec = { if (validBidRequests[0].params.referrer) { payload.ref = validBidRequests[0].params.referrer; } + if (validBidRequests[0].params.render) { + payload.render = validBidRequests[0].params.render; + } // Apply GDPR parameters to request. if (bidderRequest && bidderRequest.gdprConsent) { diff --git a/test/spec/modules/sonobiBidAdapter_spec.js b/test/spec/modules/sonobiBidAdapter_spec.js index 1b0986cb8c1..63fb52b2dbd 100644 --- a/test/spec/modules/sonobiBidAdapter_spec.js +++ b/test/spec/modules/sonobiBidAdapter_spec.js @@ -207,6 +207,11 @@ describe('SonobiBidAdapter', () => { expect(bidRequests.data.s).not.to.be.empty expect(bidRequests.data.hfa).to.equal('hfakey') }) + it('should return a properly formatted request with render', () => { + bidRequest[0].params.render = 'safeframe' + const bidRequests = spec.buildRequests(bidRequest) + expect(bidRequests.data.render).to.equal('safeframe') + }) it('should return null if there is nothing to bid on', () => { const bidRequests = spec.buildRequests([{params: {}}]) From 2fb1d951ac23393cbabe0403491ec6261911367f Mon Sep 17 00:00:00 2001 From: yoshito oe Date: Thu, 16 Aug 2018 03:42:54 +0900 Subject: [PATCH 28/83] AJA adapter (#2934) * AJA Bid Adapter * fix markdown * delete log * multiple tracking support * semicolon * fix test parameters * v1 -> v2 * add parameters * JPY -> USD --- modules/ajaBidAdapter.js | 142 +++++++++++++++++++++++ modules/ajaBidAdapter.md | 52 +++++++++ test/spec/modules/ajaBidAdapter_spec.js | 144 ++++++++++++++++++++++++ 3 files changed, 338 insertions(+) create mode 100644 modules/ajaBidAdapter.js create mode 100644 modules/ajaBidAdapter.md create mode 100644 test/spec/modules/ajaBidAdapter_spec.js diff --git a/modules/ajaBidAdapter.js b/modules/ajaBidAdapter.js new file mode 100644 index 00000000000..bbdbeb53886 --- /dev/null +++ b/modules/ajaBidAdapter.js @@ -0,0 +1,142 @@ +import { Renderer } from 'src/Renderer'; +import * as utils from 'src/utils'; +import { registerBidder } from 'src/adapters/bidderFactory'; +import { VIDEO, BANNER } from 'src/mediaTypes'; + +const BIDDER_CODE = 'aja'; +const URL = '//ad.as.amanad.adtdp.com/v2/prebid'; +const SDK_TYPE = 5; +const AD_TYPE = { + BANNER: 1, + NATIVE: 2, + VIDEO: 3, +}; + +export const spec = { + code: BIDDER_CODE, + supportedMediaTypes: [VIDEO, BANNER], + + isBidRequestValid: function(bid) { + return !!(bid.params.asi); + }, + + buildRequests: function(validBidRequests, bidderRequest) { + var bidRequests = []; + for (var i = 0, len = validBidRequests.length; i < len; i++) { + var bid = validBidRequests[i]; + var queryString = ''; + const asi = utils.getBidIdParameter('asi', bid.params); + queryString = utils.tryAppendQueryString(queryString, 'asi', asi); + queryString = utils.tryAppendQueryString(queryString, 'skt', SDK_TYPE); + queryString = utils.tryAppendQueryString(queryString, 'prebid_id', bid.bidId); + queryString = utils.tryAppendQueryString(queryString, 'prebid_ver', '$prebid.version$'); + + bidRequests.push({ + method: 'GET', + url: URL, + data: queryString + }); + } + + return bidRequests; + }, + + interpretResponse: function(bidderResponse, request) { + const bidderResponseBody = bidderResponse.body; + + if (!bidderResponseBody.is_ad_return) { + return []; + } + + const ad = bidderResponseBody.ad; + + const bid = { + requestId: ad.prebid_id, + cpm: ad.price, + creativeId: ad.creative_id, + dealId: ad.deal_id, + currency: ad.currency || 'USD', + netRevenue: true, + ttl: 300, // 5 minutes + } + + if (AD_TYPE.VIDEO === ad.ad_type) { + const videoAd = bidderResponseBody.ad.video; + Object.assign(bid, { + vastXml: videoAd.vtag, + width: videoAd.w, + height: videoAd.h, + renderer: newRenderer(bidderResponseBody), + adResponse: bidderResponseBody, + mediaType: VIDEO + }); + } else if (AD_TYPE.BANNER === ad.ad_type) { + const bannerAd = bidderResponseBody.ad.banner; + Object.assign(bid, { + width: bannerAd.w, + height: bannerAd.h, + ad: bannerAd.tag, + mediaType: BANNER + }); + try { + bannerAd.imps.forEach(impTracker => { + const tracker = utils.createTrackPixelHtml(impTracker); + bid.ad += tracker; + }); + } catch (error) { + utils.logError('Error appending tracking pixel', error); + } + } + + return [bid]; + }, + + getUserSyncs: function(syncOptions, serverResponses) { + const syncs = []; + if (syncOptions.pixelEnabled) { + const bidderResponseBody = serverResponses[0].body; + if (bidderResponseBody.syncs) { + bidderResponseBody.syncs.forEach(sync => { + syncs.push({ + type: 'image', + url: sync + }); + }); + } + } + + return syncs; + }, +} + +function newRenderer(bidderResponse) { + const renderer = Renderer.install({ + id: bidderResponse.ad.prebid_id, + url: bidderResponse.ad.video.purl, + loaded: false, + }); + + try { + renderer.setRender(outstreamRender); + } catch (err) { + utils.logWarn('Prebid Error calling setRender on newRenderer', err); + } + + return renderer; +} + +function outstreamRender(bid) { + bid.renderer.push(() => { + window.aja_vast_player.init({ + vast_tag: bid.adResponse.ad.video.vtag, + ad_unit_code: bid.adUnitCode, // target div id to render video + width: bid.width, + height: bid.height, + progress: bid.adResponse.ad.video.progress, + loop: bid.adResponse.ad.video.loop, + inread: bid.adResponse.ad.video.inread + }); + }); +} + +registerBidder(spec); diff --git a/modules/ajaBidAdapter.md b/modules/ajaBidAdapter.md new file mode 100644 index 00000000000..ea2b8e97a43 --- /dev/null +++ b/modules/ajaBidAdapter.md @@ -0,0 +1,52 @@ +# Overview + +``` +Module Name: Aja Bid adapter +Module Type: Bidder adapter +Maintainer: ssp_support@aja-kk.co.jp +``` + +# Description +Connects to Aja exchange for bids. +Aja bid adapter supports Banner and Outstream Video. + +# Test Parameters +``` +var adUnits = [ + // Banner adUnit + { + code: 'banner-div', + mediaTypes: { + banner: { + sizes: [ + [300, 250] + ], + } + }, + bids: [{ + bidder: 'aja', + params: { + asi: 'szs4htFiR' + } + }] + }, + // Video outstream adUnit + { + code: 'video-outstream', + mediaTypes: { + video: { + context: 'outstream', + playerSize: [300, 250] + } + }, + bids: [ + { + bidder: 'aja', + params: { + asi: 'Kp2O2tFig' + } + } + ] + } +]; +``` diff --git a/test/spec/modules/ajaBidAdapter_spec.js b/test/spec/modules/ajaBidAdapter_spec.js new file mode 100644 index 00000000000..c6a531c9f1f --- /dev/null +++ b/test/spec/modules/ajaBidAdapter_spec.js @@ -0,0 +1,144 @@ +import { spec } from 'modules/ajaBidAdapter'; +import { newBidder } from 'src/adapters/bidderFactory'; + +const ENDPOINT = '//ad.as.amanad.adtdp.com/v2/prebid'; + +describe('AjaAdapter', () => { + const adapter = newBidder(spec); + + describe('isBidRequestValid', () => { + let bid = { + 'bidder': 'aja', + 'params': { + 'asi': '123456' + }, + 'adUnitCode': 'adunit', + 'sizes': [[300, 250]], + 'bidId': '30b31c1838de1e', + 'bidderRequestId': '22edbae2733bf6', + 'auctionId': '1d1a030790a475', + }; + + it('should return true when required params found', () => { + expect(spec.isBidRequestValid(bid)).to.equal(true); + }); + + it('should return false when required params are not passed', () => { + let bid = Object.assign({}, bid); + delete bid.params; + bid.params = { + 'asi': 0 + }; + expect(spec.isBidRequestValid(bid)).to.equal(false); + }); + }); + + describe('buildRequests', () => { + let bidRequests = [ + { + 'bidder': 'aja', + 'params': { + 'asi': '123456' + }, + 'adUnitCode': 'adunit', + 'sizes': [[300, 250]], + 'bidId': '30b31c1838de1e', + 'bidderRequestId': '22edbae2733bf6', + 'auctionId': '1d1a030790a475', + } + ]; + + it('sends bid request to ENDPOINT via GET', () => { + const requests = spec.buildRequests(bidRequests); + expect(requests[0].url).to.equal(ENDPOINT); + expect(requests[0].method).to.equal('GET'); + }); + }); + describe('interpretResponse', () => { + let response = { + 'is_ad_return': true, + 'ad': { + 'ad_type': 1, + 'prebid_id': '51ef8751f9aead', + 'price': 12.34, + 'currency': 'USD', + 'creative_id': '123abc', + 'banner': { + 'w': 300, + 'h': 250, + 'tag': '
', + 'imps': [ + '//as.amanad.adtdp.com/v1/imp' + ] + } + }, + 'syncs': [ + 'https://example.com' + ] + }; + + it('should get correct banner bid response', () => { + let expectedResponse = [ + { + 'requestId': '51ef8751f9aead', + 'cpm': 12.34, + 'creativeId': '123abc', + 'dealId': undefined, + 'width': 300, + 'height': 250, + 'ad': '
', + 'mediaType': 'banner', + 'currency': 'USD', + 'ttl': 300, + 'netRevenue': true + } + ]; + + let bidderRequest; + let result = spec.interpretResponse({ body: response }, {bidderRequest}); + expect(Object.keys(result[0])).to.have.members(Object.keys(expectedResponse[0])); + }); + + it('handles video responses', () => { + let response = { + 'is_ad_return': true, + 'ad': { + 'ad_type': 3, + 'prebid_id': '51ef8751f9aead', + 'price': 12.34, + 'currency': 'JPY', + 'creative_id': '123abc', + 'video': { + 'w': 300, + 'h': 250, + 'vtag': '', + 'purl': 'http://cdn/player', + 'progress': true, + 'loop': false, + 'inread': false + } + }, + 'syncs': [ + 'https://example.com' + ] + }; + + let bidderRequest; + let result = spec.interpretResponse({ body: response }, {bidderRequest}); + expect(result[0]).to.have.property('vastXml'); + expect(result[0]).to.have.property('renderer'); + expect(result[0]).to.have.property('mediaType', 'video'); + }); + + it('handles nobid responses', () => { + let response = { + 'is_ad_return': false, + 'ad': {} + }; + + let bidderRequest; + let result = spec.interpretResponse({ body: response }, {bidderRequest}); + expect(result.length).to.equal(0); + }); + }); +}); From ee02e13bb0838877eb666705cb740f53849d432b Mon Sep 17 00:00:00 2001 From: AdmixerTech <35560933+AdmixerTech@users.noreply.github.com> Date: Wed, 15 Aug 2018 21:46:03 +0300 Subject: [PATCH 29/83] Add DivReach adapter (#2946) --- modules/divreachBidAdapter.js | 74 ++++++++++++ modules/divreachBidAdapter.md | 52 +++++++++ test/spec/modules/divreachBidAdapter_spec.js | 117 +++++++++++++++++++ 3 files changed, 243 insertions(+) create mode 100644 modules/divreachBidAdapter.js create mode 100644 modules/divreachBidAdapter.md create mode 100644 test/spec/modules/divreachBidAdapter_spec.js diff --git a/modules/divreachBidAdapter.js b/modules/divreachBidAdapter.js new file mode 100644 index 00000000000..e597e32f4be --- /dev/null +++ b/modules/divreachBidAdapter.js @@ -0,0 +1,74 @@ +import * as utils from 'src/utils'; +import {registerBidder} from 'src/adapters/bidderFactory'; + +const BIDDER_CODE = 'divreach'; +const ENDPOINT_URL = '//ads.divreach.com/prebid.1.0.aspx'; +export const spec = { + code: BIDDER_CODE, + aliases: [], + supportedMediaTypes: ['banner', 'video'], + /** + * Determines whether or not the given bid request is valid. + * + * @param {BidRequest} bid The bid params to validate. + * @return boolean True if this is a valid bid, and false otherwise. + */ + isBidRequestValid: function (bid) { + return !!bid.params.zone; + }, + /** + * Make a server request from the list of BidRequests. + * + * @param {bidderRequest} - bidderRequest.bids[] is an array of AdUnits and bids + * @return ServerRequest Info describing the request to the server. + */ + buildRequests: function (bidderRequest) { + const payload = { + imps: [], + referrer: encodeURIComponent(utils.getTopWindowUrl()), + }; + bidderRequest.forEach((bid) => { + if (bid.bidder === BIDDER_CODE) { + payload.imps.push(bid); + } + }); + const payloadString = JSON.stringify(payload); + return { + method: 'GET', + url: ENDPOINT_URL, + data: `data=${payloadString}`, + }; + }, + /** + * Unpack the response from the server into a list of bids. + * + * @param {*} serverResponse A successful response from the server. + * @return {Bid[]} An array of bids which were nested inside the server. + */ + interpretResponse: function (serverResponse, bidRequest) { + const bidResponses = []; + // loop through serverResponses { + try { + serverResponse = serverResponse.body; + serverResponse.forEach((bidResponse) => { + const bidResp = { + requestId: bidResponse.bidId, + cpm: bidResponse.cpm, + width: bidResponse.width, + height: bidResponse.height, + ad: bidResponse.ad, + ttl: bidResponse.ttl, + creativeId: bidResponse.creativeId, + netRevenue: bidResponse.netRevenue, + currency: bidResponse.currency, + vastUrl: bidResponse.vastUrl, + }; + bidResponses.push(bidResp); + }); + } catch (e) { + utils.logError(e); + } + return bidResponses; + } +}; +registerBidder(spec); diff --git a/modules/divreachBidAdapter.md b/modules/divreachBidAdapter.md new file mode 100644 index 00000000000..da2ebee97cf --- /dev/null +++ b/modules/divreachBidAdapter.md @@ -0,0 +1,52 @@ +# Overview + +Module Name: DivReach Bidder Adapter +Module Type: Bidder Adapter +Maintainer: Zeke@divreach.com + +# Description + +Connects to DivReach demand source to fetch bids. +Banner and Video formats are supported. +Please use ```divreach``` as the bidder code. + +# Test Parameters +``` + var adUnits = [ + { + code: 'desktop-banner-ad-div', + sizes: [[300, 250]], // a display size + bids: [ + { + bidder: "divreach", + params: { + zone: '261eae83-0508-4e1a-8c9b-19561fa9279e' + } + } + ] + },{ + code: 'mobile-banner-ad-div', + sizes: [[300, 50]], // a mobile size + bids: [ + { + bidder: "divreach", + params: { + zone: '561e26ea-1999-4fb6-ad0b-9d72929e545e' + } + } + ] + },{ + code: 'video-ad', + sizes: [[300, 50]], + mediaType: 'video', + bids: [ + { + bidder: "divreach", + params: { + zone: 'e784ecbe-720f-46f7-8388-aff8c2c4ed86' + } + } + ] + }, + ]; +``` diff --git a/test/spec/modules/divreachBidAdapter_spec.js b/test/spec/modules/divreachBidAdapter_spec.js new file mode 100644 index 00000000000..8beb0830385 --- /dev/null +++ b/test/spec/modules/divreachBidAdapter_spec.js @@ -0,0 +1,117 @@ +import {expect} from 'chai'; +import {spec} from 'modules/divreachBidAdapter'; +import {newBidder} from 'src/adapters/bidderFactory'; + +const BIDDER_CODE = 'divreach'; +const ENDPOINT_URL = '//ads.divreach.com/prebid.1.0.aspx'; +const ZONE_ID = '2eb6bd58-865c-47ce-af7f-a918108c3fd2'; + +describe('DivReachAdapter', () => { + const adapter = newBidder(spec); + + describe('inherited functions', () => { + it('exists and is a function', () => { + expect(adapter.callBids).to.be.exist.and.to.be.a('function'); + }); + }); + + describe('isBidRequestValid', () => { + let bid = { + 'bidder': BIDDER_CODE, + 'params': { + 'zone': ZONE_ID + }, + 'adUnitCode': 'adunit-code', + 'sizes': [[300, 250], [300, 600]], + 'bidId': '30b31c1838de1e', + 'bidderRequestId': '22edbae2733bf6', + 'auctionId': '1d1a030790a475', + }; + + it('should return true when required params found', () => { + expect(spec.isBidRequestValid(bid)).to.equal(true); + }); + + it('should return false when required params are not passed', () => { + let bid = Object.assign({}, bid); + delete bid.params; + bid.params = { + 'placementId': 0 + }; + expect(spec.isBidRequestValid(bid)).to.equal(false); + }); + }); + + describe('buildRequests', () => { + let bidRequests = [ + { + 'bidder': BIDDER_CODE, + 'params': { + 'zone': ZONE_ID + }, + 'adUnitCode': 'adunit-code', + 'sizes': [[300, 250], [300, 600]], + 'bidId': '30b31c1838de1e', + 'bidderRequestId': '22edbae2733bf6', + 'auctionId': '1d1a030790a475', + } + ]; + + it('should add referrer and imp to be equal bidRequest', () => { + const request = spec.buildRequests(bidRequests); + const payload = JSON.parse(request.data.substr(5)); + expect(payload.referrer).to.not.be.undefined; + expect(payload.imps[0]).to.deep.equal(bidRequests[0]); + }); + + it('sends bid request to ENDPOINT via GET', () => { + const request = spec.buildRequests(bidRequests); + expect(request.url).to.equal(ENDPOINT_URL); + expect(request.method).to.equal('GET'); + }); + }); + + describe('interpretResponse', () => { + let response = { + body: [{ + 'currency': 'USD', + 'cpm': 6.210000, + 'ad': '
ad
', + 'width': 300, + 'height': 600, + 'creativeId': 'ccca3e5e-0c54-4761-9667-771322fbdffc', + 'ttl': 360, + 'netRevenue': false, + 'bidId': '5e4e763b6bc60b' + }] + }; + + it('should get correct bid response', () => { + const body = response.body; + let expectedResponse = [ + { + 'requestId': body[0].bidId, + 'cpm': body[0].cpm, + 'creativeId': body[0].creativeId, + 'width': body[0].width, + 'height': body[0].height, + 'ad': body[0].ad, + 'vastUrl': undefined, + 'currency': body[0].currency, + 'netRevenue': body[0].netRevenue, + 'ttl': body[0].ttl, + } + ]; + + let result = spec.interpretResponse(response); + expect(result[0]).to.deep.equal(expectedResponse[0]); + }); + + it('handles nobid responses', () => { + let response = []; + + let result = spec.interpretResponse(response); + expect(result.length).to.equal(0); + }); + }); +}); From ab2d7fcf6d937cdbca75cfef180ae0ac1b3a62fe Mon Sep 17 00:00:00 2001 From: Margaret Liu Date: Thu, 16 Aug 2018 09:38:06 -0500 Subject: [PATCH 30/83] Add adUnitCode to LockerDome bid requests (#2979) --- modules/lockerdomeBidAdapter.js | 1 + test/spec/modules/lockerdomeBidAdapter_spec.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/modules/lockerdomeBidAdapter.js b/modules/lockerdomeBidAdapter.js index 43c8a15c37b..d4b4e048b8b 100644 --- a/modules/lockerdomeBidAdapter.js +++ b/modules/lockerdomeBidAdapter.js @@ -12,6 +12,7 @@ export const spec = { const adUnitBidRequests = bidRequests.map(function (bid) { return { requestId: bid.bidId, + adUnitCode: bid.adUnitCode, adUnitId: utils.getBidIdParameter('adUnitId', bid.params), sizes: bid.sizes } diff --git a/test/spec/modules/lockerdomeBidAdapter_spec.js b/test/spec/modules/lockerdomeBidAdapter_spec.js index 84f0dd43e72..19884065597 100644 --- a/test/spec/modules/lockerdomeBidAdapter_spec.js +++ b/test/spec/modules/lockerdomeBidAdapter_spec.js @@ -65,12 +65,14 @@ describe('LockerDomeAdapter', () => { expect(bids).to.have.lengthOf(2); expect(bids[0].requestId).to.equal('2652ca954bce9'); + expect(bids[0].adUnitCode).to.equal('ad-1'); expect(bids[0].adUnitId).to.equal(10809467961050726); expect(bids[0].sizes).to.have.lengthOf(1); expect(bids[0].sizes[0][0]).to.equal(300); expect(bids[0].sizes[0][1]).to.equal(250); expect(bids[1].requestId).to.equal('4510f2834773ce'); + expect(bids[1].adUnitCode).to.equal('ad-2'); expect(bids[1].adUnitId).to.equal(9434769725128806); expect(bids[1].sizes).to.have.lengthOf(1); expect(bids[1].sizes[0][0]).to.equal(300); From 17f11da091b456a19da6f07ee53370902aedd9a9 Mon Sep 17 00:00:00 2001 From: Daniel Grek Date: Thu, 16 Aug 2018 17:43:10 +0200 Subject: [PATCH 31/83] AdForm Adapter - setting alias code in received bids (#2976) --- modules/adformBidAdapter.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/adformBidAdapter.js b/modules/adformBidAdapter.js index 889c8ba4813..cc64b49d8f7 100644 --- a/modules/adformBidAdapter.js +++ b/modules/adformBidAdapter.js @@ -15,6 +15,7 @@ export const spec = { var request = []; var globalParams = [ [ 'adxDomain', 'adx.adform.net' ], [ 'fd', 1 ], [ 'url', null ], [ 'tid', null ] ]; var bids = JSON.parse(JSON.stringify(validBidRequests)); + var bidder = (bids[0] && bids[0].bidder) || BIDDER_CODE for (i = 0, l = bids.length; i < l; i++) { bid = bids[i]; if ((bid.params.priceType === 'net') || (bid.params.pt === 'net')) { @@ -60,7 +61,7 @@ export const spec = { url: request.join('&'), bids: validBidRequests, netRevenue: netRevenue, - bidder: 'adform', + bidder, gdpr: gdprObject }; From 014fffe4d1e17555b41415c5c11444b3c1ef1915 Mon Sep 17 00:00:00 2001 From: bretg Date: Mon, 20 Aug 2018 12:50:23 -0400 Subject: [PATCH 32/83] changing rubicon endpoint to openrtb2 endpoint (#2996) * changing rubicon endpoint to openrtb2 endpoint * updated test for rubicon prebid server endpoint --- modules/prebidServerBidAdapter/config.js | 2 +- test/spec/modules/prebidServerBidAdapter_spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/prebidServerBidAdapter/config.js b/modules/prebidServerBidAdapter/config.js index a2b0b6bec77..74eb4a95744 100644 --- a/modules/prebidServerBidAdapter/config.js +++ b/modules/prebidServerBidAdapter/config.js @@ -12,7 +12,7 @@ export const S2S_VENDORS = { adapter: 'prebidServer', cookieSet: false, enabled: true, - endpoint: '//prebid-server.rubiconproject.com/auction', + endpoint: '//prebid-server.rubiconproject.com/openrtb2/auction', syncEndpoint: '//prebid-server.rubiconproject.com/cookie_sync', timeout: 500 } diff --git a/test/spec/modules/prebidServerBidAdapter_spec.js b/test/spec/modules/prebidServerBidAdapter_spec.js index f3cc150ab6e..556755316eb 100644 --- a/test/spec/modules/prebidServerBidAdapter_spec.js +++ b/test/spec/modules/prebidServerBidAdapter_spec.js @@ -1092,7 +1092,7 @@ describe('S2S Adapter', () => { expect(vendorConfig.cookieSet).to.be.false; expect(vendorConfig.cookieSetUrl).to.be.undefined; expect(vendorConfig.enabled).to.be.true; - expect(vendorConfig).to.have.property('endpoint', '//prebid-server.rubiconproject.com/auction'); + expect(vendorConfig).to.have.property('endpoint', '//prebid-server.rubiconproject.com/openrtb2/auction'); expect(vendorConfig).to.have.property('syncEndpoint', '//prebid-server.rubiconproject.com/cookie_sync'); expect(vendorConfig).to.have.property('timeout', 750); }); From db2fdfad1537583d2f4d56e6ffd2deed88e9de9d Mon Sep 17 00:00:00 2001 From: Bryan DeLong Date: Mon, 20 Aug 2018 14:56:57 -0400 Subject: [PATCH 33/83] SomoAudience Adapter Enhancements (#2986) * Support additional targeting options, support video, support GDPR, and implement usersync pixels More work cleaning up tests and making sure this stuff actually worked Documentation Updates * Trying to fix Mac-only errors * Squashing more bugs that cropped up * Added additional parameter for userip * Delete package-lock.json * Fix accidently deleting a file --- modules/somoaudienceBidAdapter.js | 195 ++++++- modules/somoaudienceBidAdapter.md | 2 + .../modules/somoaudienceBidAdapter_spec.js | 548 +++++++++++++++--- 3 files changed, 636 insertions(+), 109 deletions(-) diff --git a/modules/somoaudienceBidAdapter.js b/modules/somoaudienceBidAdapter.js index 7655eb9e2e0..836d87417cc 100644 --- a/modules/somoaudienceBidAdapter.js +++ b/modules/somoaudienceBidAdapter.js @@ -1,19 +1,30 @@ -import {getTopWindowReferrer, getTopWindowLocation} from 'src/utils'; +import * as utils from 'src/utils'; import { registerBidder } from 'src/adapters/bidderFactory'; +import includes from 'core-js/library/fn/array/includes'; +import {BANNER, VIDEO} from 'src/mediaTypes'; + +const VIDEO_TARGETING = ['mimes', 'minduration', 'maxduration', 'protocols', + 'startdelay', 'linearity', 'skip', 'delivery', + 'pos', 'api', 'ext', 'battr']; +const BANNER_TARGETING = ['battr', 'btype', 'pos', 'mimes', 'ext']; + +const SITE_TARGETING = ['name', 'domain', 'cat', 'keywords', 'content'] +const APP_TARGETING = ['name', 'bundle', 'domain', 'storeUrl', 'cat', 'ver', 'keywords', 'content'] export const spec = { code: 'somoaudience', + supportedMediaTypes: [BANNER, VIDEO], aliases: ['somo'], isBidRequestValid: bid => ( !!(bid && bid.params && bid.params.placementId) ), - buildRequests: function(bidRequests) { + buildRequests: function(bidRequests, bidderRequest) { return bidRequests.map(bidRequest => { - let da = openRtbRequest(bidRequest); + let da = openRtbRequest(bidRequest, bidderRequest); if (window.top1 && window.top1.realvu_aa) { let a = window.top1.realvu_aa.check({ unit_id: bidRequest.adUnitCode, @@ -48,51 +59,135 @@ export const spec = { interpretResponse(response, request) { return bidResponseAvailable(request, response); + }, + + getUserSyncs: (syncOptions, serverResponses, gdprConsent) => { + const syncs = []; + var url = '//publisher-east.mobileadtrading.com/usersync'; + + if (syncOptions.pixelEnabled) { + if (gdprConsent && typeof gdprConsent.consentString === 'string') { + // add 'gdpr' only if 'gdprApplies' is defined + if (typeof gdprConsent.gdprApplies === 'boolean') { + url += `?gdpr=${Number(gdprConsent.gdprApplies)}&gdpr_consent=${gdprConsent.consentString}`; + } + } + syncs.push({ + type: 'image', + url: url + }); + } + return syncs; } }; function bidResponseAvailable(bidRequest, bidResponse) { let bidResponses = []; - let bidId = 1; - if (typeof bidRequest != 'undefined' && typeof bidRequest.bidRequest != 'undefined' && typeof bidRequest.bidRequest.bidId != 'undefined') { - bidId = bidRequest.bidRequest.bidId; - } if (bidResponse.body) { let bidData = bidResponse.body.seatbid[0].bid[0]; const bid = { - requestId: bidId, + requestId: bidData.impid, cpm: bidData.price, width: bidData.w, height: bidData.h, ad: bidData.adm, ttl: 360, creativeId: bidData.crid, - adId: bidId, + adId: bidData.impid, netRevenue: false, currency: 'USD', }; + if (isVideo(bidRequest.bidRequest)) { + bid.vastXml = bidData.adm; + bid.mediaType = 'video'; + } else { + bid.ad = bidData.adm; + bid.mediaType = 'banner'; + } bidResponses.push(bid); } return bidResponses; } -function openRtbRequest(bidRequest) { - return { +function openRtbRequest(bidRequest, bidderRequest) { + var openRtbRequest = { id: bidRequest.bidderRequestId, imp: [openRtbImpression(bidRequest)], at: 1, tmax: 400, site: openRtbSite(bidRequest), app: openRtbApp(bidRequest), - device: openRtbDevice() + device: openRtbDevice(), + bcat: openRtbBCat(bidRequest), + badv: openRtbBAdv(bidRequest), + ext: { + prebid: '$prebid.version$', + }, }; + if (bidderRequest != undefined) { + openRtbRequest = populateOpenRtbGdpr(bidderRequest.gdprConsent, openRtbRequest); + } + + return openRtbRequest; +} + +function populateOpenRtbGdpr(gdpr, bidRequest) { + if (gdpr && bidRequest && 'gdprApplies' in gdpr) { + if (!('reqs' in bidRequest)) { + bidRequest.reqs = {}; + } + if (!('ext' in bidRequest.reqs)) { + bidRequest.reqs.ext = {}; + } + bidRequest.reqs.ext.gdpr = gdpr.gdprApplies; + + if ('consentString' in gdpr) { + if (!('user' in bidRequest)) { + bidRequest.user = {}; + } + if (!('ext' in bidRequest.user)) { + bidRequest.user.ext = {}; + } + bidRequest.user.ext.consent = gdpr.consentString; + } + } + + return bidRequest; } function openRtbImpression(bidRequest) { - return { - id: bidRequest.bidId, - banner: {} + const imp = { + 'id': bidRequest.bidId, + bidfloor: bidRequest.params.bidfloor || 0, }; + if (isVideo(bidRequest)) { + imp.video = {}; + if (bidRequest.sizes) { + const sizes = getSizes(bidRequest.sizes); + imp.video.w = sizes[0]; + imp.video.h = sizes[1]; + } + if (bidRequest.params.video) { + Object.keys(bidRequest.params.video) + .filter(param => includes(VIDEO_TARGETING, param)) + .forEach(param => imp.video[param] = bidRequest.params.video[param]); + } + } else { + imp.banner = { + topframe: 0 + }; + if (bidRequest.sizes) { + const sizes = getSizes(bidRequest.sizes); + imp.banner.w = sizes[0]; + imp.banner.h = sizes[1]; + } + if (bidRequest.params.banner) { + Object.keys(bidRequest.params.banner) + .filter(param => includes(BANNER_TARGETING, param)) + .forEach(param => imp.banner[param] = bidRequest.params.banner[param]); + } + } + return imp; } function isApp(bidRequest) { @@ -105,13 +200,20 @@ function isApp(bidRequest) { function openRtbSite(bidRequest) { if (!isApp(bidRequest)) { - const pageUrl = getTopWindowLocation().href; - const domain = getTopWindowLocation().hostname; - return { - ref: getTopWindowReferrer(), - page: pageUrl, - domain: domain + const site = { + ref: utils.getTopWindowReferrer(), + page: utils.getTopWindowLocation().href + }; + if (bidRequest.params.site) { + Object.keys(bidRequest.params.site) + .filter(param => includes(SITE_TARGETING, param)) + .forEach(param => site[param] = bidRequest.params.site[param]); + } + if (site.domain == undefined) { + site.domain = utils.getTopWindowLocation().hostname; } + + return site; } else { return null; } @@ -119,13 +221,14 @@ function openRtbSite(bidRequest) { function openRtbApp(bidRequest) { if (isApp(bidRequest)) { - const appParams = bidRequest.params.app; - return { - bundle: appParams.bundle ? appParams.bundle : null, - storeurl: appParams.storeUrl ? appParams.storeUrl : null, - domain: appParams.domain ? appParams.domain : null, - name: appParams.name ? appParams.name : null, + const app = { + } + Object.keys(bidRequest.params.app) + .filter(param => includes(APP_TARGETING, param)) + .forEach(param => app[param] = bidRequest.params.app[param]); + + return app; } else { return null; } @@ -133,9 +236,47 @@ function openRtbApp(bidRequest) { function openRtbDevice() { return { + ip: 'check', ua: navigator.userAgent, language: (navigator.language || navigator.browserLanguage || navigator.userLanguage || navigator.systemLanguage), }; } +function openRtbBCat(bidRequest) { + if (utils.isArray(bidRequest.params.bcat)) { + return bidRequest.params.bcat; + } + return []; +} + +function openRtbBAdv(bidRequest) { + if (utils.isArray(bidRequest.params.badv)) { + return bidRequest.params.badv; + } + return []; +} + +function isVideo (format) { + return utils.deepAccess(format, 'mediaTypes.video') || format.mediaType == 'video'; +} + +/* Turn bid request sizes into compatible format */ +function getSizes(requestSizes) { + let width = 0; + let height = 0; + if (utils.isArray(requestSizes) && requestSizes.length === 2 && + !utils.isArray(requestSizes[0])) { + width = parseInt(requestSizes[0], 10); + height = parseInt(requestSizes[1], 10); + } else if (typeof requestSizes === 'object') { + for (let i = 0; i < requestSizes.length; i++) { + let size = requestSizes[i]; + width = parseInt(size[0], 10); + height = parseInt(size[1], 10); + break; + } + } + return [width, height]; +} + registerBidder(spec); diff --git a/modules/somoaudienceBidAdapter.md b/modules/somoaudienceBidAdapter.md index a622d73d84b..10af6023cb5 100644 --- a/modules/somoaudienceBidAdapter.md +++ b/modules/somoaudienceBidAdapter.md @@ -6,6 +6,8 @@ # Description Connects to Somo Audience demand source. Please use ```somoaudience``` as the bidder code. + +For video integration, somoAudience returns content as vastXML and requires the publisher to define the cache url in config passed to Prebid for it to be valid in the auction # Test Site Parameters ``` var adUnits = [{ diff --git a/test/spec/modules/somoaudienceBidAdapter_spec.js b/test/spec/modules/somoaudienceBidAdapter_spec.js index 2189cacb0ec..79ece7ffcf6 100644 --- a/test/spec/modules/somoaudienceBidAdapter_spec.js +++ b/test/spec/modules/somoaudienceBidAdapter_spec.js @@ -1,97 +1,481 @@ import {expect} from 'chai'; import {spec} from 'modules/somoaudienceBidAdapter'; -import {getTopWindowLocation, getTopWindowReferrer} from 'src/utils'; -import {newBidder} from 'src/adapters/bidderFactory'; +import * as utils from 'src/utils'; describe('Somo Audience Adapter Tests', () => { - const bidderSet = [ - { - bidder: 'somoaudience', - params: { - placementId: 'test' - } - }, - ]; - - const bidderAppSet = [ - { - bidder: 'somoaudience', - params: { - placementId: 'test', - app: { - bundle: 'com.somoaudience.apps', - storeUrl: 'http://somoaudience.com/apps', - domain: 'somoaudience.com', + describe('isBidRequestValid', () => { + it('should return false when given an invalid bid', () => { + const bid = { + bidder: 'somoaudience', + }; + const isValid = spec.isBidRequestValid(bid); + expect(isValid).to.equal(false); + }); + it('should return true when given a placementId bid', () => { + const bid = { + bidder: 'somoaudience', + params: { + placementId: 'test' } - } - }, - ]; - - const bidderBadSet = [ - { - bidder: 'somoaudience', - params: { - placement_id: 'test' - } - }, - ]; - - it('Verifies bidder code', () => { - expect(spec.code).to.equal('somoaudience'); + }; + const isValid = spec.isBidRequestValid(bid); + expect(isValid).to.equal(true); + }); }); - it('Verifies bidder aliases', () => { - expect(spec.aliases).to.have.lengthOf(1); - expect(spec.aliases[0]).to.equal('somo'); - }); + describe('buildRequests', () => { + describe('buildBannerRequests', () => { + it('should properly build a banner request with type not defined and sizes not defined', () => { + const bidRequests = [{ + bidder: 'somoaudience', + params: { + placementId: 'test' + } + }]; + const request = spec.buildRequests(bidRequests); + expect(request[0].url).to.equal('//publisher-east.mobileadtrading.com/rtb/bid?s=test'); + expect(request[0].method).to.equal('POST'); + const ortbRequest = request[0].data; + expect(ortbRequest.site).to.not.equal(null); + expect(ortbRequest.site.ref).to.equal(utils.getTopWindowReferrer()); + expect(ortbRequest.site.page).to.equal(utils.getTopWindowLocation().href); + expect(ortbRequest.site.domain).to.not.be.undefined; + expect(ortbRequest.imp).to.have.lengthOf(1); + expect(ortbRequest.device).to.not.equal(null); + expect(ortbRequest.device.ua).to.equal(navigator.userAgent); + expect(ortbRequest.imp[0].bidfloor).to.not.be.null; + expect(ortbRequest.imp[0].banner).to.not.equal(null); + }); - it('Verifies if bid request valid', () => { - expect(spec.isBidRequestValid(bidderSet[0])).to.equal(true); - expect(spec.isBidRequestValid(bidderAppSet[0])).to.equal(true); - expect(spec.isBidRequestValid({})).to.equal(false); - expect(spec.isBidRequestValid(bidderBadSet[0])).to.equal(false); - expect(spec.isBidRequestValid({ params: {} })).to.equal(false); - expect(spec.isBidRequestValid({ params: { placementId: '12345' } })).to.equal(true); - }); + it('should properly build a banner request with sizes defined in 2d array', () => { + const bidRequests = [{ + bidder: 'somoaudience', + sizes: [[300, 250]], + params: { + placementId: 'test' + } + }]; + const request = spec.buildRequests(bidRequests); + expect(request[0].url).to.equal('//publisher-east.mobileadtrading.com/rtb/bid?s=test'); + expect(request[0].method).to.equal('POST'); + const ortbRequest = request[0].data; + expect(ortbRequest.site).to.not.equal(null); + expect(ortbRequest.site.ref).to.equal(utils.getTopWindowReferrer()); + expect(ortbRequest.site.page).to.equal(utils.getTopWindowLocation().href); + expect(ortbRequest.site.domain).to.not.be.undefined; + expect(ortbRequest.imp).to.have.lengthOf(1); + expect(ortbRequest.imp[0].bidfloor).to.not.be.null; + expect(ortbRequest.imp[0].banner).to.not.equal(null); + expect(ortbRequest.imp[0].banner.w).to.equal(300); + expect(ortbRequest.imp[0].banner.h).to.equal(250); + }); + it('should properly build a banner request with sizes defined in 1d array', () => { + const bidRequests = [{ + bidder: 'somoaudience', + sizes: [300, 250], + params: { + placementId: 'test' + } + }]; + const request = spec.buildRequests(bidRequests); + expect(request[0].url).to.equal('//publisher-east.mobileadtrading.com/rtb/bid?s=test'); + expect(request[0].method).to.equal('POST'); + const ortbRequest = request[0].data; + expect(ortbRequest.site).to.not.equal(null); + expect(ortbRequest.site.ref).to.equal(utils.getTopWindowReferrer()); + expect(ortbRequest.site.page).to.equal(utils.getTopWindowLocation().href); + expect(ortbRequest.site.domain).to.not.be.undefined; + expect(ortbRequest.imp).to.have.lengthOf(1); + expect(ortbRequest.imp[0].bidfloor).to.not.be.null; + expect(ortbRequest.imp[0].banner).to.not.equal(null); + expect(ortbRequest.imp[0].banner.w).to.equal(300); + expect(ortbRequest.imp[0].banner.h).to.equal(250); + expect(ortbRequest.imp[0].banner.mimes).to.equal(undefined); + expect(ortbRequest.imp[0].banner.btype).to.equal(undefined); + expect(ortbRequest.imp[0].banner.pos).to.equal(undefined); + expect(ortbRequest.imp[0].banner.battr).to.equal(undefined); + }); + + it('should populate optional banner parameters', () => { + const bidRequests = [ + { + bidder: 'somoaudience', + sizes: [[300, 200]], + mediaType: 'banner', + params: { + placementId: 'test', + banner: { + mimes: 'video/mp4', + btype: '4', + pos: '1', + battr: 'ibv', + } + } + } + ]; + const request = spec.buildRequests(bidRequests); + const ortbRequest = request[0].data; + expect(ortbRequest.imp[0].banner).to.not.equal(null); + expect(ortbRequest.imp[0].banner.w).to.equal(300); + expect(ortbRequest.imp[0].banner.h).to.equal(200); + expect(ortbRequest.imp[0].banner.mimes).to.equal('video/mp4'); + expect(ortbRequest.imp[0].banner.btype).to.equal('4'); + expect(ortbRequest.imp[0].banner.pos).to.equal('1'); + expect(ortbRequest.imp[0].banner.battr).to.equal('ibv'); + }); + }); + + describe('buildVideoRequests', () => { + it('should properly build a video request with sizes defined', () => { + const bidRequests = [{ + bidder: 'somoaudience', + mediaTypes: { + video: {} + }, + sizes: [200, 300], + params: { + placementId: 'test' + } + }]; + const request = spec.buildRequests(bidRequests); + const ortbRequest = request[0].data; + expect(ortbRequest.site).to.not.equal(null); + expect(ortbRequest.site.ref).to.equal(utils.getTopWindowReferrer()); + expect(ortbRequest.site.page).to.equal(utils.getTopWindowLocation().href); + expect(ortbRequest.site.domain).to.not.be.undefined; + expect(ortbRequest.imp).to.have.lengthOf(1); + expect(ortbRequest.imp[0].video).to.not.equal(null); + expect(ortbRequest.imp[0].video.w).to.equal(200); + expect(ortbRequest.imp[0].video.h).to.equal(300); + }); + + it('should properly build a video request with sizes defined in 2d array', () => { + const bidRequests = [{ + bidder: 'somoaudience', + mediaTypes: { + video: {} + }, + sizes: [[200, 300]], + params: { + placementId: 'test' + } + }]; + const request = spec.buildRequests(bidRequests); + const ortbRequest = request[0].data; + expect(ortbRequest.site).to.not.equal(null); + expect(ortbRequest.site.ref).to.equal(utils.getTopWindowReferrer()); + expect(ortbRequest.site.page).to.equal(utils.getTopWindowLocation().href); + expect(ortbRequest.site.domain).to.not.be.undefined; + expect(ortbRequest.imp).to.have.lengthOf(1); + expect(ortbRequest.imp[0].video).to.not.equal(null); + expect(ortbRequest.imp[0].video.w).to.equal(200); + expect(ortbRequest.imp[0].video.h).to.equal(300); + }); + it('should properly build a video request with sizes not defined', () => { + const bidRequests = [{ + bidder: 'somoaudience', + mediaType: 'video', + params: { + placementId: 'test' + } + }]; + const request = spec.buildRequests(bidRequests); + const ortbRequest = request[0].data; + expect(ortbRequest.imp).to.have.lengthOf(1); + expect(ortbRequest.imp[0].video).to.not.equal(null); + expect(ortbRequest.imp[0].video.mimes).to.equal(undefined); + expect(ortbRequest.imp[0].video.minduration).to.equal(undefined); + expect(ortbRequest.imp[0].video.maxduration).to.equal(undefined); + expect(ortbRequest.imp[0].video.protocols).to.equal(undefined); + expect(ortbRequest.imp[0].video.startdelay).to.equal(undefined); + expect(ortbRequest.imp[0].video.linearity).to.equal(undefined); + expect(ortbRequest.imp[0].video.skip).to.equal(undefined); + expect(ortbRequest.imp[0].video.delivery).to.equal(undefined); + expect(ortbRequest.imp[0].video.pos).to.equal(undefined); + expect(ortbRequest.imp[0].video.api).to.equal(undefined); + expect(ortbRequest.imp[0].video.battr).to.equal(undefined); + }); + + it('should populate optional video parameters', () => { + const bidRequests = [ + { + bidder: 'somoaudience', + sizes: [[200, 300]], + mediaType: 'video', + params: { + placementId: 'test', + video: { + mimes: 'video/mp4', + minduration: '15', + maxduration: '30', + protocols: 'mp4', + startdelay: '0', + linearity: 'linear', + skip: '1', + delivery: 'web', + pos: '1', + api: 'VPAID 1.0', + battr: 'ibv', + } + } + } + ]; + const request = spec.buildRequests(bidRequests); + const ortbRequest = request[0].data; + expect(ortbRequest.imp[0].video).to.not.equal(null); + expect(ortbRequest.imp[0].video.w).to.equal(200); + expect(ortbRequest.imp[0].video.h).to.equal(300); + expect(ortbRequest.imp[0].video.mimes).to.equal('video/mp4'); + expect(ortbRequest.imp[0].video.minduration).to.equal('15'); + expect(ortbRequest.imp[0].video.maxduration).to.equal('30'); + expect(ortbRequest.imp[0].video.protocols).to.equal('mp4'); + expect(ortbRequest.imp[0].video.startdelay).to.equal('0'); + expect(ortbRequest.imp[0].video.linearity).to.equal('linear'); + expect(ortbRequest.imp[0].video.skip).to.equal('1'); + expect(ortbRequest.imp[0].video.delivery).to.equal('web'); + expect(ortbRequest.imp[0].video.pos).to.equal('1'); + expect(ortbRequest.imp[0].video.api).to.equal('VPAID 1.0'); + expect(ortbRequest.imp[0].video.battr).to.equal('ibv'); + }); + }); + + describe('buildSiteRequests', () => { + it('should fill in basic site parameters', () => { + const bidRequests = [{ + bidder: 'somoaudience', + params: { + placementId: 'test' + } + }]; + const request = spec.buildRequests(bidRequests); + const ortbRequest = request[0].data; + expect(ortbRequest.app).to.equal(null); + expect(ortbRequest.site).to.not.equal(null); + expect(ortbRequest.site.ref).to.equal(utils.getTopWindowReferrer()); + expect(ortbRequest.site.page).to.equal(utils.getTopWindowLocation().href); + expect(ortbRequest.site.domain).to.not.be.undefined; + }); + + it('should fill in optional site parameters', () => { + const bidRequests = [{ + bidder: 'somoaudience', + params: { + placementId: 'test', + site: { + domain: 'somoaudience.com', + name: 'Somo Audience', + cat: 'IAB-25', + keywords: 'unit testing', + content: 'Unit Testing' + } + } + }]; + const request = spec.buildRequests(bidRequests); + const ortbRequest = request[0].data; + expect(ortbRequest.app).to.equal(null); + expect(ortbRequest.site).to.not.equal(null); + expect(ortbRequest.site.name).to.equal('Somo Audience'); + expect(ortbRequest.site.domain).to.equal('somoaudience.com'); + expect(ortbRequest.site.cat).to.equal('IAB-25'); + expect(ortbRequest.site.keywords).to.equal('unit testing'); + expect(ortbRequest.site.content).to.equal('Unit Testing'); + }) + }); + + describe('buildAppRequests', () => { + it('should fill in app parameters', () => { + const bidRequests = [{ + bidder: 'somoaudience', + params: { + placementId: 'test', + app: { + bundle: 'com.somoaudience.apps', + storeUrl: 'http://somoaudience.com/apps', + domain: 'somoaudience.com', + name: 'Generic SomoAudience App 5', + cat: 'IAB-25', + keywords: 'unit testing', + content: 'Unit Testing', + ver: '5.423-s', + } + } + }]; + const request = spec.buildRequests(bidRequests); + const ortbRequest = request[0].data; + expect(ortbRequest.site).to.equal(null); + expect(ortbRequest.app).to.not.be.null; + expect(ortbRequest.app.bundle).to.equal('com.somoaudience.apps'); + expect(ortbRequest.app.storeUrl).to.equal('http://somoaudience.com/apps'); + expect(ortbRequest.app.domain).to.equal('somoaudience.com'); + expect(ortbRequest.app.name).to.equal('Generic SomoAudience App 5'); + expect(ortbRequest.app.ver).to.equal('5.423-s'); + expect(ortbRequest.app.cat).to.equal('IAB-25'); + expect(ortbRequest.app.keywords).to.equal('unit testing'); + expect(ortbRequest.app.content).to.equal('Unit Testing'); + }); + }); - it('Verifies buildRequests', () => { - const request = spec.buildRequests(bidderSet); - let br = request[0]; - expect(br.url).to.equal('//publisher-east.mobileadtrading.com/rtb/bid?s=test'); - expect(br.method).to.equal('POST'); - const ortbRequest = br.data; - expect(ortbRequest.site).to.not.equal(null); - expect(ortbRequest.site.ref).to.equal(getTopWindowReferrer()); - expect(ortbRequest.site.page).to.equal(getTopWindowLocation().href); - expect(ortbRequest.imp).to.have.lengthOf(1); - expect(ortbRequest.device).to.not.equal(null); - expect(ortbRequest.device.ua).to.equal(navigator.userAgent); + describe('buildGDPRRequests', () => { + const bidderRequest = { + gdprConsent: { + gdprApplies: true, + consentString: 'test' + }, + }; + + it('should properly build request with gdpr consent', () => { + const bidRequests = [{ + bidder: 'somoaudience', + params: { + placementId: 'test' + } + }]; + const request = spec.buildRequests(bidRequests, bidderRequest); + const ortbRequest = request[0].data; + expect(ortbRequest.reqs).to.not.equal(undefined); + expect(ortbRequest.reqs.ext).to.not.equal(undefined); + expect(ortbRequest.reqs.ext.gdpr).to.equal(true); + expect(ortbRequest.user).to.not.equal(undefined); + expect(ortbRequest.user.ext).to.not.equal(undefined); + expect(ortbRequest.user.ext.consent).to.equal('test'); + }); + it('should properly build request with gdpr not applies', () => { + bidderRequest.gdprConsent.gdprApplies = false; + const bidRequests = [{ + bidder: 'somoaudience', + params: { + placementId: 'test' + } + }]; + const request = spec.buildRequests(bidRequests, bidderRequest); + const ortbRequest = request[0].data; + expect(ortbRequest.reqs).to.not.equal(undefined); + expect(ortbRequest.reqs.ext).to.not.equal(undefined); + expect(ortbRequest.reqs.ext.gdpr).to.equal(false); + expect(ortbRequest.user).to.not.equal(undefined); + expect(ortbRequest.user.ext).to.not.equal(undefined); + expect(ortbRequest.user.ext.consent).to.equal('test'); + }); + }); + + describe('buildExtraArgsRequests', () => { + it('should populate optional parameters', () => { + const bidRequests = [ + { + bidder: 'somoaudience', + params: { + placementId: 'test', + bcat: ['IAB-2', 'IAB-7'], + badv: ['somoaudience.com', 'mobileadtrading.com'], + bidfloor: '0.05', + }, + } + ]; + const request = spec.buildRequests(bidRequests); + const ortbRequest = request[0].data; + expect(ortbRequest.imp[0].bidfloor).to.not.be.null; + expect(ortbRequest.imp[0].bidfloor).to.be.equal('0.05'); + expect(ortbRequest.bcat).to.not.be.null; + expect(ortbRequest.bcat).to.have.lengthOf(2); + expect(ortbRequest.bcat).to.contain('IAB-2'); + expect(ortbRequest.badv).to.not.be.null; + expect(ortbRequest.badv).to.have.lengthOf(2); + expect(ortbRequest.badv).to.contain('somoaudience.com'); + }); + }); }); - it('Verify parse response', () => { - const request = spec.buildRequests(bidderSet); - const ortbRequest = request[0].data; - const ortbResponse = { - seatbid: [{ - bid: [{ - impid: ortbRequest.imp[0].id, - price: 1.25, - adm: 'Somo Test Ad' + describe('interpretResponse', () => { + it('Verify banner parse response', () => { + const bidRequests = [ + { + bidder: 'somoaudience', + params: { + placementId: 'test', + }, + bidId: '234234234', + } + ]; + const request = spec.buildRequests(bidRequests); + const ortbRequest = request[0].data; + const ortbResponse = { + seatbid: [{ + bid: [{ + impid: ortbRequest.imp[0].id, + price: 1.25, + adm: 'Somo Test Ad' + }], + bidId: '234234234' }] - }] - }; - const bids = spec.interpretResponse({ body: ortbResponse }, request); - const bid = bids[0]; - expect(bid.cpm).to.equal(1.25); - expect(bid.ad).to.equal('Somo Test Ad'); + }; + const bids = spec.interpretResponse({ body: ortbResponse }, {bidRequest: bidRequests[0]}); + const bid = bids[0]; + expect(bid.cpm).to.equal(1.25); + expect(bid.ad).to.equal('Somo Test Ad'); + }); + + it('Verify video parse response', () => { + const bidRequests = [ + { + bidder: 'somoaudience', + mediaTypes: { + video: { + } + }, + params: { + placementId: 'test', + }, + bidId: '234234234', + } + ]; + const request = spec.buildRequests(bidRequests); + const ortbRequest = request[0].data; + const ortbResponse = { + seatbid: [{ + bid: [{ + impid: ortbRequest.imp[0].id, + price: 1.25, + adm: 'Somo Test Ad' + }], + bidId: '234234234' + }] + }; + const bids = spec.interpretResponse({ body: ortbResponse }, {bidRequest: bidRequests[0]}); + const bid = bids[0]; + expect(bid.cpm).to.equal(1.25); + expect(bid.vastXml).to.equal('Somo Test Ad'); + }); }); - it('Verify app requests', () => { - const request = spec.buildRequests(bidderAppSet); - const ortbRequest = request[0].data; - expect(ortbRequest.site).to.equal(null); - expect(ortbRequest.app).to.not.be.null; - expect(ortbRequest.app.bundle).to.equal('com.somoaudience.apps'); - expect(ortbRequest.app.storeurl).to.equal('http://somoaudience.com/apps'); - expect(ortbRequest.app.domain).to.equal('somoaudience.com'); + + describe('user sync', () => { + it('should register the pixel sync url', () => { + let syncs = spec.getUserSyncs({ + pixelEnabled: true + }); + expect(syncs).to.not.be.an('undefined'); + expect(syncs).to.have.lengthOf(1); + expect(syncs[0].type).to.equal('image'); + }); + + it('should pass gdpr params', () => { + let syncs = spec.getUserSyncs({ pixelEnabled: true }, {}, { + gdprApplies: false, consentString: 'test' + }); + expect(syncs).to.not.be.an('undefined'); + expect(syncs).to.have.lengthOf(1); + expect(syncs[0].type).to.equal('image'); + expect(syncs[0].url).to.contains('gdpr=0'); + }); + + it('should pass gdpr applies params', () => { + let syncs = spec.getUserSyncs({ pixelEnabled: true }, {}, { + gdprApplies: true, consentString: 'test' + }); + expect(syncs).to.not.be.an('undefined'); + expect(syncs).to.have.lengthOf(1); + expect(syncs[0].type).to.equal('image'); + expect(syncs[0].url).to.contains('gdpr=1'); + expect(syncs[0].url).to.contains('gdpr_consent=test'); + }); }); }); From e36f10e6d52463d4f3e993ad9524ce3d2fec00b4 Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Mon, 20 Aug 2018 21:14:44 +0100 Subject: [PATCH 34/83] Audience Network: correct TTL, allow platform override (#2974) --- modules/audienceNetworkBidAdapter.js | 19 +++++++++++++++---- .../modules/audienceNetworkBidAdapter_spec.js | 19 ++++++++++++++++--- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/modules/audienceNetworkBidAdapter.js b/modules/audienceNetworkBidAdapter.js index 12810a960c1..544670863b8 100644 --- a/modules/audienceNetworkBidAdapter.js +++ b/modules/audienceNetworkBidAdapter.js @@ -2,7 +2,6 @@ * @file AudienceNetwork adapter. */ import { registerBidder } from 'src/adapters/bidderFactory'; -import { config } from 'src/config'; import { formatQS } from 'src/url'; import { generateUUID, getTopWindowUrl, isSafariBrowser, convertTypes } from 'src/utils'; import findIndex from 'core-js/library/fn/array/find-index'; @@ -15,9 +14,11 @@ const url = 'https://an.facebook.com/v2/placementbid.json'; const supportedMediaTypes = ['banner', 'video']; const netRevenue = true; const hbBidder = 'fan'; +const ttl = 600; +const videoTtl = 3600; const platver = '$prebid.version$'; const platform = '241394079772386'; -const adapterver = '1.0.0'; +const adapterver = '1.0.1'; /** * Does this bid request contain valid parameters? @@ -93,6 +94,13 @@ const isFullWidth = format => format === 'fullwidth'; */ const sdkVersion = format => isVideo(format) ? '' : '5.5.web'; +/** + * Which platform identifier should be used? + * @param {Array} platforms Possible platform identifiers + * @returns {String} First valid platform found, or default if none found + */ +const findPlatform = platforms => [...platforms.filter(Boolean), platform][0]; + /** * Does the search part of the URL contain "anhb_testmode" * and therefore indicate testmode should be used? @@ -133,6 +141,7 @@ const getTopWindowUrlEncoded = () => encodeURIComponent(getTopWindowUrl()); * @param {String} bids[].placementCode - Prebid placement identifier * @param {Object} bids[].params * @param {String} bids[].params.placementId - Audience Network placement identifier + * @param {String} bids[].params.platform - Audience Network platform identifier (optional) * @param {String} bids[].params.format - Optional format, one of 'video', 'native' or 'fullwidth' if set * @param {Array} bids[].sizes - list of desired advert sizes * @param {Array} bids[].sizes[] - Size arrays [h,w]: should include one of [300, 250], [320, 50]: first matched size is used @@ -144,6 +153,7 @@ const buildRequests = bids => { const adformats = []; const sizes = []; const sdk = []; + const platforms = []; const requestIds = []; bids.forEach(bid => bid.sizes @@ -155,6 +165,7 @@ const buildRequests = bids => { adformats.push(bid.params.format || size); sizes.push(size); sdk.push(sdkVersion(bid.params.format)); + platforms.push(bid.params.platform); requestIds.push(bid.bidId); }) ); @@ -162,6 +173,7 @@ const buildRequests = bids => { // Build URL const testmode = isTestmode(); const pageurl = getTopWindowUrlEncoded(); + const platform = findPlatform(platforms); const search = { placementids, adformats, @@ -194,8 +206,6 @@ const buildRequests = bids => { * @returns {Array} A list of bid response objects */ const interpretResponse = ({ body }, { adformats, requestIds, sizes }) => { - const ttl = Number(config.getConfig().bidderTimeout); - const { bids = {} } = body; return Object.keys(bids) // extract Array of bid responses @@ -237,6 +247,7 @@ const interpretResponse = ({ body }, { adformats, requestIds, sizes }) => { const pageurl = getTopWindowUrlEncoded(); bidResponse.mediaType = 'video'; bidResponse.vastUrl = `https://an.facebook.com/v1/instream/vast.xml?placementid=${creativeId}&pageurl=${pageurl}&playerwidth=${width}&playerheight=${height}&bidid=${fbBidid}`; + bidResponse.ttl = videoTtl; } return bidResponse; }); diff --git a/test/spec/modules/audienceNetworkBidAdapter_spec.js b/test/spec/modules/audienceNetworkBidAdapter_spec.js index c61cd04c422..3e6a890e4dc 100644 --- a/test/spec/modules/audienceNetworkBidAdapter_spec.js +++ b/test/spec/modules/audienceNetworkBidAdapter_spec.js @@ -19,7 +19,7 @@ const placementId = 'test-placement-id'; const playerwidth = 320; const playerheight = 180; const requestId = 'test-request-id'; -const debug = 'adapterver=1.0.0&platform=241394079772386&platver=$prebid.version$'; +const debug = 'adapterver=1.0.1&platform=241394079772386&platver=$prebid.version$'; const pageUrl = encodeURIComponent(utils.getTopWindowUrl()); describe('AudienceNetwork adapter', () => { @@ -182,13 +182,17 @@ describe('AudienceNetwork adapter', () => { }]); }); - it('can build URL for fullwidth 300x250 unit', () => { + it('can build URL for fullwidth 300x250 unit, overriding platform', () => { + const platform = 'test-platform'; + const debugPlatform = debug.replace('241394079772386', platform); + expect(buildRequests([{ bidder, bidId: requestId, sizes: [[300, 250]], params: { placementId, + platform, format: 'fullwidth' } }])).to.deep.equal([{ @@ -197,7 +201,7 @@ describe('AudienceNetwork adapter', () => { requestIds: [requestId], sizes: ['300x250'], url: 'https://an.facebook.com/v2/placementbid.json', - data: `placementids[]=test-placement-id&adformats[]=fullwidth&testmode=false&pageurl=${pageUrl}&sdk[]=5.5.web&${debug}` + data: `placementids[]=test-placement-id&adformats[]=fullwidth&testmode=false&pageurl=${pageUrl}&sdk[]=5.5.web&${debugPlatform}` }]); }); @@ -249,6 +253,7 @@ describe('AudienceNetwork adapter', () => { .to.contain(`placementid:'${placementId}',format:'native',bidid:'test-bid-id'`, 'ad missing parameters') .and.to.contain('getElementsByTagName("style")', 'ad missing native styles') .and.to.contain('
', 'ad missing native container'); + expect(bidResponse.ttl).to.equal(600); expect(bidResponse.creativeId).to.equal(placementId); expect(bidResponse.netRevenue).to.equal(true); expect(bidResponse.currency).to.equal('USD'); @@ -287,6 +292,7 @@ describe('AudienceNetwork adapter', () => { .to.contain(`placementid:'${placementId}',format:'300x250',bidid:'test-bid-id'`, 'ad missing parameters') .and.not.to.contain('getElementsByTagName("style")', 'ad should not contain native styles') .and.not.to.contain('
', 'ad should not contain native container'); + expect(bidResponse.ttl).to.equal(600); expect(bidResponse.creativeId).to.equal(placementId); expect(bidResponse.netRevenue).to.equal(true); expect(bidResponse.currency).to.equal('USD'); @@ -320,6 +326,7 @@ describe('AudienceNetwork adapter', () => { expect(bidResponse.requestId).to.equal(requestId); expect(bidResponse.width).to.equal(300); expect(bidResponse.height).to.equal(250); + expect(bidResponse.ttl).to.equal(600); expect(bidResponse.creativeId).to.equal(placementId); expect(bidResponse.netRevenue).to.equal(true); expect(bidResponse.currency).to.equal('USD'); @@ -364,6 +371,7 @@ describe('AudienceNetwork adapter', () => { expect(bidResponseNative.width).to.equal(300); expect(bidResponseNative.height).to.equal(250); expect(bidResponseNative.ad).to.contain(`placementid:'${placementIdNative}',format:'native',bidid:'test-bid-id-native'`, 'ad missing parameters'); + expect(bidResponseNative.ttl).to.equal(600); expect(bidResponseNative.creativeId).to.equal(placementIdNative); expect(bidResponseNative.netRevenue).to.equal(true); expect(bidResponseNative.currency).to.equal('USD'); @@ -377,6 +385,7 @@ describe('AudienceNetwork adapter', () => { expect(bidResponseIab.width).to.equal(300); expect(bidResponseIab.height).to.equal(250); expect(bidResponseIab.ad).to.contain(`placementid:'${placementIdIab}',format:'300x250',bidid:'test-bid-id-iab'`, 'ad missing parameters'); + expect(bidResponseIab.ttl).to.equal(600); expect(bidResponseIab.creativeId).to.equal(placementIdIab); expect(bidResponseIab.netRevenue).to.equal(true); expect(bidResponseIab.currency).to.equal('USD'); @@ -410,6 +419,7 @@ describe('AudienceNetwork adapter', () => { expect(bidResponse.cpm).to.equal(1.23); expect(bidResponse.requestId).to.equal(requestId); + expect(bidResponse.ttl).to.equal(3600); expect(bidResponse.mediaType).to.equal('video'); expect(bidResponse.vastUrl).to.equal(`https://an.facebook.com/v1/instream/vast.xml?placementid=${placementId}&pageurl=${pageUrl}&playerwidth=${playerwidth}&playerheight=${playerheight}&bidid=${bidId}`); expect(bidResponse.width).to.equal(playerwidth); @@ -450,6 +460,7 @@ describe('AudienceNetwork adapter', () => { expect(bidResponseVideo.cpm).to.equal(1.23); expect(bidResponseVideo.requestId).to.equal(requestId); + expect(bidResponseVideo.ttl).to.equal(3600); expect(bidResponseVideo.mediaType).to.equal('video'); expect(bidResponseVideo.vastUrl).to.equal(`https://an.facebook.com/v1/instream/vast.xml?placementid=${videoPlacementId}&pageurl=${pageUrl}&playerwidth=${playerwidth}&playerheight=${playerheight}&bidid=${videoBidId}`); expect(bidResponseVideo.width).to.equal(playerwidth); @@ -457,6 +468,7 @@ describe('AudienceNetwork adapter', () => { expect(bidResponseNative.cpm).to.equal(4.56); expect(bidResponseNative.requestId).to.equal(requestId); + expect(bidResponseNative.ttl).to.equal(600); expect(bidResponseNative.width).to.equal(300); expect(bidResponseNative.height).to.equal(250); expect(bidResponseNative.ad).to.contain(`placementid:'${nativePlacementId}',format:'native',bidid:'${nativeBidId}'`); @@ -490,6 +502,7 @@ describe('AudienceNetwork adapter', () => { .to.contain(`placementid:'${placementId}',format:'native',bidid:'test-bid-id'`, 'ad missing parameters') .and.to.contain('getElementsByTagName("style")', 'ad missing native styles') .and.to.contain('
', 'ad missing native container'); + expect(bidResponse.ttl).to.equal(600); expect(bidResponse.creativeId).to.equal(placementId); expect(bidResponse.netRevenue).to.equal(true); expect(bidResponse.currency).to.equal('USD'); From c09d9db7a49dde12aafa99e139a3cce1f308f11d Mon Sep 17 00:00:00 2001 From: Daniel Russell Date: Mon, 20 Aug 2018 13:17:06 -0700 Subject: [PATCH 35/83] fix tests running in headless chrome inside a docker environment (#2965) * fix tests running in headless chrome if inside a docker environment * -mdelete unnecessary conditional * add is-docker to devDependencies instead of regular dependencies --- karma.conf.maker.js | 14 +++++++++++++- package.json | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/karma.conf.maker.js b/karma.conf.maker.js index 0a4e10d9792..7faf91f0847 100644 --- a/karma.conf.maker.js +++ b/karma.conf.maker.js @@ -92,7 +92,19 @@ function setBrowsers(karmaConf, browserstack) { karmaConf.customLaunchers = require('./browsers.json') karmaConf.browsers = Object.keys(karmaConf.customLaunchers); } else { - karmaConf.browsers = ['ChromeHeadless']; + var isDocker = require('is-docker')(); + if (isDocker) { + karmaConf.customLaunchers = karmaConf.customLaunchers || {}; + karmaConf.customLaunchers.ChromeCustom = { + base: 'ChromeHeadless', + // We must disable the Chrome sandbox when running Chrome inside Docker (Chrome's sandbox needs + // more permissions than Docker allows by default) + flags: ['--no-sandbox'] + } + karmaConf.browsers = ['ChromeCustom']; + } else { + karmaConf.browsers = ['ChromeHeadless']; + } } } diff --git a/package.json b/package.json index efb57eb9c59..0e70313b737 100644 --- a/package.json +++ b/package.json @@ -60,6 +60,7 @@ "gulp-uglify": "^3.0.0", "gulp-util": "^3.0.0", "ignore-loader": "^0.1.2", + "is-docker": "^1.1.0", "istanbul": "^0.4.5", "istanbul-instrumenter-loader": "^3.0.0", "json-loader": "^0.5.1", From 18bf1a1ab6595f81aa29784d78b990cbaed4dd27 Mon Sep 17 00:00:00 2001 From: Aparna Rao-Hegde Date: Mon, 20 Aug 2018 16:31:22 -0400 Subject: [PATCH 36/83] 33Across: GDPR compliancy (#2985) * check gdpr in buildRequest * User sync based on whether gdpr applies or not * check if consent data exists during user sync * split user sync into further branches: 1) when gdpr does not apply 2) when consent data is unavailable --- modules/33acrossBidAdapter.js | 40 +- test/spec/modules/33acrossBidAdapter_spec.js | 414 +++++++++++++------ 2 files changed, 313 insertions(+), 141 deletions(-) diff --git a/modules/33acrossBidAdapter.js b/modules/33acrossBidAdapter.js index 7b26f66331f..109d9387ce6 100644 --- a/modules/33acrossBidAdapter.js +++ b/modules/33acrossBidAdapter.js @@ -23,8 +23,9 @@ function _createBidResponse(response) { } } -// infer the necessary data from valid bid for a minimal ttxRequest and create HTTP request -function _createServerRequest(bidRequest) { +// Infer the necessary data from valid bid for a minimal ttxRequest and create HTTP request +// NOTE: At this point, TTX only accepts request for a single impression +function _createServerRequest(bidRequest, gdprConsent) { const ttxRequest = {}; const params = bidRequest.params; @@ -48,11 +49,24 @@ function _createServerRequest(bidRequest) { // therefore in ad targetting process ttxRequest.id = bidRequest.bidId; + // Set GDPR related fields + ttxRequest.user = { + ext: { + consent: gdprConsent.consentString + } + } + ttxRequest.regs = { + ext: { + gdpr: (gdprConsent.gdprApplies === true) ? 1 : 0 + } + } + // Finally, set the openRTB 'test' param if this is to be a test bid if (params.test === 1) { ttxRequest.test = 1; } + /* * Now construct the full server request */ @@ -104,11 +118,18 @@ function isBidRequestValid(bid) { return true; } -// NOTE: At this point, TTX only accepts request for a single impression -function buildRequests(bidRequests) { +// NOTE: With regards to gdrp consent data, +// - the server independently infers gdpr applicability therefore, setting the default value to false +// - the server, at this point, also doesn't need the consent string to handle gdpr compliance. So passing +// value whether set or not, for the sake of future dev. +function buildRequests(bidRequests, bidderRequest) { + const gdprConsent = Object.assign({ consentString: undefined, gdprApplies: false }, bidderRequest && bidderRequest.gdprConsent) + adapterState.uniqueSiteIds = bidRequests.map(req => req.params.siteId).filter(uniques); - return bidRequests.map(_createServerRequest); + return bidRequests.map((req) => { + return _createServerRequest(req, gdprConsent); + }); } // NOTE: At this point, the response from 33exchange will only ever contain one bid i.e. the highest bid @@ -124,8 +145,13 @@ function interpretResponse(serverResponse, bidRequest) { } // Register one sync per unique guid -function getUserSyncs(syncOptions) { - return (syncOptions.iframeEnabled) ? adapterState.uniqueSiteIds.map(_createSync) : ([]); +// NOTE: If gdpr applies do not sync +function getUserSyncs(syncOptions, responses, gdprConsent) { + if (gdprConsent && gdprConsent.gdprApplies === true) { + return [] + } else { + return (syncOptions.iframeEnabled) ? adapterState.uniqueSiteIds.map(_createSync) : ([]); + } } const spec = { diff --git a/test/spec/modules/33acrossBidAdapter_spec.js b/test/spec/modules/33acrossBidAdapter_spec.js index 8ca2f3da902..3dbd7401d76 100644 --- a/test/spec/modules/33acrossBidAdapter_spec.js +++ b/test/spec/modules/33acrossBidAdapter_spec.js @@ -40,6 +40,7 @@ describe('33acrossBidAdapter:', function () { afterEach(function() { this.sandbox.restore(); + delete this.bidRequests; }); describe('isBidRequestValid:', function () { @@ -112,150 +113,255 @@ describe('33acrossBidAdapter:', function () { }); describe('buildRequests:', function() { - it('returns corresponding server requests for each valid bidRequest', function() { - const ttxRequest = { - imp: [ { - banner: { - format: [ - { - w: 300, - h: 250, - ext: {} - }, - { - w: 728, - h: 90, - ext: {} + + context('when gdpr consent data exists', function() { + beforeEach(function() { + this.bidderRequest= { + gdprConsent: { + consentString: "foobarMyPreference", + gdprApplies: true + } + } + }); + + it('returns corresponding server requests with gdpr consent data', function() { + const ttxRequest = { + imp: [ { + banner: { + format: [ + { + w: 300, + h: 250, + ext: {} + }, + { + w: 728, + h: 90, + ext: {} + } + ] + }, + ext: { + ttx: { + prod: PRODUCT_ID } - ] + } + } ], + site: { + id: SITE_ID }, - ext: { - ttx: { - prod: PRODUCT_ID + id: 'b1', + user: { + ext: { + consent: "foobarMyPreference" + } + }, + regs: { + ext: { + gdpr: 1 } } - } ], - site: { - id: SITE_ID - }, - id: 'b1' - }; - const serverRequest = { - 'method': 'POST', - 'url': END_POINT, - 'data': JSON.stringify(ttxRequest), - 'options': { - 'contentType': 'text/plain', - 'withCredentials': true - } - } - const builtServerRequests = buildRequests(this.bidRequests); - expect(builtServerRequests).to.deep.equal([ serverRequest ]); - expect(builtServerRequests.length).to.equal(1); - }); + }; - it('returns corresponding test server requests for each valid bidRequest', function() { - this.sandbox.stub(config, 'getConfig').callsFake(() => { - return { - 'url': 'https://foo.com/hb/' + const serverRequest = { + 'method': 'POST', + 'url': END_POINT, + 'data': JSON.stringify(ttxRequest), + 'options': { + 'contentType': 'text/plain', + 'withCredentials': true + } } + const builtServerRequests = buildRequests(this.bidRequests, this.bidderRequest); + expect(builtServerRequests).to.deep.equal([ serverRequest ]); + expect(builtServerRequests.length).to.equal(1); }); - const ttxRequest = { - imp: [ { - banner: { - format: [ - { - w: 300, - h: 250, - ext: { } - }, - { - w: 728, - h: 90, - ext: { } + it('returns corresponding test server requests with gdpr consent data', function() { + this.sandbox.stub(config, 'getConfig').callsFake(() => { + return { + 'url': 'https://foo.com/hb/' + } + }); + + const ttxRequest = { + imp: [ { + banner: { + format: [ + { + w: 300, + h: 250, + ext: { } + }, + { + w: 728, + h: 90, + ext: { } + } + ] + }, + ext: { + ttx: { + prod: PRODUCT_ID } - ] + } + } ], + site: { + id: SITE_ID }, - ext: { - ttx: { - prod: PRODUCT_ID + id: 'b1', + user: { + ext: { + consent: "foobarMyPreference" + } + }, + regs: { + ext: { + gdpr: 1 } } - } ], - site: { - id: SITE_ID - }, - id: 'b1' - }; - const serverRequest = { - method: 'POST', - url: 'https://foo.com/hb/', - data: JSON.stringify(ttxRequest), - options: { - contentType: 'text/plain', - withCredentials: true - } - }; + }; + const serverRequest = { + method: 'POST', + url: 'https://foo.com/hb/', + data: JSON.stringify(ttxRequest), + options: { + contentType: 'text/plain', + withCredentials: true + } + }; + + const builtServerRequests = buildRequests(this.bidRequests, this.bidderRequest); + expect(builtServerRequests).to.deep.equal([ serverRequest ]); + expect(builtServerRequests.length).to.equal(1); + }); - const builtServerRequests = buildRequests(this.bidRequests); - expect(builtServerRequests).to.deep.equal([ serverRequest ]); - expect(builtServerRequests.length).to.equal(1); + afterEach(function() { + delete this.bidderRequest; + }) }); - it('returns corresponding test server requests for each valid bidRequest', function() { - this.sandbox.stub(config, 'getConfig').callsFake(() => { - return { - 'url': 'https://foo.com/hb/' - } + context('when gdpr consent data does not exist', function() { + beforeEach(function() { + this.bidderRequest= { } }); - this.bidRequests[0].params.test = 1; - const ttxRequest = { - imp: [ { - banner: { - format: [ - { - w: 300, - h: 250, - ext: { } - }, - { - w: 728, - h: 90, - ext: { } + + it('returns corresponding server requests with default gdpr consent data', function() { + const ttxRequest = { + imp: [ { + banner: { + format: [ + { + w: 300, + h: 250, + ext: {} + }, + { + w: 728, + h: 90, + ext: {} + } + ] + }, + ext: { + ttx: { + prod: PRODUCT_ID } - ] + } + } ], + site: { + id: SITE_ID }, - ext: { - ttx: { - prod: PRODUCT_ID + id: 'b1', + user: { + ext: { + consent: undefined + } + }, + regs: { + ext: { + gdpr: 0 } } - } ], - site: { - id: SITE_ID - }, - id: 'b1', - test: 1 - }; - const serverRequest = { - method: 'POST', - url: 'https://foo.com/hb/', - data: JSON.stringify(ttxRequest), - options: { - contentType: 'text/plain', - withCredentials: true + }; + + const serverRequest = { + 'method': 'POST', + 'url': END_POINT, + 'data': JSON.stringify(ttxRequest), + 'options': { + 'contentType': 'text/plain', + 'withCredentials': true + } } - }; + const builtServerRequests = buildRequests(this.bidRequests, this.bidderRequest); + expect(builtServerRequests).to.deep.equal([ serverRequest ]); + expect(builtServerRequests.length).to.equal(1); + }); - const builtServerRequests = buildRequests(this.bidRequests); - expect(builtServerRequests).to.deep.equal([ serverRequest ]); - expect(builtServerRequests.length).to.equal(1); - }); + it('returns corresponding test server requests with default gdpr consent data', function() { + this.sandbox.stub(config, 'getConfig').callsFake(() => { + return { + 'url': 'https://foo.com/hb/' + } + }); + + const ttxRequest = { + imp: [ { + banner: { + format: [ + { + w: 300, + h: 250, + ext: { } + }, + { + w: 728, + h: 90, + ext: { } + } + ] + }, + ext: { + ttx: { + prod: PRODUCT_ID + } + } + } ], + site: { + id: SITE_ID + }, + id: 'b1', + user: { + ext: { + consent: undefined + } + }, + regs: { + ext: { + gdpr: 0 + } + } + }; + const serverRequest = { + method: 'POST', + url: 'https://foo.com/hb/', + data: JSON.stringify(ttxRequest), + options: { + contentType: 'text/plain', + withCredentials: true + } + }; - afterEach(function() { - delete this.bidRequests; - }) + const builtServerRequests = buildRequests(this.bidRequests, this.bidderRequest); + expect(builtServerRequests).to.deep.equal([ serverRequest ]); + expect(builtServerRequests.length).to.equal(1); + }); + + afterEach(function() { + delete this.bidderRequest; + }) + }); }); describe('interpretResponse', function() { @@ -452,23 +558,63 @@ describe('33acrossBidAdapter:', function () { ]; }); - context('when iframe is not enabled', function() { - it('returns empty sync array', function() { - const syncOptions = {}; - buildRequests(this.bidRequests); - expect(getUserSyncs(syncOptions)).to.deep.equal([]); + context('when gdpr does not apply', function() { + beforeEach(function() { + this.gdprConsent = { + gdprApplies: false + } + }); + + context('when iframe is not enabled', function() { + it('returns empty sync array', function() { + const syncOptions = {}; + buildRequests(this.bidRequests); + expect(getUserSyncs(syncOptions, {}, this.gdprConsent)).to.deep.equal([]); + }); + }); + + context('when iframe is enabled', function() { + it('returns sync array equal to number of unique siteIDs', function() { + const syncOptions = { + iframeEnabled: true + }; + buildRequests(this.bidRequests); + const syncs = getUserSyncs(syncOptions, {}, this.gdprConsent); + expect(syncs).to.deep.equal(this.syncs); + }); }); }); - context('when iframe is enabled', function() { - it('returns sync array equal to number of unique siteIDs', function() { - const syncOptions = { - iframeEnabled: true - }; - buildRequests(this.bidRequests); - const syncs = getUserSyncs(syncOptions); - expect(syncs).to.deep.equal(this.syncs); + context('when consent data is not defined', function() { + context('when iframe is not enabled', function() { + it('returns empty sync array', function() { + const syncOptions = {}; + buildRequests(this.bidRequests); + expect(getUserSyncs(syncOptions)).to.deep.equal([]); + }); + }); + + context('when iframe is enabled', function() { + it('returns sync array equal to number of unique siteIDs', function() { + const syncOptions = { + iframeEnabled: true + }; + buildRequests(this.bidRequests); + const syncs = getUserSyncs(syncOptions); + expect(syncs).to.deep.equal(this.syncs); + }); }); }); + + context('when gdpr applies', function() { + it('returns empty sync array', function() { + const syncOptions = {}; + const gdprConsent = { + gdprApplies: true + } + buildRequests(this.bidRequests); + expect(getUserSyncs(syncOptions, {}, gdprConsent)).to.deep.equal([]); + }); + }) }); }); From 65df3bbbd3d3feb0e684aff0f223179ee6113651 Mon Sep 17 00:00:00 2001 From: Andrew Bowman Date: Tue, 21 Aug 2018 10:17:04 -0400 Subject: [PATCH 37/83] Appnexus adaptor - Added App parameters for hybrid apps. (#2973) * Added hybrid app parameters and debug url parameters * Fix test for app parameters. removed debugging * added defensive code per review from @jaiminpanchal27 * simplified if/then statements * fix JS lint issue --- modules/appnexusBidAdapter.js | 38 +++++++++++++++++ modules/appnexusBidAdapter.md | 41 ++++++++++++++++-- test/spec/modules/appnexusBidAdapter_spec.js | 44 ++++++++++++++++++++ 3 files changed, 120 insertions(+), 3 deletions(-) diff --git a/modules/appnexusBidAdapter.js b/modules/appnexusBidAdapter.js index d5cb3ac2800..7dac4b8b182 100644 --- a/modules/appnexusBidAdapter.js +++ b/modules/appnexusBidAdapter.js @@ -10,6 +10,7 @@ const URL = '//ib.adnxs.com/ut/v3/prebid'; const VIDEO_TARGETING = ['id', 'mimes', 'minduration', 'maxduration', 'startdelay', 'skippable', 'playback_method', 'frameworks']; const USER_PARAMS = ['age', 'external_uid', 'segments', 'gender', 'dnt', 'language']; +const APP_DEVICE_PARAMS = ['geo', 'device_id']; // appid is collected separately const NATIVE_MAPPING = { body: 'description', cta: 'ctatext', @@ -59,6 +60,23 @@ export const spec = { .forEach(param => userObj[param] = userObjBid.params.user[param]); } + const appDeviceObjBid = find(bidRequests, hasAppDeviceInfo); + let appDeviceObj; + if (appDeviceObjBid && appDeviceObjBid.params && appDeviceObjBid.params.app) { + appDeviceObj = {}; + Object.keys(appDeviceObjBid.params.app) + .filter(param => includes(APP_DEVICE_PARAMS, param)) + .forEach(param => appDeviceObj[param] = appDeviceObjBid.params.app[param]); + } + + const appIdObjBid = find(bidRequests, hasAppId); + let appIdObj; + if (appIdObjBid && appIdObjBid.params && appDeviceObjBid.params.app && appDeviceObjBid.params.app.id) { + appIdObj = { + appid: appIdObjBid.params.app.id + }; + } + const memberIdBid = find(bidRequests, hasMemberId); const member = memberIdBid ? parseInt(memberIdBid.params.member, 10) : 0; @@ -74,6 +92,13 @@ export const spec = { payload.member_id = member; } + if (appDeviceObjBid) { + payload.device = appDeviceObj + } + if (appIdObjBid) { + payload.app = appIdObj; + } + if (bidderRequest && bidderRequest.gdprConsent) { // note - objects for impbus use underscore instead of camelCase payload.gdpr_consent = { @@ -381,6 +406,19 @@ function hasMemberId(bid) { return !!parseInt(bid.params.member, 10); } +function hasAppDeviceInfo(bid) { + if (bid.params) { + return !!bid.params.app + } +} + +function hasAppId(bid) { + if (bid.params && bid.params.app) { + return !!bid.params.app.id + } + return !!bid.params.app +} + function getRtbBid(tag) { return tag && tag.ads && tag.ads.length && find(tag.ads, ad => ad.rtb); } diff --git a/modules/appnexusBidAdapter.md b/modules/appnexusBidAdapter.md index 58f260cdfc8..822bd62997f 100644 --- a/modules/appnexusBidAdapter.md +++ b/modules/appnexusBidAdapter.md @@ -17,9 +17,13 @@ Appnexus bid adapter supports Banner, Video (instream and outstream) and Native. var adUnits = [ // Banner adUnit { - code: 'banner-div', - sizes: [[300, 250], [300,600]], - bids: [{ + code: 'banner-div', + mediaTypes: { + banner: { + sizes: [[300, 250], [300,600]] + } + } + bids: [{ bidder: 'appnexus', params: { placementId: '10433394' @@ -98,6 +102,37 @@ var adUnits = [ } } ] + }, + // Banner adUnit in a App Webview + // Only use this for situations where prebid.js is in a webview of an App + // See Prebid Mobile for displaying ads via an SDK + { + code: 'banner-div', + mediaTypes: { + banner: { + sizes: [[300, 250], [300,600]] + } + } + bids: [{ + bidder: 'appnexus', + params: { + placementId: '10433394', + app: { + id: "B1O2W3M4AN.com.prebid.webview", + geo: { + lat: 40.0964439, + lng: -75.3009142 + }, + device_id: { + idfa: "4D12078D-3246-4DA4-AD5E-7610481E7AE", // Apple advertising identifier + aaid: "38400000-8cf0-11bd-b23e-10b96e40000d", // Android advertising identifier + md5udid: "5756ae9022b2ea1e47d84fead75220c8", // MD5 hash of the ANDROID_ID + sha1udid: "4DFAA92388699AC6539885AEF1719293879985BF", // SHA1 hash of the ANDROID_ID + windowsadid: "750c6be243f1c4b5c9912b95a5742fc5" // Windows advertising identifier + } + } + } + }] } ]; ``` diff --git a/test/spec/modules/appnexusBidAdapter_spec.js b/test/spec/modules/appnexusBidAdapter_spec.js index abfd50d1746..b65988e3ec1 100644 --- a/test/spec/modules/appnexusBidAdapter_spec.js +++ b/test/spec/modules/appnexusBidAdapter_spec.js @@ -326,6 +326,50 @@ describe('AppNexusAdapter', () => { expect(payload.gdpr_consent.consent_string).to.exist.and.to.equal(consentString); expect(payload.gdpr_consent.consent_required).to.exist.and.to.be.true; }); + + it('supports sending hybrid mobile app parameters', () => { + let appRequest = Object.assign({}, + bidRequests[0], + { + params: { + placementId: '10433394', + app: { + id: 'B1O2W3M4AN.com.prebid.webview', + geo: { + lat: 40.0964439, + lng: -75.3009142 + }, + device_id: { + idfa: '4D12078D-3246-4DA4-AD5E-7610481E7AE', // Apple advertising identifier + aaid: '38400000-8cf0-11bd-b23e-10b96e40000d', // Android advertising identifier + md5udid: '5756ae9022b2ea1e47d84fead75220c8', // MD5 hash of the ANDROID_ID + sha1udid: '4DFAA92388699AC6539885AEF1719293879985BF', // SHA1 hash of the ANDROID_ID + windowsadid: '750c6be243f1c4b5c9912b95a5742fc5' // Windows advertising identifier + } + } + } + } + ); + const request = spec.buildRequests([appRequest]); + const payload = JSON.parse(request.data); + expect(payload.app).to.exist; + expect(payload.app).to.deep.equal({ + appid: 'B1O2W3M4AN.com.prebid.webview' + }); + expect(payload.device.device_id).to.exist; + expect(payload.device.device_id).to.deep.equal({ + aaid: '38400000-8cf0-11bd-b23e-10b96e40000d', + idfa: '4D12078D-3246-4DA4-AD5E-7610481E7AE', + md5udid: '5756ae9022b2ea1e47d84fead75220c8', + sha1udid: '4DFAA92388699AC6539885AEF1719293879985BF', + windowsadid: '750c6be243f1c4b5c9912b95a5742fc5' + }); + expect(payload.device.geo).to.exist; + expect(payload.device.geo).to.deep.equal({ + lat: 40.0964439, + lng: -75.3009142 + }); + }); }) describe('interpretResponse', () => { From dc8c822d5c6f70e5e3dc696a0ac3b41418c1fd77 Mon Sep 17 00:00:00 2001 From: jsnellbaker <31102355+jsnellbaker@users.noreply.github.com> Date: Tue, 21 Aug 2018 10:23:27 -0400 Subject: [PATCH 38/83] fix lint errors in 33across files (#3002) --- modules/33acrossBidAdapter.js | 1 - test/spec/modules/33acrossBidAdapter_spec.js | 19 +++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/modules/33acrossBidAdapter.js b/modules/33acrossBidAdapter.js index 109d9387ce6..6b41c652152 100644 --- a/modules/33acrossBidAdapter.js +++ b/modules/33acrossBidAdapter.js @@ -66,7 +66,6 @@ function _createServerRequest(bidRequest, gdprConsent) { ttxRequest.test = 1; } - /* * Now construct the full server request */ diff --git a/test/spec/modules/33acrossBidAdapter_spec.js b/test/spec/modules/33acrossBidAdapter_spec.js index 3dbd7401d76..2779209c1cf 100644 --- a/test/spec/modules/33acrossBidAdapter_spec.js +++ b/test/spec/modules/33acrossBidAdapter_spec.js @@ -113,12 +113,11 @@ describe('33acrossBidAdapter:', function () { }); describe('buildRequests:', function() { - context('when gdpr consent data exists', function() { beforeEach(function() { - this.bidderRequest= { + this.bidderRequest = { gdprConsent: { - consentString: "foobarMyPreference", + consentString: 'foobarMyPreference', gdprApplies: true } } @@ -151,9 +150,9 @@ describe('33acrossBidAdapter:', function () { id: SITE_ID }, id: 'b1', - user: { + user: { ext: { - consent: "foobarMyPreference" + consent: 'foobarMyPreference' } }, regs: { @@ -210,9 +209,9 @@ describe('33acrossBidAdapter:', function () { id: SITE_ID }, id: 'b1', - user: { + user: { ext: { - consent: "foobarMyPreference" + consent: 'foobarMyPreference' } }, regs: { @@ -243,7 +242,7 @@ describe('33acrossBidAdapter:', function () { context('when gdpr consent data does not exist', function() { beforeEach(function() { - this.bidderRequest= { } + this.bidderRequest = { } }); it('returns corresponding server requests with default gdpr consent data', function() { @@ -273,7 +272,7 @@ describe('33acrossBidAdapter:', function () { id: SITE_ID }, id: 'b1', - user: { + user: { ext: { consent: undefined } @@ -332,7 +331,7 @@ describe('33acrossBidAdapter:', function () { id: SITE_ID }, id: 'b1', - user: { + user: { ext: { consent: undefined } From 031943c94811dc0b61b2c77802f7982f4a4c68a1 Mon Sep 17 00:00:00 2001 From: Jaimin Panchal Date: Tue, 21 Aug 2018 11:15:59 -0400 Subject: [PATCH 39/83] fix getHighestCpmBids function (#2990) --- src/prebid.js | 7 +++---- test/spec/unit/pbjs_api_spec.js | 27 ++++++++++++++++++++------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/prebid.js b/src/prebid.js index ac7731d92fd..ea7e3fadd8e 100644 --- a/src/prebid.js +++ b/src/prebid.js @@ -1,13 +1,13 @@ /** @module pbjs */ import { getGlobal } from './prebidGlobal'; -import { flatten, uniques, isGptPubadsDefined, adUnitsFilter, removeRequestId, getLatestHighestCpmBid } from './utils'; +import { flatten, uniques, isGptPubadsDefined, adUnitsFilter, removeRequestId } from './utils'; import { listenMessagesFromCreative } from './secureCreatives'; import { userSync } from 'src/userSync.js'; import { loadScript } from './adloader'; import { config } from './config'; import { auctionManager } from './auctionManager'; -import { targeting, getHighestCpmBidsFromBidPool, RENDERED, BID_TARGETING_SET } from './targeting'; +import { targeting, RENDERED, BID_TARGETING_SET } from './targeting'; import { createHook } from 'src/hook'; import { sessionLoader } from 'src/debugging'; import includes from 'core-js/library/fn/array/includes'; @@ -600,8 +600,7 @@ $$PREBID_GLOBAL$$.getAllPrebidWinningBids = function () { * @return {Array} array containing highest cpm bid object(s) */ $$PREBID_GLOBAL$$.getHighestCpmBids = function (adUnitCode) { - let bidsReceived = getHighestCpmBidsFromBidPool(auctionManager.getBidsReceived(), getLatestHighestCpmBid); - return targeting.getWinningBids(adUnitCode, bidsReceived) + return targeting.getWinningBids(adUnitCode) .map(removeRequestId); }; diff --git a/test/spec/unit/pbjs_api_spec.js b/test/spec/unit/pbjs_api_spec.js index d46a8d740a5..385adc321d0 100644 --- a/test/spec/unit/pbjs_api_spec.js +++ b/test/spec/unit/pbjs_api_spec.js @@ -1809,12 +1809,9 @@ describe('Unit: Prebid Module', function () { }); describe('getHighestCpm', () => { - // it('returns an array of winning bid objects for each adUnit', () => { - // const highestCpmBids = $$PREBID_GLOBAL$$.getHighestCpmBids(); - // expect(highestCpmBids.length).to.equal(2); - // expect(highestCpmBids[0]).to.deep.equal(auctionManager.getBidsReceived()[1]); - // expect(highestCpmBids[1]).to.deep.equal(auctionManager.getBidsReceived()[2]); - // }); + after(() => { + resetAuction(); + }); it('returns an array containing the highest bid object for the given adUnitCode', () => { const highestCpmBids = $$PREBID_GLOBAL$$.getHighestCpmBids('/19968336/header-bid-tag-0'); @@ -1834,7 +1831,23 @@ describe('Unit: Prebid Module', function () { const highestCpmBids = $$PREBID_GLOBAL$$.getHighestCpmBids('/19968336/header-bid-tag-0'); expect(highestCpmBids.length).to.equal(0); - resetAuction(); + }); + + it('should not return rendered bid', function() { + let _bidsReceived = getBidResponses().slice(0, 3); + _bidsReceived[0].cpm = 12; + _bidsReceived[0].status = 'rendered'; + _bidsReceived[1].cpm = 9; + _bidsReceived[2].cpm = 11; + + _bidsReceived.forEach((bid) => { + bid.adUnitCode = '/19968336/header-bid-tag-0'; + }); + + auction.getBidsReceived = function() { return _bidsReceived }; + + const highestCpmBids = $$PREBID_GLOBAL$$.getHighestCpmBids('/19968336/header-bid-tag-0'); + expect(highestCpmBids[0]).to.deep.equal(auctionManager.getBidsReceived()[2]); }); }); From 754625780d9eff551cf0a3dab3b0d236c6ce36c7 Mon Sep 17 00:00:00 2001 From: Rich Snapp Date: Tue, 21 Aug 2018 09:42:38 -0600 Subject: [PATCH 40/83] Update from travis to circle CI in release documentation --- RELEASE_SCHEDULE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASE_SCHEDULE.md b/RELEASE_SCHEDULE.md index 0c424e76ed4..637ed354c74 100644 --- a/RELEASE_SCHEDULE.md +++ b/RELEASE_SCHEDULE.md @@ -17,7 +17,7 @@ Announcements regarding releases will be made to the #headerbidding-dev channel ## Release Process -1. Make Sure all browserstack tests are passing. On PR merge to master travis will run unit tests on browserstack. Checking the last travis build [here](https://travis-ci.org/prebid/Prebid.js/branches) for master branch will show you detailed results. +1. Make Sure all browserstack tests are passing. On PR merge to master CircleCI will run unit tests on browserstack. Checking the last CircleCI build [here](https://circleci.com/gh/prebid) for master branch will show you detailed results. In case of failure do following, - Try to fix the failing tests. From 744261399710797136457d38b6e3a72901eb3653 Mon Sep 17 00:00:00 2001 From: Rich Snapp Date: Tue, 21 Aug 2018 10:05:00 -0600 Subject: [PATCH 41/83] moved assignment of `bid.getCpmInNewCurrency` function for currency (#2997) --- modules/currency.js | 14 +++++++++----- test/spec/modules/currency_spec.js | 12 ++++++++++-- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/modules/currency.js b/modules/currency.js index 25eddc5b993..f66c33bbed8 100644 --- a/modules/currency.js +++ b/modules/currency.js @@ -154,6 +154,14 @@ export function addBidResponseHook(adUnitCode, bid, fn) { bid.currency = 'USD'; } + let fromCurrency = bid.currency; + let cpm = bid.cpm; + + // used for analytics + bid.getCpmInNewCurrency = function(toCurrency) { + return (parseFloat(cpm) * getCurrencyConversion(fromCurrency, toCurrency)).toFixed(3); + }; + // execute immediately if the bid is already in the desired currency if (bid.currency === adServerCurrency) { return fn.apply(this, arguments); @@ -178,16 +186,12 @@ function wrapFunction(fn, context, params) { let fromCurrency = bid.currency; try { let conversion = getCurrencyConversion(fromCurrency); - let cpm = bid.originalCpm = bid.cpm; + bid.originalCpm = bid.cpm; bid.originalCurrency = bid.currency; if (conversion !== 1) { bid.cpm = (parseFloat(bid.cpm) * conversion).toFixed(4); bid.currency = adServerCurrency; } - // used for analytics - bid.getCpmInNewCurrency = function(toCurrency) { - return (parseFloat(cpm) * getCurrencyConversion(fromCurrency, toCurrency)).toFixed(3); - }; } catch (e) { utils.logWarn('Returning NO_BID, getCurrencyConversion threw error: ', e); params[1] = bidfactory.createBid(STATUS.NO_BID, { diff --git a/test/spec/modules/currency_spec.js b/test/spec/modules/currency_spec.js index a4ef643fece..74e2b8a3c38 100644 --- a/test/spec/modules/currency_spec.js +++ b/test/spec/modules/currency_spec.js @@ -62,7 +62,9 @@ describe('currency', function () { innerBid = bid; }); - expect(innerBid.currency).to.equal('GBP') + expect(innerBid.currency).to.equal('GBP'); + expect(typeof innerBid.getCpmInNewCurrency).to.equal('function'); + expect(innerBid.getCpmInNewCurrency('GBP')).to.equal('1.000'); }); it('uses adapter currency over currency override if specified', () => { @@ -82,7 +84,9 @@ describe('currency', function () { innerBid = bid; }); - expect(innerBid.currency).to.equal('JPY') + expect(innerBid.currency).to.equal('JPY'); + expect(typeof innerBid.getCpmInNewCurrency).to.equal('function'); + expect(innerBid.getCpmInNewCurrency('JPY')).to.equal('1.000'); }); it('uses rates specified in json when provided', () => { @@ -103,6 +107,8 @@ describe('currency', function () { }); expect(innerBid.cpm).to.equal('1.0000'); + expect(typeof innerBid.getCpmInNewCurrency).to.equal('function'); + expect(innerBid.getCpmInNewCurrency('JPY')).to.equal('100.000'); }); it('uses default rates when currency file fails to load', () => { @@ -128,6 +134,8 @@ describe('currency', function () { }); expect(innerBid.cpm).to.equal('1.0000'); + expect(typeof innerBid.getCpmInNewCurrency).to.equal('function'); + expect(innerBid.getCpmInNewCurrency('JPY')).to.equal('100.000'); }); }); From 40c368f5fe0307b4f0ad4ad4079d0555719d96ec Mon Sep 17 00:00:00 2001 From: Rich Snapp Date: Tue, 21 Aug 2018 10:11:41 -0600 Subject: [PATCH 42/83] Prebid 1.21.0 Release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0e70313b737..c66782e3a88 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "prebid.js", - "version": "1.21.0-pre", + "version": "1.21.0", "description": "Header Bidding Management Library", "main": "src/prebid.js", "scripts": { From 11ec22a75636ba79bf635224cb7affcae41c0778 Mon Sep 17 00:00:00 2001 From: Rich Snapp Date: Tue, 21 Aug 2018 10:27:09 -0600 Subject: [PATCH 43/83] Increment pre version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c66782e3a88..377f49b3810 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "prebid.js", - "version": "1.21.0", + "version": "1.22.0-pre", "description": "Header Bidding Management Library", "main": "src/prebid.js", "scripts": { From e1e03db7f3d7a8122a547a97f035d1dac71e8cc0 Mon Sep 17 00:00:00 2001 From: jsnellbaker <31102355+jsnellbaker@users.noreply.github.com> Date: Wed, 22 Aug 2018 08:10:31 -0400 Subject: [PATCH 44/83] update gulp test to include lint (#3003) * update gulp test to include lint * adding lint erro in appnexus adapter to test circleci * fixing lint error previous test commit added --- gulpfile.js | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index d2955f7d777..92dd2a7c1f1 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -39,7 +39,7 @@ var port = 9999; // Tasks gulp.task('default', ['webpack']); -gulp.task('serve', ['lint', 'build-bundle-dev', 'watch', 'test']); +gulp.task('serve', ['build-bundle-dev', 'watch', 'test']); gulp.task('serve-nw', ['lint', 'watch', 'e2etest']); @@ -49,8 +49,8 @@ gulp.task('build', ['build-bundle-prod']); gulp.task('clean', function () { return gulp.src(['build'], { - read: false - }) + read: false + }) .pipe(clean()); }); @@ -78,13 +78,13 @@ var explicitModules = [ function bundle(dev, moduleArr) { var modules = moduleArr || helpers.getArgModules(), - allModules = helpers.getModuleNames(modules); + allModules = helpers.getModuleNames(modules); - if(modules.length === 0) { + if (modules.length === 0) { modules = allModules.filter(module => !explicitModules.includes(module)); } else { var diff = _.difference(modules, allModules); - if(diff.length !== 0) { + if (diff.length !== 0) { throw new gutil.PluginError({ plugin: 'bundle', message: 'invalid modules: ' + diff.join(', ') @@ -106,13 +106,13 @@ function bundle(dev, moduleArr) { gutil.log('Generating bundle:', outputFileName); return gulp.src( - entries - ) + entries + ) .pipe(gulpif(dev, sourcemaps.init({loadMaps: true}))) .pipe(concat(outputFileName)) .pipe(gulpif(!argv.manualEnable, footer('\n<%= global %>.processQueue();', { - global: prebid.globalVarName - } + global: prebid.globalVarName + } ))) .pipe(gulpif(dev, sourcemaps.write('.'))); } @@ -186,7 +186,7 @@ gulp.task('webpack', ['clean'], function () { // If --file "" is given, the task will only run tests in the specified file. // If --browserstack is given, it will run the full suite of currently supported browsers. // If --browsers is given, browsers can be chosen explicitly. e.g. --browsers=chrome,firefox,ie9 -gulp.task('test', ['clean'], function (done) { +gulp.task('test', ['clean', 'lint'], function (done) { var karmaConf = karmaConfMaker(false, argv.browserstack, argv.watch, argv.file); var browserOverride = helpers.parseBrowserArgs(argv).map(helpers.toCapitalCase); @@ -229,7 +229,7 @@ gulp.task('watch', function () { 'modules/**/*.js', 'test/spec/**/*.js', '!test/spec/loaders/**/*.js' - ], ['lint', 'build-bundle-dev', 'test']); + ], ['build-bundle-dev', 'test']); gulp.watch([ 'loaders/**/*.js', 'test/spec/loaders/**/*.js' @@ -264,7 +264,7 @@ gulp.task('docs', ['clean-docs'], function () { gulp.task('e2etest', ['devpack', 'webpack'], function() { var cmdQueue = []; - if(argv.browserstack) { + if (argv.browserstack) { var browsers = require('./browsers.json'); delete browsers['bs_ie_9_windows_7']; @@ -276,11 +276,11 @@ gulp.task('e2etest', ['devpack', 'webpack'], function() { var startWith = 'bs'; - Object.keys(browsers).filter(function(v){ + Object.keys(browsers).filter(function(v) { return v.substring(0, startWith.length) === startWith && browsers[v].browser !== 'iphone'; - }).map(function(v,i,arr) { - var newArr = (i%2 === 0) ? arr.slice(i,i+2) : null; - if(newArr) { + }).map(function(v, i, arr) { + var newArr = (i % 2 === 0) ? arr.slice(i, i + 2) : null; + if (newArr) { var cmd = 'nightwatch --env ' + newArr.join(',') + cmdStr; cmdQueue.push(cmd); } From 322a7b870f12b3bf0a1750d3c1b634b40e098b8c Mon Sep 17 00:00:00 2001 From: Jacek Drobiecki Date: Wed, 22 Aug 2018 21:26:41 +0200 Subject: [PATCH 45/83] AdOcean adapter: GDPR support (#2988) * GDPR support * do not send empty gdpr_consent * AdOcean adapter: tests for gdpr_support * remove old comment --- modules/adoceanBidAdapter.js | 16 ++++++++++------ test/spec/modules/adoceanBidAdapter_spec.js | 19 ++++++++++++++++--- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/modules/adoceanBidAdapter.js b/modules/adoceanBidAdapter.js index 1949e0414a7..21e13e77a0a 100644 --- a/modules/adoceanBidAdapter.js +++ b/modules/adoceanBidAdapter.js @@ -15,11 +15,15 @@ function buildEndpointUrl(emiter, payload) { return 'https://' + emiter + '/ad.json?' + payloadString; } -function buildRequest(masterBidRequests, masterId) { +function buildRequest(masterBidRequests, masterId, gdprConsent) { const firstBid = masterBidRequests[0]; const payload = { id: masterId, }; + if (gdprConsent) { + payload.gdpr_consent = gdprConsent.consentString || undefined; + payload.gdpr = gdprConsent.gdprApplies ? 1 : 0; + } const bidIdMap = {}; @@ -72,15 +76,15 @@ export const spec = { return !!(bid.params.slaveId && bid.params.masterId && bid.params.emiter); }, - buildRequests: function(validBidRequests) { + buildRequests: function(validBidRequests, bidderRequest) { const bidRequestsByMaster = {}; let requests = []; - utils._each(validBidRequests, function(v) { - assignToMaster(v, bidRequestsByMaster); + utils._each(validBidRequests, function(bidRequest) { + assignToMaster(bidRequest, bidRequestsByMaster); }); - requests = utils._map(bidRequestsByMaster, function(v, k) { - return buildRequest(v, k); + requests = utils._map(bidRequestsByMaster, function(requests, masterId) { + return buildRequest(requests, masterId, bidderRequest.gdprConsent); }); return requests; diff --git a/test/spec/modules/adoceanBidAdapter_spec.js b/test/spec/modules/adoceanBidAdapter_spec.js index 149b9eb4d53..39eb514752a 100644 --- a/test/spec/modules/adoceanBidAdapter_spec.js +++ b/test/spec/modules/adoceanBidAdapter_spec.js @@ -57,23 +57,36 @@ describe('AdoceanAdapter', () => { } ]; + const bidderRequest = { + gdprConsent: { + consentString: 'BOQHk-4OSlWKFBoABBPLBd-AAAAgWAHAACAAsAPQBSACmgFTAOkA', + gdprApplies: true + } + }; + it('should add bidIdMap with slaveId => bidId mapping', () => { - const request = spec.buildRequests(bidRequests)[0]; + const request = spec.buildRequests(bidRequests, bidderRequest)[0]; expect(request.bidIdMap).to.exists; const bidIdMap = request.bidIdMap; expect(bidIdMap[bidRequests[0].params.slaveId]).to.equal(bidRequests[0].bidId); }); it('sends bid request to url via GET', () => { - const request = spec.buildRequests(bidRequests)[0]; + const request = spec.buildRequests(bidRequests, bidderRequest)[0]; expect(request.method).to.equal('GET'); expect(request.url).to.match(new RegExp(`^https://${bidRequests[0].params.emiter}/ad.json`)); }); it('should attach id to url', () => { - const request = spec.buildRequests(bidRequests)[0]; + const request = spec.buildRequests(bidRequests, bidderRequest)[0]; expect(request.url).to.include('id=' + bidRequests[0].params.masterId); }); + + it('should attach consent information to url', () => { + const request = spec.buildRequests(bidRequests, bidderRequest)[0]; + expect(request.url).to.include('gdpr=1'); + expect(request.url).to.include('gdpr_consent=' + bidderRequest.gdprConsent.consentString); + }); }) describe('interpretResponse', () => { From 3838a8f1d99c708b0903f722015f45e4f7a686ab Mon Sep 17 00:00:00 2001 From: jsnellbaker <31102355+jsnellbaker@users.noreply.github.com> Date: Thu, 23 Aug 2018 10:31:51 -0400 Subject: [PATCH 46/83] update appnexus md file with working examples (#3014) --- modules/appnexusBidAdapter.md | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/modules/appnexusBidAdapter.md b/modules/appnexusBidAdapter.md index 822bd62997f..a1d12243888 100644 --- a/modules/appnexusBidAdapter.md +++ b/modules/appnexusBidAdapter.md @@ -22,58 +22,59 @@ var adUnits = [ banner: { sizes: [[300, 250], [300,600]] } - } + }, bids: [{ bidder: 'appnexus', params: { - placementId: '10433394' + placementId: 13144370 } }] }, // Native adUnit { code: 'native-div', - sizes: [[300, 250], [300,600]], + sizes: [[1, 1]], mediaTypes: { native: { title: { - required: true, - len: 80 - }, - body: { required: true }, - brand: { + body: { required: true }, image: { required: true }, - clickUrl: { + sponsoredBy: { required: true }, + icon: { + required: false + } } }, bids: [{ bidder: 'appnexus', params: { - placementId: '9880618' + placementId: 13232354, + allowSmallerSizes: true } }] }, // Video instream adUnit { code: 'video-instream', - sizes: [640, 480], + sizes: [[640, 480]], mediaTypes: { video: { + playerSize: [[640, 480]], context: 'instream' }, }, bids: [{ bidder: 'appnexus', params: { - placementId: '9333431', + placementId: 13232361, video: { skippable: true, playback_methods: ['auto_play_sound_off'] @@ -84,9 +85,10 @@ var adUnits = [ // Video outstream adUnit { code: 'video-outstream', - sizes: [[640, 480]], + sizes: [[300, 250]], mediaTypes: { video: { + playerSize: [[300, 250]], context: 'outstream' } }, @@ -94,7 +96,7 @@ var adUnits = [ { bidder: 'appnexus', params: { - placementId: '5768085', + placementId: 13232385, video: { skippable: true, playback_method: ['auto_play_sound_off'] @@ -116,7 +118,7 @@ var adUnits = [ bids: [{ bidder: 'appnexus', params: { - placementId: '10433394', + placementId: 13144370, app: { id: "B1O2W3M4AN.com.prebid.webview", geo: { From ab2c0500a53e772ed1e7ce76287bf3f967c9cc5b Mon Sep 17 00:00:00 2001 From: ankur-modi <38654685+ankur-modi@users.noreply.github.com> Date: Thu, 23 Aug 2018 21:12:36 +0530 Subject: [PATCH 47/83] support gdpr for one video adapter (#2981) * support gdpr for one video adapter * gdpr support 1video --- modules/oneVideoBidAdapter.js | 30 ++++++++++++++++-- test/spec/modules/oneVideoBidAdapter_spec.js | 32 ++++++++++++++++++++ 2 files changed, 59 insertions(+), 3 deletions(-) diff --git a/modules/oneVideoBidAdapter.js b/modules/oneVideoBidAdapter.js index 38367837faf..5b1fd999ee6 100644 --- a/modules/oneVideoBidAdapter.js +++ b/modules/oneVideoBidAdapter.js @@ -36,14 +36,17 @@ export const spec = { * Make a server request from the list of BidRequests. * * @param {validBidRequests[]} - an array of bids + * @param bidderRequest * @return ServerRequest Info describing the request to the server. */ - buildRequests: function(bids) { + buildRequests: function(bids, bidRequest) { + let consentData = bidRequest ? bidRequest.gdprConsent : null; + return bids.map(bid => { return { method: 'POST', url: location.protocol + spec.ENDPOINT + bid.params.pubId, - data: getRequestData(bid), + data: getRequestData(bid, consentData), options: {contentType: 'application/json'}, bidRequest: bid } @@ -127,7 +130,11 @@ function getSize(sizes) { }; } -function getRequestData(bid) { +function isConsentRequired(consentData) { + return !!(consentData && consentData.gdprApplies); +} + +function getRequestData(bid, consentData) { let loc = utils.getTopWindowLocation(); let global = (window.top) ? window.top : window; let page = (bid.params.site && bid.params.site.page) ? (bid.params.site.page) : (loc.href); @@ -179,6 +186,23 @@ function getRequestData(bid) { if (bid.params.site && bid.params.site.id) { bidData.site.id = bid.params.site.id } + + if (isConsentRequired(consentData)) { + bidData.regs = { + ext: { + gdpr: 1 + } + }; + + if (consentData.consentString) { + bidData.user = { + ext: { + consent: consentData.consentString + } + }; + } + } + return bidData; } diff --git a/test/spec/modules/oneVideoBidAdapter_spec.js b/test/spec/modules/oneVideoBidAdapter_spec.js index 3d7bba417f9..278b39fd079 100644 --- a/test/spec/modules/oneVideoBidAdapter_spec.js +++ b/test/spec/modules/oneVideoBidAdapter_spec.js @@ -1,9 +1,12 @@ import { expect } from 'chai'; import { spec } from 'modules/oneVideoBidAdapter'; import * as utils from 'src/utils'; +import {config} from 'src/config'; describe('OneVideoBidAdapter', () => { let bidRequest; + let bidderRequest; + let mockConfig; beforeEach(() => { bidRequest = { @@ -132,4 +135,33 @@ describe('OneVideoBidAdapter', () => { expect(bidResponse).to.deep.equal(o); }); }); + + describe('when GDPR applies', function () { + beforeEach(function () { + bidderRequest = { + gdprConsent: { + consentString: 'test-gdpr-consent-string', + gdprApplies: true + } + }; + + mockConfig = { + consentManagement: { + cmpApi: 'iab', + timeout: 1111, + allowAuctionWithoutConsent: 'cancel' + } + }; + }); + + it('should send a signal to specify that GDPR applies to this request', function () { + const request = spec.buildRequests([ bidRequest ], bidderRequest); + expect(request[0].data.regs.ext.gdpr).to.equal(1); + }); + + it('should send the consent string', function () { + const request = spec.buildRequests([ bidRequest ], bidderRequest); + expect(request[0].data.user.ext.consent).to.equal(bidderRequest.gdprConsent.consentString); + }); + }); }); From bf3beefc73b4445a19f24267e04a7ce9e814e414 Mon Sep 17 00:00:00 2001 From: bretg Date: Fri, 24 Aug 2018 11:51:25 -0400 Subject: [PATCH 48/83] Rubicon adapter: adding size 320x180 (#3018) --- modules/rubiconBidAdapter.js | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/rubiconBidAdapter.js b/modules/rubiconBidAdapter.js index 83c3c69cf15..0f66aa36fb0 100644 --- a/modules/rubiconBidAdapter.js +++ b/modules/rubiconBidAdapter.js @@ -71,6 +71,7 @@ var sizeMap = { 199: '640x200', 213: '1030x590', 214: '980x360', + 229: '320x180', 232: '580x400', 257: '400x600' }; From ce1ea590856805fe603b4933f3542871672982a4 Mon Sep 17 00:00:00 2001 From: Rich Snapp Date: Fri, 24 Aug 2018 12:51:01 -0600 Subject: [PATCH 49/83] few tweaks and clarifications to release documentation (#3020) * few tweaks and clarifications to release documentation * added release template to release instructions * fix formatting * fix formatting --- RELEASE_SCHEDULE.md | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/RELEASE_SCHEDULE.md b/RELEASE_SCHEDULE.md index 637ed354c74..a1fa77b7db0 100644 --- a/RELEASE_SCHEDULE.md +++ b/RELEASE_SCHEDULE.md @@ -17,6 +17,8 @@ Announcements regarding releases will be made to the #headerbidding-dev channel ## Release Process +_Note: If `github.com/prebid/Prebid.js` is not configured as the git origin for your repo, all of the following git commands will have to be modified to reference the proper remote (e.g. `upstream`)_ + 1. Make Sure all browserstack tests are passing. On PR merge to master CircleCI will run unit tests on browserstack. Checking the last CircleCI build [here](https://circleci.com/gh/prebid) for master branch will show you detailed results. In case of failure do following, @@ -24,6 +26,8 @@ Announcements regarding releases will be made to the #headerbidding-dev channel - If you are not able to fix tests in time. Skip the test, create issue and tag contributor. #### How to run tests in browserstack + + _Note: the following browserstack information is only relevant for debugging purposes, if you will not be debugging then it can be skipped._ Set the environment variables. You may want to add these to your `~/.bashrc` for convenience. @@ -59,11 +63,12 @@ Announcements regarding releases will be made to the #headerbidding-dev channel Pull these changes locally by running command ``` git pull + git fetch --tags ``` and verify the tag. -5. Update coveralls +5. Update coveralls _(skip for legacy)_ We use https://coveralls.io/ to show parts of code covered by unit tests. @@ -75,7 +80,9 @@ Announcements regarding releases will be made to the #headerbidding-dev channel Run `gulp coveralls` to update code coverage history. -6. Distribute the code +6. Distribute the code + + _Note: do not go to step 7 until step 6 has been verified completed._ Reach out to any of the Appnexus folks to trigger the jenkins job. @@ -83,7 +90,7 @@ Announcements regarding releases will be made to the #headerbidding-dev channel Jenkins job is moving files to appnexus cdn, pushing prebid.js to npm, purging cache and sending notification to slack. Move all the files from Appnexus CDN to jsDelivr and create bash script to do above tasks. -7. Post Release Steps +7. Post Release Version Update the version Manually edit Prebid's package.json to become "1.x.x-pre" (using the values for the next release). Then commit your changes. @@ -91,6 +98,17 @@ Announcements regarding releases will be made to the #headerbidding-dev channel git commit -m "Increment pre version" git push ``` + +8. Create new release draft + + Go to [github releases](https://github.com/prebid/Prebid.js/releases) and add a new draft for the next version of Prebid.js with the following template: +``` +## 🚀New Features + +## 🛠Maintenance + +## 🐛Bug Fixes +``` ## Beta Releases From d7f3f90ed42b4e47d64e5484b0a2638d42a47694 Mon Sep 17 00:00:00 2001 From: Jimmy Tu Date: Mon, 27 Aug 2018 10:30:27 -0700 Subject: [PATCH 50/83] OpenX Adapter: Fixed a bug where video requests do not have a bidder configuration code. (#3021) --- modules/openxBidAdapter.js | 4 ++-- test/spec/modules/openxBidAdapter_spec.js | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/openxBidAdapter.js b/modules/openxBidAdapter.js index 6a79681484e..952e706ef7d 100644 --- a/modules/openxBidAdapter.js +++ b/modules/openxBidAdapter.js @@ -8,7 +8,7 @@ import {parse} from 'src/url'; const SUPPORTED_AD_TYPES = [BANNER, VIDEO]; const BIDDER_CODE = 'openx'; const BIDDER_CONFIG = 'hb_pb'; -const BIDDER_VERSION = '2.1.3'; +const BIDDER_VERSION = '2.1.4'; let shouldSendBoPixel = true; @@ -201,6 +201,7 @@ function buildCommonQueryParamsFromBids(bids, bidderRequest) { tz: new Date().getTimezoneOffset(), tws: getViewportDimensions(isInIframe), be: 1, + bc: bids[0].params.bc || `${BIDDER_CONFIG}_${BIDDER_VERSION}`, dddid: utils._map(bids, bid => bid.transactionId).join(','), nocache: new Date().getTime() }; @@ -230,7 +231,6 @@ function buildOXBannerRequest(bids, bidderRequest) { let queryParams = buildCommonQueryParamsFromBids(bids, bidderRequest); let auids = utils._map(bids, bid => bid.params.unit); queryParams.aus = utils._map(bids, bid => utils.parseSizesInput(bid.sizes).join(',')).join('|'); - queryParams.bc = bids[0].params.bc || `${BIDDER_CONFIG}_${BIDDER_VERSION}`; queryParams.divIds = utils._map(bids, bid => encodeURIComponent(bid.adUnitCode)).join(','); if (auids.some(auid => auid)) { diff --git a/test/spec/modules/openxBidAdapter_spec.js b/test/spec/modules/openxBidAdapter_spec.js index c0588f2eff0..324f9d80ae4 100644 --- a/test/spec/modules/openxBidAdapter_spec.js +++ b/test/spec/modules/openxBidAdapter_spec.js @@ -839,6 +839,13 @@ describe('OpenxAdapter', () => { expect(dataParams.vwd).to.equal(640); }); + it('should send a bc parameter', () => { + const request = spec.buildRequests(bidRequestsWithMediaTypes); + const dataParams = request[0].data; + + expect(dataParams.bc).to.have.string('hb_pb'); + }); + describe('when using the video param', function () { let videoBidRequest; From 0bfe01331a8b08957f065d8373b179f5bc55cc65 Mon Sep 17 00:00:00 2001 From: Jaimin Panchal Date: Tue, 28 Aug 2018 08:52:56 -0400 Subject: [PATCH 51/83] Revert "Added render param in Sonobi adapter (#2970)" (#3027) This reverts commit 5e430e382922ee16e5e0cefa88198b9a01e60ba2. --- modules/sonobiBidAdapter.js | 3 --- test/spec/modules/sonobiBidAdapter_spec.js | 5 ----- 2 files changed, 8 deletions(-) diff --git a/modules/sonobiBidAdapter.js b/modules/sonobiBidAdapter.js index 779736520cc..3d9ad2ce976 100644 --- a/modules/sonobiBidAdapter.js +++ b/modules/sonobiBidAdapter.js @@ -66,9 +66,6 @@ export const spec = { if (validBidRequests[0].params.referrer) { payload.ref = validBidRequests[0].params.referrer; } - if (validBidRequests[0].params.render) { - payload.render = validBidRequests[0].params.render; - } // Apply GDPR parameters to request. if (bidderRequest && bidderRequest.gdprConsent) { diff --git a/test/spec/modules/sonobiBidAdapter_spec.js b/test/spec/modules/sonobiBidAdapter_spec.js index 63fb52b2dbd..1b0986cb8c1 100644 --- a/test/spec/modules/sonobiBidAdapter_spec.js +++ b/test/spec/modules/sonobiBidAdapter_spec.js @@ -207,11 +207,6 @@ describe('SonobiBidAdapter', () => { expect(bidRequests.data.s).not.to.be.empty expect(bidRequests.data.hfa).to.equal('hfakey') }) - it('should return a properly formatted request with render', () => { - bidRequest[0].params.render = 'safeframe' - const bidRequests = spec.buildRequests(bidRequest) - expect(bidRequests.data.render).to.equal('safeframe') - }) it('should return null if there is nothing to bid on', () => { const bidRequests = spec.buildRequests([{params: {}}]) From e83f3e843c557a67d2038da13fe4cb1f985fdd4a Mon Sep 17 00:00:00 2001 From: Jaimin Panchal Date: Tue, 28 Aug 2018 10:05:46 -0400 Subject: [PATCH 52/83] check for null in data (#3026) --- src/secureCreatives.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/secureCreatives.js b/src/secureCreatives.js index 2204a6e7643..cd289cf657f 100644 --- a/src/secureCreatives.js +++ b/src/secureCreatives.js @@ -25,7 +25,7 @@ function receiveMessage(ev) { return; } - if (data.adId) { + if (data && data.adId) { const adObject = find(auctionManager.getBidsReceived(), function (bid) { return bid.adId === data.adId; }); From 69a275a416227ba218029142468f5c4876b65536 Mon Sep 17 00:00:00 2001 From: Jaimin Panchal Date: Tue, 28 Aug 2018 10:33:44 -0400 Subject: [PATCH 53/83] Prebid 1.22.0 Release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 377f49b3810..892b7bcec43 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "prebid.js", - "version": "1.22.0-pre", + "version": "1.22.0", "description": "Header Bidding Management Library", "main": "src/prebid.js", "scripts": { From fa786348f53b3ab6f01c39e713b3c4f75578f2fd Mon Sep 17 00:00:00 2001 From: Jaimin Panchal Date: Tue, 28 Aug 2018 10:43:51 -0400 Subject: [PATCH 54/83] Increment pre version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 892b7bcec43..a71e6309103 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "prebid.js", - "version": "1.22.0", + "version": "1.23.0-pre", "description": "Header Bidding Management Library", "main": "src/prebid.js", "scripts": { From 8dc9a03e9c041d5fe65dc69bd60acd816edeadb3 Mon Sep 17 00:00:00 2001 From: Rich Snapp Date: Thu, 30 Aug 2018 08:03:51 -0600 Subject: [PATCH 55/83] Remove unused pbjs.cbTimeout (#3028) --- src/prebid.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/prebid.js b/src/prebid.js index ea7e3fadd8e..f30b063f70e 100644 --- a/src/prebid.js +++ b/src/prebid.js @@ -35,9 +35,6 @@ sessionLoader(); /* Public vars */ $$PREBID_GLOBAL$$.bidderSettings = $$PREBID_GLOBAL$$.bidderSettings || {}; -// current timeout set in `requestBids` or to default `bidderTimeout` -$$PREBID_GLOBAL$$.cbTimeout = $$PREBID_GLOBAL$$.cbTimeout || 200; - // let the world know we are loaded $$PREBID_GLOBAL$$.libLoaded = true; From 38c9fe7724385c268cb27c4cb2c134017806e3e1 Mon Sep 17 00:00:00 2001 From: Jozef Bartek <31618107+jbartek25@users.noreply.github.com> Date: Thu, 30 Aug 2018 19:45:53 +0200 Subject: [PATCH 56/83] Improve Digital adapter: always drop user syncs when available (#3009) * Always drop user syncs when available --- modules/improvedigitalBidAdapter.js | 36 +++-- .../modules/improvedigitalBidAdapter_spec.js | 135 ++++++++++-------- 2 files changed, 100 insertions(+), 71 deletions(-) diff --git a/modules/improvedigitalBidAdapter.js b/modules/improvedigitalBidAdapter.js index c99e496f17c..2cc1d8b39b0 100644 --- a/modules/improvedigitalBidAdapter.js +++ b/modules/improvedigitalBidAdapter.js @@ -1,12 +1,11 @@ import * as utils from 'src/utils'; import { registerBidder } from 'src/adapters/bidderFactory'; import { config } from 'src/config'; -import { userSync } from 'src/userSync'; const BIDDER_CODE = 'improvedigital'; export const spec = { - version: '4.2.0', + version: '4.3.0', code: BIDDER_CODE, aliases: ['id'], @@ -91,15 +90,34 @@ export const spec = { bid.width = bidObject.w; bids.push(bid); - - // Register user sync URLs - if (utils.isArray(bidObject.sync)) { - utils._each(bidObject.sync, function (syncElement) { - userSync.registerSync('image', spec.code, syncElement); - }); - } }); return bids; + }, + + /** + * Register the user sync pixels which should be dropped after the auction. + * + * @param {SyncOptions} syncOptions Which user syncs are allowed? + * @param {ServerResponse[]} serverResponses List of server's responses. + * @return {UserSync[]} The user syncs which should be dropped. + */ + getUserSyncs: function(syncOptions, serverResponses) { + if (syncOptions.pixelEnabled) { + const syncs = []; + serverResponses.forEach(response => { + response.body.bid.forEach(bidObject => { + if (utils.isArray(bidObject.sync)) { + bidObject.sync.forEach(syncElement => { + if (syncs.indexOf(syncElement) === -1) { + syncs.push(syncElement); + } + }); + } + }); + }); + return syncs.map(sync => ({ type: 'image', url: sync })); + } + return []; } }; diff --git a/test/spec/modules/improvedigitalBidAdapter_spec.js b/test/spec/modules/improvedigitalBidAdapter_spec.js index d7595934194..b3e99b3274e 100644 --- a/test/spec/modules/improvedigitalBidAdapter_spec.js +++ b/test/spec/modules/improvedigitalBidAdapter_spec.js @@ -164,61 +164,61 @@ describe('Improve Digital Adapter Tests', function () { }); }); - describe('interpretResponse', () => { - const serverResponse = { - 'body': { - 'id': '687a06c541d8d1', - 'site_id': 191642, - 'bid': [ - { - 'isNet': false, - 'id': '33e9500b21129f', - 'advid': '5279', - 'price': 1.45888594164456, - 'nurl': 'http://ad.360yield.com/imp_pixel?ic=wVmhKI07hCVyGC1sNdFp.6buOSiGYOw8jPyZLlcMY2RCwD4ek3Fy6.xUI7U002skGBs3objMBoNU-Frpvmb9js3NKIG0YZJgWaNdcpXY9gOXE9hY4-wxybCjVSNzhOQB-zic73hzcnJnKeoGgcfvt8fMy18-yD0aVdYWt4zbqdoITOkKNCPBEgbPFu1rcje-o7a64yZ7H3dKvtnIixXQYc1Ep86xGSBGXY6xW2KfUOMT6vnkemxO72divMkMdhR8cAuqIubbx-ZID8-xf5c9k7p6DseeBW0I8ionrlTHx.rGosgxhiFaMqtr7HiA7PBzKvPdeEYN0hQ8RYo8JzYL82hA91A3V2m9Ij6y0DfIJnnrKN8YORffhxmJ6DzwEl1zjrVFbD01bqB3Vdww8w8PQJSkKQkd313tr-atU8LS26fnBmOngEkVHwAr2WCKxuUvxHmuVBTA-Lgz7wKwMoOJCA3hFxMavVb0ZFB7CK0BUTVU6z0De92Q.FJKNCHLMbjX3vcAQ90=', - 'h': 290, - 'pid': 1053688, - 'sync': [ - 'http://link1', - 'http://link2' - ], - 'crid': '422031', - 'w': 600, - 'cid': '99006', - 'adm': 'document.writeln(\"\\\"\\\"\\/<\\/a>\");document.writeln(\"<\\/improvedigital_ad_output_information>\");' - } - ], - 'debug': '' - } - }; - - const serverResponseTwoBids = { - 'body': { - 'id': '687a06c541d8d1', - 'site_id': 191642, - 'bid': [ - serverResponse.body.bid[0], - { - 'isNet': true, - 'id': '1234', - 'advid': '5280', - 'price': 1.23, - 'nurl': 'http://link/imp_pixel?ic=wVmhKI07hCVyGC1sNdFp.6buOSiGYOw8jPyZLlcMY2RCwD4ek3Fy6.xUI7U002skGBs3objMBoNU-Frpvmb9js3NKIG0YZJgWaNdcpXY9gOXE9hY4-wxybCjVSNzhOQB-zic73hzcnJnKeoGgcfvt8fMy18-yD0aVdYWt4zbqdoITOkKNCPBEgbPFu1rcje-o7a64yZ7H3dKvtnIixXQYc1Ep86xGSBGXY6xW2KfUOMT6vnkemxO72divMkMdhR8cAuqIubbx-ZID8-xf5c9k7p6DseeBW0I8ionrlTHx.rGosgxhiFaMqtr7HiA7PBzKvPdeEYN0hQ8RYo8JzYL82hA91A3V2m9Ij6y0DfIJnnrKN8YORffhxmJ6DzwEl1zjrVFbD01bqB3Vdww8w8PQJSkKQkd313tr-atU8LS26fnBmOngEkVHwAr2WCKxuUvxHmuVBTA-Lgz7wKwMoOJCA3hFxMavVb0ZFB7CK0BUTVU6z0De92Q.FJKNCHLMbjX3vcAQ90=', - 'h': 400, - 'pid': 1053688, - 'sync': [ - 'http://link3' - ], - 'crid': '422033', - 'w': 700, - 'cid': '99006', - 'adm': 'document.writeln(\"\\\"\\\"\\/<\\/a>\");document.writeln(\"<\\/improvedigital_ad_output_information>\");' - } - ], - 'debug': '' - } - }; + const serverResponse = { + 'body': { + 'id': '687a06c541d8d1', + 'site_id': 191642, + 'bid': [ + { + 'isNet': false, + 'id': '33e9500b21129f', + 'advid': '5279', + 'price': 1.45888594164456, + 'nurl': 'http://ad.360yield.com/imp_pixel?ic=wVmhKI07hCVyGC1sNdFp.6buOSiGYOw8jPyZLlcMY2RCwD4ek3Fy6.xUI7U002skGBs3objMBoNU-Frpvmb9js3NKIG0YZJgWaNdcpXY9gOXE9hY4-wxybCjVSNzhOQB-zic73hzcnJnKeoGgcfvt8fMy18-yD0aVdYWt4zbqdoITOkKNCPBEgbPFu1rcje-o7a64yZ7H3dKvtnIixXQYc1Ep86xGSBGXY6xW2KfUOMT6vnkemxO72divMkMdhR8cAuqIubbx-ZID8-xf5c9k7p6DseeBW0I8ionrlTHx.rGosgxhiFaMqtr7HiA7PBzKvPdeEYN0hQ8RYo8JzYL82hA91A3V2m9Ij6y0DfIJnnrKN8YORffhxmJ6DzwEl1zjrVFbD01bqB3Vdww8w8PQJSkKQkd313tr-atU8LS26fnBmOngEkVHwAr2WCKxuUvxHmuVBTA-Lgz7wKwMoOJCA3hFxMavVb0ZFB7CK0BUTVU6z0De92Q.FJKNCHLMbjX3vcAQ90=', + 'h': 290, + 'pid': 1053688, + 'sync': [ + 'http://link1', + 'http://link2' + ], + 'crid': '422031', + 'w': 600, + 'cid': '99006', + 'adm': 'document.writeln(\"\\\"\\\"\\/<\\/a>\");document.writeln(\"<\\/improvedigital_ad_output_information>\");' + } + ], + 'debug': '' + } + }; + + const serverResponseTwoBids = { + 'body': { + 'id': '687a06c541d8d1', + 'site_id': 191642, + 'bid': [ + serverResponse.body.bid[0], + { + 'isNet': true, + 'id': '1234', + 'advid': '5280', + 'price': 1.23, + 'nurl': 'http://link/imp_pixel?ic=wVmhKI07hCVyGC1sNdFp.6buOSiGYOw8jPyZLlcMY2RCwD4ek3Fy6.xUI7U002skGBs3objMBoNU-Frpvmb9js3NKIG0YZJgWaNdcpXY9gOXE9hY4-wxybCjVSNzhOQB-zic73hzcnJnKeoGgcfvt8fMy18-yD0aVdYWt4zbqdoITOkKNCPBEgbPFu1rcje-o7a64yZ7H3dKvtnIixXQYc1Ep86xGSBGXY6xW2KfUOMT6vnkemxO72divMkMdhR8cAuqIubbx-ZID8-xf5c9k7p6DseeBW0I8ionrlTHx.rGosgxhiFaMqtr7HiA7PBzKvPdeEYN0hQ8RYo8JzYL82hA91A3V2m9Ij6y0DfIJnnrKN8YORffhxmJ6DzwEl1zjrVFbD01bqB3Vdww8w8PQJSkKQkd313tr-atU8LS26fnBmOngEkVHwAr2WCKxuUvxHmuVBTA-Lgz7wKwMoOJCA3hFxMavVb0ZFB7CK0BUTVU6z0De92Q.FJKNCHLMbjX3vcAQ90=', + 'h': 400, + 'pid': 1053688, + 'sync': [ + 'http://link3' + ], + 'crid': '422033', + 'w': 700, + 'cid': '99006', + 'adm': 'document.writeln(\"\\\"\\\"\\/<\\/a>\");document.writeln(\"<\\/improvedigital_ad_output_information>\");' + } + ], + 'debug': '' + } + }; + describe('interpretResponse', () => { let expectedBid = [ { 'ad': '', @@ -260,14 +260,6 @@ describe('Improve Digital Adapter Tests', function () { expect(bids).to.deep.equal(expectedTwoBids); }); - it('should register user syncs', () => { - const registerSyncSpy = sinon.spy(userSync, 'registerSync'); - const bids = spec.interpretResponse(serverResponse); - expect(registerSyncSpy.withArgs('image', 'improvedigital', 'http://link1').calledOnce).to.equal(true); - expect(registerSyncSpy.withArgs('image', 'improvedigital', 'http://link2').calledOnce).to.equal(true); - registerSyncSpy.restore(); - }); - it('should set dealId correctly', () => { let response = JSON.parse(JSON.stringify(serverResponse)); let bids; @@ -338,4 +330,23 @@ describe('Improve Digital Adapter Tests', function () { expect(bids[0].netRevenue).to.equal(true); }); }); + + describe('getUserSyncs', () => { + const serverResponses = [ serverResponseTwoBids ]; + + it('should return no syncs when pixel syncing is disabled', () => { + const syncs = spec.getUserSyncs({ pixelEnabled: false }, serverResponses); + expect(syncs).to.deep.equal([]); + }); + + it('should return user syncs', () => { + const syncs = spec.getUserSyncs({ pixelEnabled: true }, serverResponses); + const expected = [ + { type: 'image', url: 'http://link1' }, + { type: 'image', url: 'http://link2' }, + { type: 'image', url: 'http://link3' } + ]; + expect(syncs).to.deep.equal(expected); + }); + }); }); From c6927c5846f41b043704e0ee25d48ce00502e69a Mon Sep 17 00:00:00 2001 From: skazedo Date: Thu, 30 Aug 2018 16:38:20 -0400 Subject: [PATCH 57/83] Modified API url (#3030) * initial commit * updated contact and tag details * changes ti support the renderers * changes to pass dimId * fixed names of internal mapping * added comment * added gdpr param to request and other fixes * modified api url --- modules/zedoBidAdapter.js | 8 ++++++-- modules/zedoBidAdapter.md | 2 +- test/spec/modules/zedoBidAdapter_spec.js | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/zedoBidAdapter.js b/modules/zedoBidAdapter.js index 0420c479ae9..d6f75da4ece 100644 --- a/modules/zedoBidAdapter.js +++ b/modules/zedoBidAdapter.js @@ -4,8 +4,8 @@ import { BANNER, VIDEO } from 'src/mediaTypes'; import find from 'core-js/library/fn/array/find'; const BIDDER_CODE = 'zedo'; -const URL = '//z2.zedo.com/asw/fmb.json'; -const SECURE_URL = '//z2.zedo.com/asw/fmb.json'; +const URL = '//z2.zedo.com/asw/fmh.json'; +const SECURE_URL = '//z2.zedo.com/asw/fmh.json'; const DIM_TYPE = { '7': 'display', '9': 'display', @@ -15,6 +15,10 @@ const DIM_TYPE = { '85': 'Inarticle', '86': 'pswipeup', '88': 'Inview', + '100': 'display', + '101': 'display', + '102': 'display', + '103': 'display' // '85': 'pre-mid-post-roll', }; diff --git a/modules/zedoBidAdapter.md b/modules/zedoBidAdapter.md index 9ffcd61f164..6555a1e6506 100644 --- a/modules/zedoBidAdapter.md +++ b/modules/zedoBidAdapter.md @@ -20,7 +20,7 @@ For video integration, ZEDO returns content as vastXML and requires the publishe { bidder: 'zedo', params: { - code: 2264004118 + channelCode: 2264004118 dimId: 9 } } diff --git a/test/spec/modules/zedoBidAdapter_spec.js b/test/spec/modules/zedoBidAdapter_spec.js index 6d0ab7c68f6..d199156cfe4 100644 --- a/test/spec/modules/zedoBidAdapter_spec.js +++ b/test/spec/modules/zedoBidAdapter_spec.js @@ -43,7 +43,7 @@ describe('The ZEDO bidding adapter', () => { }, ]; const request = spec.buildRequests(bidRequests, bidderRequest); - expect(request.url).to.match(/^\/\/z2.zedo.com\/asw\/fmb.json/); + expect(request.url).to.match(/^\/\/z2.zedo.com\/asw\/fmh.json/); expect(request.method).to.equal('GET'); const zedoRequest = request.data; expect(zedoRequest).to.equal('g={"placements":[{"network":20,"channel":0,"width":300,"height":200,"dimension":10,"version":"$prebid.version$","keyword":"","transactionId":"12345667","renderers":[{"name":"display"}]}]}'); @@ -68,7 +68,7 @@ describe('The ZEDO bidding adapter', () => { }, ]; const request = spec.buildRequests(bidRequests, bidderRequest); - expect(request.url).to.match(/^\/\/z2.zedo.com\/asw\/fmb.json/); + expect(request.url).to.match(/^\/\/z2.zedo.com\/asw\/fmh.json/); expect(request.method).to.equal('GET'); const zedoRequest = request.data; expect(zedoRequest).to.equal('g={"placements":[{"network":20,"channel":0,"width":640,"height":480,"dimension":85,"version":"$prebid.version$","keyword":"","transactionId":"12345667","renderers":[{"name":"Inarticle"}]}]}'); From 25e62a0c5be8abd4cacafd6f7e2190574804ac8c Mon Sep 17 00:00:00 2001 From: Oz Weiss Date: Fri, 31 Aug 2018 17:47:49 +0300 Subject: [PATCH 58/83] Replacing all arrow functions in Mocha function calls (#3036) * replace arrow function in describe calls * replace arrow function in it calls * replace arrow function in before, beforeEach, after and afterEach calls * Merge remote-tracking branch 'upstream/master' # Conflicts: # test/spec/modules/improvedigitalBidAdapter_spec.js --- test/mocks/videoCacheStub.js | 4 +- test/spec/AnalyticsAdapter_spec.js | 36 +- test/spec/adloader_spec.js | 10 +- test/spec/auctionmanager_spec.js | 56 +- test/spec/config_spec.js | 46 +- test/spec/cpmBucketManager_spec.js | 18 +- test/spec/debugging_spec.js | 30 +- test/spec/hook_spec.js | 18 +- test/spec/modules/a4gBidAdapter_spec.js | 26 +- test/spec/modules/aardvarkBidAdapter_spec.js | 38 +- test/spec/modules/adbutlerBidAdapter_spec.js | 32 +- test/spec/modules/adformBidAdapter_spec.js | 62 +- .../modules/adgenerationBidAdapter_spec.js | 30 +- .../adkernelAdnAnalyticsAdapter_spec.js | 54 +- .../modules/adkernelAdnBidAdapter_spec.js | 62 +- test/spec/modules/adkernelBidAdapter_spec.js | 66 +- test/spec/modules/admixerBidAdapter_spec.js | 24 +- test/spec/modules/adoceanBidAdapter_spec.js | 28 +- .../modules/adomikAnalyticsAdapter_spec.js | 6 +- test/spec/modules/adspiritBidAdapter_spec.js | 32 +- .../modules/adtelligentBidAdapter_spec.js | 36 +- test/spec/modules/aduptechBidAdapter_spec.js | 46 +- .../modules/adxcgAnalyticsAdapter_spec.js | 14 +- test/spec/modules/adxcgBidAdapter_spec.js | 38 +- test/spec/modules/adyoulikeBidAdapter_spec.js | 40 +- test/spec/modules/ajaBidAdapter_spec.js | 20 +- test/spec/modules/andbeyondBidAdapter_spec.js | 46 +- test/spec/modules/aolBidAdapter_spec.js | 130 ++-- test/spec/modules/appnexusBidAdapter_spec.js | 56 +- test/spec/modules/arteebeeBidAdapter_spec.js | 24 +- test/spec/modules/atomxBidAdapter_spec.js | 20 +- .../modules/audienceNetworkBidAdapter_spec.js | 66 +- .../spec/modules/beachfrontBidAdapter_spec.js | 116 +-- test/spec/modules/betweenBidAdapter_spec.js | 8 +- test/spec/modules/bizzclickBidAdapter_spec.js | 30 +- test/spec/modules/brainyBidAdapter_spec.js | 28 +- .../spec/modules/bridgewellBidAdapter_spec.js | 76 +- test/spec/modules/c1xBidAdapter_spec.js | 32 +- test/spec/modules/ccxBidAdapter_spec.js | 14 +- .../spec/modules/clickforceBidAdapter_spec.js | 30 +- .../modules/colossussspBidAdapter_spec.js | 30 +- test/spec/modules/consentManagement_spec.js | 64 +- .../spec/modules/consumableBidAdapter_spec.js | 42 +- .../modules/contentigniteBidAdapter_spec.js | 28 +- test/spec/modules/coxBidAdapter_spec.js | 44 +- test/spec/modules/criteoBidAdapter_spec.js | 32 +- test/spec/modules/currency_spec.js | 44 +- test/spec/modules/danmarketBidAdapter_spec.js | 34 +- test/spec/modules/dfpAdServerVideo_spec.js | 30 +- test/spec/modules/dgadsBidAdapter_spec.js | 30 +- .../modules/districtmDmxBidAdapter_spec.js | 58 +- test/spec/modules/divreachBidAdapter_spec.js | 24 +- test/spec/modules/ebdrBidAdapter_spec.js | 58 +- .../modules/eplanningAnalyticsAdapter_spec.js | 10 +- test/spec/modules/eplanningBidAdapter_spec.js | 62 +- test/spec/modules/etargetBidAdapter_spec.js | 58 +- test/spec/modules/fairtradeBidAdapter_spec.js | 28 +- test/spec/modules/fidelityBidAdapter_spec.js | 32 +- .../modules/freewheel-sspBidAdapter_spec.js | 394 +++++----- test/spec/modules/fyberBidAdapter_spec.js | 36 +- test/spec/modules/gambidBidAdapter_spec.js | 36 +- test/spec/modules/gammaBidAdapter_spec.js | 20 +- test/spec/modules/getintentBidAdapter_spec.js | 18 +- test/spec/modules/giantsBidAdapter_spec.js | 602 ++++++++-------- test/spec/modules/gjirafaBidAdapter_spec.js | 28 +- test/spec/modules/gumgumBidAdapter_spec.js | 32 +- test/spec/modules/gxoneBidAdapter_spec.js | 28 +- .../modules/huddledmassesBidAdapter_spec.js | 32 +- test/spec/modules/iasBidAdapter_spec.js | 72 +- .../modules/improvedigitalBidAdapter_spec.js | 50 +- test/spec/modules/innityBidAdapter_spec.js | 18 +- test/spec/modules/inskinBidAdapter_spec.js | 46 +- .../interactiveOffersBidAdapter_spec.js | 30 +- test/spec/modules/invibesBidAdapter_spec.js | 50 +- test/spec/modules/iqmBidAdapter_spec.js | 34 +- test/spec/modules/ixBidAdapter_spec.js | 94 +-- test/spec/modules/jcmBidAdapter_spec.js | 30 +- .../modules/justpremiumBidAdapter_spec.js | 24 +- test/spec/modules/kargoBidAdapter_spec.js | 8 +- test/spec/modules/komoonaBidAdapter_spec.js | 12 +- test/spec/modules/kummaBidAdapter_spec.js | 26 +- .../spec/modules/lifestreetBidAdapter_spec.js | 48 +- test/spec/modules/lkqdBidAdapter_spec.js | 30 +- .../spec/modules/lockerdomeBidAdapter_spec.js | 20 +- .../spec/modules/madvertiseBidAdapter_spec.js | 28 +- test/spec/modules/mantisBidAdapter_spec.js | 32 +- test/spec/modules/medianetBidAdapter_spec.js | 60 +- test/spec/modules/mobfoxBidAdapter_spec.js | 20 +- test/spec/modules/my6senseBidAdapter_spec.js | 28 +- .../modules/nanointeractiveBidAdapter_spec.js | 4 +- .../modules/nasmediaAdmixerBidAdapter_spec.js | 22 +- test/spec/modules/oneVideoBidAdapter_spec.js | 34 +- .../modules/oneplanetonlyBidAdapter_spec.js | 26 +- test/spec/modules/onetagBidAdapter_spec.js | 32 +- test/spec/modules/openxBidAdapter_spec.js | 106 +-- test/spec/modules/optimaticBidAdapter_spec.js | 44 +- test/spec/modules/optimeraBidAdapter_spec.js | 18 +- test/spec/modules/orbitsoftBidAdapter_spec.js | 32 +- test/spec/modules/papyrusBidAdapter_spec.js | 24 +- test/spec/modules/peak226BidAdapter_spec.js | 22 +- .../spec/modules/platformioBidAdapter_spec.js | 670 +++++++++--------- .../modules/playgroundxyzBidAdapter_spec.js | 32 +- test/spec/modules/polluxBidAdapter_spec.js | 20 +- test/spec/modules/polymorphBidAdapter_spec.js | 28 +- .../modules/prebidServerBidAdapter_spec.js | 102 +-- test/spec/modules/pubCommonId_spec.js | 6 +- test/spec/modules/pubmaticBidAdapter_spec.js | 44 +- .../modules/pubwiseAnalyticsAdapter_spec.js | 8 +- .../spec/modules/pulsepointBidAdapter_spec.js | 30 +- test/spec/modules/quantcastBidAdapter_spec.js | 42 +- test/spec/modules/quantumBidAdapter_spec.js | 32 +- test/spec/modules/readpeakBidAdapter_spec.js | 28 +- .../modules/realvuAnalyticsAdapter_spec.js | 30 +- test/spec/modules/rhythmoneBidAdapter_spec.js | 2 +- test/spec/modules/rockyouBidAdapter_spec.js | 42 +- .../modules/roxotAnalyticsAdapter_spec.js | 24 +- test/spec/modules/rtbdemandBidAdapter_spec.js | 30 +- .../modules/rtbdemandadkBidAdapter_spec.js | 58 +- test/spec/modules/rtbhouseBidAdapter_spec.js | 30 +- .../modules/rubiconAnalyticsAdapter_spec.js | 44 +- test/spec/modules/rubiconBidAdapter_spec.js | 174 ++--- test/spec/modules/rxrtbBidAdapter_spec.js | 20 +- test/spec/modules/s2sTesting_spec.js | 58 +- test/spec/modules/saraBidAdapter_spec.js | 28 +- test/spec/modules/sekindoUMBidAdapter_spec.js | 30 +- test/spec/modules/serverbidBidAdapter_spec.js | 42 +- .../modules/serverbidServerBidAdapter_spec.js | 32 +- .../modules/sharethroughBidAdapter_spec.js | 50 +- .../modules/sigmoidAnalyticsAdapter_spec.js | 14 +- .../modules/smartadserverBidAdapter_spec.js | 22 +- test/spec/modules/smartyadsBidAdapter_spec.js | 40 +- .../modules/somoaudienceBidAdapter_spec.js | 64 +- test/spec/modules/sonobiBidAdapter_spec.js | 64 +- test/spec/modules/sortableBidAdapter_spec.js | 46 +- test/spec/modules/sovrnBidAdapter_spec.js | 32 +- test/spec/modules/telariaBidAdapter_spec.js | 42 +- test/spec/modules/trionBidAdapter_spec.js | 54 +- .../spec/modules/tripleliftBidAdapter_spec.js | 30 +- test/spec/modules/trustxBidAdapter_spec.js | 34 +- test/spec/modules/ucfunnelBidAdapter_spec.js | 38 +- .../modules/underdogmediaBidAdapter_spec.js | 40 +- test/spec/modules/undertoneBidAdapter_spec.js | 24 +- test/spec/modules/unrulyBidAdapter_spec.js | 46 +- test/spec/modules/uolBidAdapter_spec.js | 50 +- .../spec/modules/vertamediaBidAdapter_spec.js | 34 +- test/spec/modules/vertozBidAdapter_spec.js | 22 +- test/spec/modules/viBidAdapter_spec.js | 24 +- test/spec/modules/vidazooBidAdapter_spec.js | 42 +- test/spec/modules/visxBidAdapter_spec.js | 40 +- .../modules/vubleAnalyticsAdapter_spec.js | 8 +- test/spec/modules/vubleBidAdapter_spec.js | 50 +- test/spec/modules/weboramaBidAdapter_spec.js | 30 +- test/spec/modules/widespaceBidAdapter_spec.js | 36 +- test/spec/modules/xendizBidAdapter_spec.js | 30 +- test/spec/modules/xhbBidAdapter_spec.js | 54 +- test/spec/modules/yieldlabBidAdapter_spec.js | 30 +- test/spec/modules/yieldmoBidAdapter_spec.js | 30 +- test/spec/modules/yieldoneBidAdapter_spec.js | 20 +- .../yuktamediaAnalyticsAdaptor_spec.js | 14 +- test/spec/modules/zedoBidAdapter_spec.js | 34 +- test/spec/native_spec.js | 20 +- test/spec/renderer_spec.js | 22 +- test/spec/sizeMapping_spec.js | 26 +- test/spec/unit/adServerManager_spec.js | 8 +- test/spec/unit/core/adapterManager_spec.js | 120 ++-- test/spec/unit/core/bidderFactory_spec.js | 90 +-- test/spec/unit/core/targeting_spec.js | 40 +- test/spec/unit/pbjs_api_spec.js | 220 +++--- test/spec/url_spec.js | 38 +- test/spec/userSync_spec.js | 48 +- test/spec/utils_spec.js | 44 +- test/spec/videoCache_spec.js | 38 +- test/spec/video_spec.js | 12 +- 173 files changed, 4110 insertions(+), 4096 deletions(-) diff --git a/test/mocks/videoCacheStub.js b/test/mocks/videoCacheStub.js index 4a1d8bca343..39f5d67b6a9 100644 --- a/test/mocks/videoCacheStub.js +++ b/test/mocks/videoCacheStub.js @@ -12,7 +12,7 @@ import * as videoCache from 'src/videoCache'; export default function useVideoCacheStub(responses) { let storeStub; - beforeEach(() => { + beforeEach(function () { storeStub = sinon.stub(videoCache, 'store'); if (responses.store instanceof Error) { @@ -22,7 +22,7 @@ export default function useVideoCacheStub(responses) { } }); - afterEach(() => { + afterEach(function () { videoCache.store.restore(); }); diff --git a/test/spec/AnalyticsAdapter_spec.js b/test/spec/AnalyticsAdapter_spec.js index c6c50f76ecd..39096c0c4a3 100644 --- a/test/spec/AnalyticsAdapter_spec.js +++ b/test/spec/AnalyticsAdapter_spec.js @@ -22,19 +22,19 @@ FEATURE: Analytics Adapters API let requests; let adapter; - beforeEach(() => { + beforeEach(function () { xhr = sinon.useFakeXMLHttpRequest(); requests = []; xhr.onCreate = (request) => requests.push(request); adapter = new AnalyticsAdapter(config); }); - afterEach(() => { + afterEach(function () { xhr.restore(); adapter.disableAnalytics(); }); - it(`SHOULD call the endpoint WHEN an event occurs that is to be tracked`, () => { + it(`SHOULD call the endpoint WHEN an event occurs that is to be tracked`, function () { const eventType = BID_REQUESTED; const args = { some: 'data' }; @@ -44,7 +44,7 @@ FEATURE: Analytics Adapters API expect(result).to.deep.equal({args: {some: 'data'}, eventType: 'bidRequested'}); }); - it(`SHOULD queue the event first and then track it WHEN an event occurs before tracking library is available`, () => { + it(`SHOULD queue the event first and then track it WHEN an event occurs before tracking library is available`, function () { const eventType = BID_RESPONSE; const args = { wat: 'wot' }; @@ -55,16 +55,16 @@ FEATURE: Analytics Adapters API expect(result).to.deep.equal({args: {wat: 'wot'}, eventType: 'bidResponse'}); }); - describe(`WHEN an event occurs after enable analytics\n`, () => { - beforeEach(() => { + describe(`WHEN an event occurs after enable analytics\n`, function () { + beforeEach(function () { sinon.stub(events, 'getEvents').returns([]); // these tests shouldn't be affected by previous tests }); - afterEach(() => { + afterEach(function () { events.getEvents.restore(); }); - it('SHOULD call global when a bidWon event occurs', () => { + it('SHOULD call global when a bidWon event occurs', function () { const eventType = BID_WON; const args = { more: 'info' }; @@ -75,7 +75,7 @@ FEATURE: Analytics Adapters API expect(result).to.deep.equal({args: {more: 'info'}, eventType: 'bidWon'}); }); - it('SHOULD call global when a adRenderFailed event occurs', () => { + it('SHOULD call global when a adRenderFailed event occurs', function () { const eventType = AD_RENDER_FAILED; const args = { call: 'adRenderFailed' }; @@ -86,7 +86,7 @@ FEATURE: Analytics Adapters API expect(result).to.deep.equal({args: {call: 'adRenderFailed'}, eventType: 'adRenderFailed'}); }); - it('SHOULD call global when a bidRequest event occurs', () => { + it('SHOULD call global when a bidRequest event occurs', function () { const eventType = BID_REQUESTED; const args = { call: 'request' }; @@ -97,7 +97,7 @@ FEATURE: Analytics Adapters API expect(result).to.deep.equal({args: {call: 'request'}, eventType: 'bidRequested'}); }); - it('SHOULD call global when a bidResponse event occurs', () => { + it('SHOULD call global when a bidResponse event occurs', function () { const eventType = BID_RESPONSE; const args = { call: 'response' }; @@ -108,7 +108,7 @@ FEATURE: Analytics Adapters API expect(result).to.deep.equal({args: {call: 'response'}, eventType: 'bidResponse'}); }); - it('SHOULD call global when a bidTimeout event occurs', () => { + it('SHOULD call global when a bidTimeout event occurs', function () { const eventType = BID_TIMEOUT; const args = { call: 'timeout' }; @@ -119,7 +119,7 @@ FEATURE: Analytics Adapters API expect(result).to.deep.equal({args: {call: 'timeout'}, eventType: 'bidTimeout'}); }); - it('SHOULD NOT call global again when adapter.enableAnalytics is called with previous timeout', () => { + it('SHOULD NOT call global again when adapter.enableAnalytics is called with previous timeout', function () { const eventType = BID_TIMEOUT; const args = { call: 'timeout' }; @@ -130,19 +130,19 @@ FEATURE: Analytics Adapters API expect(requests.length).to.equal(1); }); - describe(`AND sampling is enabled\n`, () => { + describe(`AND sampling is enabled\n`, function () { const eventType = BID_WON; const args = { more: 'info' }; - beforeEach(() => { + beforeEach(function () { sinon.stub(Math, 'random').returns(0.5); }); - afterEach(() => { + afterEach(function () { Math.random.restore(); }); - it(`THEN should enable analytics when random number is in sample range`, () => { + it(`THEN should enable analytics when random number is in sample range`, function () { adapter.enableAnalytics({ options: { sampling: 0.75 @@ -155,7 +155,7 @@ FEATURE: Analytics Adapters API expect(result).to.deep.equal({args: {more: 'info'}, eventType: 'bidWon'}); }); - it(`THEN should disable analytics when random number is outside sample range`, () => { + it(`THEN should disable analytics when random number is outside sample range`, function () { adapter.enableAnalytics({ options: { sampling: 0.25 diff --git a/test/spec/adloader_spec.js b/test/spec/adloader_spec.js index 55224cb0aab..5c4eff31028 100644 --- a/test/spec/adloader_spec.js +++ b/test/spec/adloader_spec.js @@ -5,24 +5,24 @@ describe('adLoader', function () { let utilsinsertElementStub; let utilsLogErrorStub; - beforeEach(() => { + beforeEach(function () { utilsinsertElementStub = sinon.stub(utils, 'insertElement'); utilsLogErrorStub = sinon.stub(utils, 'logError'); }); - afterEach(() => { + afterEach(function () { utilsinsertElementStub.restore(); utilsLogErrorStub.restore(); }); - describe('loadExternalScript', () => { - it('requires moduleCode to be included on the request', () => { + describe('loadExternalScript', function () { + it('requires moduleCode to be included on the request', function () { adLoader.loadExternalScript('someURL'); expect(utilsLogErrorStub.called).to.be.true; expect(utilsinsertElementStub.called).to.be.false; }); - it('only allows whitelisted vendors to load scripts', () => { + it('only allows whitelisted vendors to load scripts', function () { adLoader.loadExternalScript('someURL', 'criteo'); expect(utilsLogErrorStub.called).to.be.false; expect(utilsinsertElementStub.called).to.be.true; diff --git a/test/spec/auctionmanager_spec.js b/test/spec/auctionmanager_spec.js index 6fbc48b3cdc..0562479ca24 100644 --- a/test/spec/auctionmanager_spec.js +++ b/test/spec/auctionmanager_spec.js @@ -109,11 +109,11 @@ function mockAjaxBuilder() { describe('auctionmanager.js', function () { let xhr; - before(() => { + before(function () { xhr = sinon.useFakeXMLHttpRequest(); }); - after(() => { + after(function () { xhr.restore(); }); @@ -483,8 +483,8 @@ describe('auctionmanager.js', function () { }); }); - describe('adjustBids', () => { - it('should adjust bids if greater than zero and pass copy of bid object', () => { + describe('adjustBids', function () { + it('should adjust bids if greater than zero and pass copy of bid object', function () { const bid = Object.assign({}, bidfactory.createBid(2), fixtures.getBidResponses()[5] @@ -532,7 +532,7 @@ describe('auctionmanager.js', function () { }); }); - describe('addBidResponse', () => { + describe('addBidResponse', function () { let createAuctionStub; let adUnits; let adUnitCodes; @@ -542,23 +542,23 @@ describe('auctionmanager.js', function () { let bids = TEST_BIDS; let makeRequestsStub; - before(() => { + before(function () { makeRequestsStub = sinon.stub(adaptermanager, 'makeBidRequests'); ajaxStub = sinon.stub(ajaxLib, 'ajaxBuilder').callsFake(mockAjaxBuilder); }); - after(() => { + after(function () { ajaxStub.restore(); adaptermanager.makeBidRequests.restore(); }); - describe('when auction timeout is 3000', () => { + describe('when auction timeout is 3000', function () { let loadScriptStub; - before(() => { + before(function () { makeRequestsStub.returns(TEST_BID_REQS); }); - beforeEach(() => { + beforeEach(function () { adUnits = [{ code: ADUNIT_CODE, bids: [ @@ -578,7 +578,7 @@ describe('auctionmanager.js', function () { registerBidder(spec); }); - afterEach(() => { + afterEach(function () { auctionModule.newAuction.restore(); loadScriptStub.restore(); }); @@ -605,7 +605,7 @@ describe('auctionmanager.js', function () { it('should return proper price bucket increments for dense mode when cpm is 20+', checkPbDg('73.07', '20.00', '20+ caps at 20.00')); - it('should place dealIds in adserver targeting', () => { + it('should place dealIds in adserver targeting', function () { bids[0].dealId = 'test deal'; auction.callBids(); @@ -613,7 +613,7 @@ describe('auctionmanager.js', function () { assert.equal(registeredBid.adserverTargeting[`hb_deal`], 'test deal', 'dealId placed in adserverTargeting'); }); - it('should pass through default adserverTargeting sent from adapter', () => { + it('should pass through default adserverTargeting sent from adapter', function () { bids[0].adserverTargeting = {}; bids[0].adserverTargeting.extra = 'stuff'; auction.callBids(); @@ -623,7 +623,7 @@ describe('auctionmanager.js', function () { assert.equal(registeredBid.adserverTargeting.extra, 'stuff'); }); - it('installs publisher-defined renderers on bids', () => { + it('installs publisher-defined renderers on bids', function () { let renderer = { url: 'renderer.js', render: (bid) => bid @@ -675,19 +675,19 @@ describe('auctionmanager.js', function () { }); }); - describe('when auction timeout is 20', () => { + describe('when auction timeout is 20', function () { let loadScriptStub; let eventsEmitSpy; let getBidderRequestStub; - before(() => { + before(function () { bids = [mockBid(), mockBid({ bidderCode: BIDDER_CODE1 })]; let bidRequests = bids.map(bid => mockBidRequest(bid)); makeRequestsStub.returns(bidRequests); }); - beforeEach(() => { + beforeEach(function () { adUnits = [{ code: ADUNIT_CODE, bids: [ @@ -723,20 +723,20 @@ describe('auctionmanager.js', function () { return req; }); }); - afterEach(() => { + afterEach(function () { auctionModule.newAuction.restore(); loadScriptStub.restore(); events.emit.restore(); getBidderRequestStub.restore(); }); - it('should emit BID_TIMEOUT for timed out bids', () => { + it('should emit BID_TIMEOUT for timed out bids', function () { auction.callBids(); assert.ok(eventsEmitSpy.calledWith(CONSTANTS.EVENTS.BID_TIMEOUT), 'emitted events BID_TIMEOUT'); }); }); }); - describe('addBidResponse', () => { + describe('addBidResponse', function () { let createAuctionStub; let adUnits; let adUnitCodes; @@ -748,7 +748,7 @@ describe('auctionmanager.js', function () { let bids = TEST_BIDS; let bids1 = [mockBid({ bidderCode: BIDDER_CODE1 })]; - before(() => { + before(function () { let bidRequests = [ mockBidRequest(bids[0]), mockBidRequest(bids1[0], { adUnitCode: ADUNIT_CODE1 }) @@ -759,12 +759,12 @@ describe('auctionmanager.js', function () { ajaxStub = sinon.stub(ajaxLib, 'ajaxBuilder').callsFake(mockAjaxBuilder); }); - after(() => { + after(function () { ajaxStub.restore(); adaptermanager.makeBidRequests.restore(); }); - beforeEach(() => { + beforeEach(function () { adUnits = [{ code: ADUNIT_CODE, bids: [ @@ -788,11 +788,11 @@ describe('auctionmanager.js', function () { registerBidder(spec1); }); - afterEach(() => { + afterEach(function () { auctionModule.newAuction.restore(); }); - it('should not alter bid adID', () => { + it('should not alter bid adID', function () { auction.callBids(); const addedBid2 = auction.getBidsReceived().pop(); @@ -801,7 +801,7 @@ describe('auctionmanager.js', function () { assert.equal(addedBid1.adId, bids[0].requestId); }); - it('should not add banner bids that have no width or height', () => { + it('should not add banner bids that have no width or height', function () { bids1[0].width = undefined; bids1[0].height = undefined; @@ -813,7 +813,7 @@ describe('auctionmanager.js', function () { assert.equal(length, 1); }); - it('should run auction after video bids have been cached', () => { + it('should run auction after video bids have been cached', function () { sinon.stub(store, 'store').callsArgWith(1, null, [{ uuid: 123 }]); sinon.stub(config, 'getConfig').withArgs('cache.url').returns('cache-url'); @@ -832,7 +832,7 @@ describe('auctionmanager.js', function () { store.store.restore(); }); - it('runs auction after video responses with multiple bid objects have been cached', () => { + it('runs auction after video responses with multiple bid objects have been cached', function () { sinon.stub(store, 'store').callsArgWith(1, null, [{ uuid: 123 }]); sinon.stub(config, 'getConfig').withArgs('cache.url').returns('cache-url'); diff --git a/test/spec/config_spec.js b/test/spec/config_spec.js index 6b26d7da76a..196e167420a 100644 --- a/test/spec/config_spec.js +++ b/test/spec/config_spec.js @@ -8,10 +8,10 @@ let getConfig; let setConfig; let setDefaults; -describe('config API', () => { +describe('config API', function () { let logErrorSpy; let logWarnSpy; - beforeEach(() => { + beforeEach(function () { const config = newConfig(); getConfig = config.getConfig; setConfig = config.setConfig; @@ -20,30 +20,30 @@ describe('config API', () => { logWarnSpy = sinon.spy(utils, 'logWarn'); }); - afterEach(() => { + afterEach(function () { utils.logError.restore(); utils.logWarn.restore(); }); - it('setConfig is a function', () => { + it('setConfig is a function', function () { expect(setConfig).to.be.a('function'); }); - it('getConfig returns an object', () => { + it('getConfig returns an object', function () { expect(getConfig()).to.be.a('object'); }); - it('sets and gets arbitrary configuarion properties', () => { + it('sets and gets arbitrary configuarion properties', function () { setConfig({ baz: 'qux' }); expect(getConfig('baz')).to.equal('qux'); }); - it('only accepts objects', () => { + it('only accepts objects', function () { setConfig('invalid'); expect(getConfig('0')).to.not.equal('i'); }); - it('sets multiple config properties', () => { + it('sets multiple config properties', function () { setConfig({ foo: 'bar' }); setConfig({ biz: 'buz' }); var config = getConfig(); @@ -51,28 +51,28 @@ describe('config API', () => { expect(config.biz).to.equal('buz'); }); - it('overwrites existing config properties', () => { + it('overwrites existing config properties', function () { setConfig({ foo: {biz: 'buz'} }); setConfig({ foo: {baz: 'qux'} }); expect(getConfig('foo')).to.eql({baz: 'qux'}); }); - it('sets debugging', () => { + it('sets debugging', function () { setConfig({ debug: true }); expect(getConfig('debug')).to.be.true; }); - it('sets bidderTimeout', () => { + it('sets bidderTimeout', function () { setConfig({ bidderTimeout: 1000 }); expect(getConfig('bidderTimeout')).to.be.equal(1000); }); - it('gets user-defined publisherDomain', () => { + it('gets user-defined publisherDomain', function () { setConfig({ publisherDomain: 'fc.kahuna' }); expect(getConfig('publisherDomain')).to.equal('fc.kahuna'); }); - it('gets default userSync config', () => { + it('gets default userSync config', function () { const DEFAULT_USERSYNC = { syncEnabled: true, pixelEnabled: true, @@ -83,7 +83,7 @@ describe('config API', () => { expect(getConfig('userSync')).to.eql(DEFAULT_USERSYNC); }); - it('has subscribe functionality for adding listeners to config updates', () => { + it('has subscribe functionality for adding listeners to config updates', function () { const listener = sinon.spy(); getConfig(listener); @@ -94,7 +94,7 @@ describe('config API', () => { sinon.assert.calledWith(listener, { foo: 'bar' }); }); - it('subscribers can unsubscribe', () => { + it('subscribers can unsubscribe', function () { const listener = sinon.spy(); const unsubscribe = getConfig(listener); @@ -106,7 +106,7 @@ describe('config API', () => { sinon.assert.notCalled(listener); }); - it('subscribers can subscribe to topics', () => { + it('subscribers can subscribe to topics', function () { const listener = sinon.spy(); getConfig('logging', listener); @@ -117,7 +117,7 @@ describe('config API', () => { sinon.assert.calledWithExactly(listener, { logging: true }); }); - it('topic subscribers are only called when that topic is changed', () => { + it('topic subscribers are only called when that topic is changed', function () { const listener = sinon.spy(); const wildcard = sinon.spy(); @@ -130,12 +130,12 @@ describe('config API', () => { sinon.assert.calledOnce(wildcard); }); - it('sets priceGranularity', () => { + it('sets priceGranularity', function () { setConfig({ priceGranularity: 'low' }); expect(getConfig('priceGranularity')).to.be.equal('low'); }); - it('set mediaTypePriceGranularity', () => { + it('set mediaTypePriceGranularity', function () { const customPriceGranularity = { 'buckets': [{ 'min': 0, @@ -158,7 +158,7 @@ describe('config API', () => { expect(configResult.native).to.be.equal('medium'); }); - it('sets priceGranularity and customPriceBucket', () => { + it('sets priceGranularity and customPriceBucket', function () { const goodConfig = { 'buckets': [{ 'min': 0, @@ -172,18 +172,18 @@ describe('config API', () => { expect(getConfig('customPriceBucket')).to.equal(goodConfig); }); - it('should log error for invalid priceGranularity', () => { + it('should log error for invalid priceGranularity', function () { setConfig({ priceGranularity: '' }); const error = 'Prebid Error: no value passed to `setPriceGranularity()`'; assert.ok(logErrorSpy.calledWith(error), 'expected error was logged'); }); - it('should log a warning on invalid values', () => { + it('should log a warning on invalid values', function () { setConfig({ bidderSequence: 'unrecognized sequence' }); expect(logWarnSpy.calledOnce).to.equal(true); }); - it('should not log warnings when given recognized values', () => { + it('should not log warnings when given recognized values', function () { setConfig({ bidderSequence: 'fixed' }); setConfig({ bidderSequence: 'random' }); expect(logWarnSpy.called).to.equal(false); diff --git a/test/spec/cpmBucketManager_spec.js b/test/spec/cpmBucketManager_spec.js index 55fae3bb869..88e04be9ad6 100644 --- a/test/spec/cpmBucketManager_spec.js +++ b/test/spec/cpmBucketManager_spec.js @@ -2,8 +2,8 @@ import { expect } from 'chai'; import {getPriceBucketString, isValidPriceConfig} from 'src/cpmBucketManager'; let cpmFixtures = require('test/fixtures/cpmInputsOutputs.json'); -describe('cpmBucketManager', () => { - it('getPriceBucketString function generates the correct price strings', () => { +describe('cpmBucketManager', function () { + it('getPriceBucketString function generates the correct price strings', function () { let input = cpmFixtures.cpmInputs; for (let i = 0; i < input.length; i++) { let output = getPriceBucketString(input[i]); @@ -12,7 +12,7 @@ describe('cpmBucketManager', () => { } }); - it('gets the correct custom bucket strings', () => { + it('gets the correct custom bucket strings', function () { let cpm = 16.50908; let customConfig = { 'buckets': [{ @@ -35,7 +35,7 @@ describe('cpmBucketManager', () => { expect(JSON.stringify(output)).to.deep.equal(expected); }); - it('gets the correct custom bucket strings with irregular increment', () => { + it('gets the correct custom bucket strings with irregular increment', function () { let cpm = 14.50908; let customConfig = { 'buckets': [{ @@ -58,7 +58,7 @@ describe('cpmBucketManager', () => { expect(JSON.stringify(output)).to.deep.equal(expected); }); - it('gets the correct custom bucket strings in non-USD currency', () => { + it('gets the correct custom bucket strings in non-USD currency', function () { let cpm = 16.50908 * 110.49; let customConfig = { 'buckets': [{ @@ -81,7 +81,7 @@ describe('cpmBucketManager', () => { expect(JSON.stringify(output)).to.deep.equal(expected); }); - it('gets the correct custom bucket strings with specific cpms that round oddly with certain increments', () => { + it('gets the correct custom bucket strings with specific cpms that round oddly with certain increments', function () { let customConfig = { 'buckets': [{ 'precision': 4, @@ -155,7 +155,7 @@ describe('cpmBucketManager', () => { expect(JSON.stringify(output)).to.deep.equal(expected); }); - it('gets custom bucket strings and it should honor 0', () => { + it('gets custom bucket strings and it should honor 0', function () { let cpm = 16.50908; let customConfig = { 'buckets': [ @@ -172,7 +172,7 @@ describe('cpmBucketManager', () => { expect(JSON.stringify(output)).to.deep.equal(expected); }); - it('gets the custom bucket strings without passing precision and it should honor the default precision', () => { + it('gets the custom bucket strings without passing precision and it should honor the default precision', function () { let cpm = 16.50908; let customConfig = { 'buckets': [ @@ -188,7 +188,7 @@ describe('cpmBucketManager', () => { expect(JSON.stringify(output)).to.deep.equal(expected); }); - it('checks whether custom config is valid', () => { + it('checks whether custom config is valid', function () { let badConfig = { 'buckets': [{ 'min': 0, diff --git a/test/spec/debugging_spec.js b/test/spec/debugging_spec.js index 286df26f7ba..b048382171b 100644 --- a/test/spec/debugging_spec.js +++ b/test/spec/debugging_spec.js @@ -4,28 +4,28 @@ import { sessionLoader, addBidResponseHook, getConfig, disableOverrides, boundHo import { addBidResponse } from 'src/auction'; import { config } from 'src/config'; -describe('bid overrides', () => { +describe('bid overrides', function () { let sandbox; - beforeEach(() => { + beforeEach(function () { sandbox = sinon.sandbox.create(); }); - afterEach(() => { + afterEach(function () { window.sessionStorage.clear(); sandbox.restore(); }); - describe('initialization', () => { - beforeEach(() => { + describe('initialization', function () { + beforeEach(function () { sandbox.stub(config, 'setConfig'); }); - afterEach(() => { + afterEach(function () { disableOverrides(); }); - it('should happen when enabled with setConfig', () => { + it('should happen when enabled with setConfig', function () { getConfig({ enabled: true }); @@ -33,14 +33,14 @@ describe('bid overrides', () => { expect(addBidResponse.hasHook(boundHook)).to.equal(true); }); - it('should happen when configuration found in sessionStorage', () => { + it('should happen when configuration found in sessionStorage', function () { sessionLoader({ getItem: () => ('{"enabled": true}') }); expect(addBidResponse.hasHook(boundHook)).to.equal(true); }); - it('should not throw if sessionStorage is inaccessible', () => { + it('should not throw if sessionStorage is inaccessible', function () { expect(() => { sessionLoader({ getItem() { @@ -51,11 +51,11 @@ describe('bid overrides', () => { }); }); - describe('hook', () => { + describe('hook', function () { let mockBids; let bids; - beforeEach(() => { + beforeEach(function () { let baseBid = { 'bidderCode': 'rubicon', 'width': 970, @@ -86,7 +86,7 @@ describe('bid overrides', () => { }); } - it('should allow us to exclude bidders', () => { + it('should allow us to exclude bidders', function () { run({ enabled: true, bidders: ['appnexus'] @@ -96,7 +96,7 @@ describe('bid overrides', () => { expect(bids[0].bidderCode).to.equal('appnexus'); }); - it('should allow us to override all bids', () => { + it('should allow us to override all bids', function () { run({ enabled: true, bids: [{ @@ -109,7 +109,7 @@ describe('bid overrides', () => { expect(bids[1].cpm).to.equal(2); }); - it('should allow us to override bids by bidder', () => { + it('should allow us to override bids by bidder', function () { run({ enabled: true, bids: [{ @@ -123,7 +123,7 @@ describe('bid overrides', () => { expect(bids[1].cpm).to.equal(0.5); }); - it('should allow us to override bids by adUnitCode', () => { + it('should allow us to override bids by adUnitCode', function () { mockBids[1].adUnitCode = 'test'; run({ diff --git a/test/spec/hook_spec.js b/test/spec/hook_spec.js index 1fab4ecd1b7..7536f8316d5 100644 --- a/test/spec/hook_spec.js +++ b/test/spec/hook_spec.js @@ -2,18 +2,18 @@ import { expect } from 'chai'; import { createHook, hooks } from 'src/hook'; -describe('the hook module', () => { +describe('the hook module', function () { let sandbox; - beforeEach(() => { + beforeEach(function () { sandbox = sinon.sandbox.create(); }); - afterEach(() => { + afterEach(function () { sandbox.restore(); }); - it('should call all sync hooks attached to a function', () => { + it('should call all sync hooks attached to a function', function () { let called = []; let calledWith; @@ -63,7 +63,7 @@ describe('the hook module', () => { ]); }); - it('should allow context to be passed to hooks, but keep bound contexts', () => { + it('should allow context to be passed to hooks, but keep bound contexts', function () { let context; let fn = function() { context = this; @@ -85,8 +85,8 @@ describe('the hook module', () => { expect(calledBoundContext).to.equal(boundContext); }); - describe('asyncSeries', () => { - it('should call function as normal if no hooks attached', () => { + describe('asyncSeries', function () { + it('should call function as normal if no hooks attached', function () { let fn = sandbox.spy(); let hookFn = createHook('asyncSeries', fn); @@ -96,7 +96,7 @@ describe('the hook module', () => { expect(fn.firstCall.args[0]).to.equal(1); }); - it('should call hooks correctly applied in asyncSeries', () => { + it('should call hooks correctly applied in asyncSeries', function () { let called = []; let testFn = (called) => { @@ -124,7 +124,7 @@ describe('the hook module', () => { ]); }); - it('should allow context to be passed to hooks, but keep bound contexts', () => { + it('should allow context to be passed to hooks, but keep bound contexts', function () { let context; let fn = function() { context = this; diff --git a/test/spec/modules/a4gBidAdapter_spec.js b/test/spec/modules/a4gBidAdapter_spec.js index 84346a1149f..4c7520d3b0c 100644 --- a/test/spec/modules/a4gBidAdapter_spec.js +++ b/test/spec/modules/a4gBidAdapter_spec.js @@ -1,9 +1,9 @@ import { expect } from 'chai'; import { spec } from 'modules/a4gBidAdapter'; -describe('a4gAdapterTests', () => { - describe('bidRequestValidity', () => { - it('bidRequest with zoneId and deliveryUrl params', () => { +describe('a4gAdapterTests', function () { + describe('bidRequestValidity', function () { + it('bidRequest with zoneId and deliveryUrl params', function () { expect(spec.isBidRequestValid({ bidder: 'a4g', params: { @@ -13,7 +13,7 @@ describe('a4gAdapterTests', () => { })).to.equal(true); }); - it('bidRequest with only zoneId', () => { + it('bidRequest with only zoneId', function () { expect(spec.isBidRequestValid({ bidder: 'a4g', params: { @@ -22,7 +22,7 @@ describe('a4gAdapterTests', () => { })).to.equal(true); }); - it('bidRequest with only deliveryUrl', () => { + it('bidRequest with only deliveryUrl', function () { expect(spec.isBidRequestValid({ bidder: 'a4g', params: { @@ -32,7 +32,7 @@ describe('a4gAdapterTests', () => { }); }); - describe('bidRequest', () => { + describe('bidRequest', function () { const bidRequests = [{ 'bidder': 'a4g', 'bidId': '51ef8751f9aead', @@ -58,27 +58,27 @@ describe('a4gAdapterTests', () => { 'auctionId': '18fd8b8b0bd757' }]; - it('bidRequest method', () => { + it('bidRequest method', function () { const request = spec.buildRequests(bidRequests); expect(request.method).to.equal('GET'); }); - it('bidRequest url', () => { + it('bidRequest url', function () { const request = spec.buildRequests(bidRequests); expect(request.url).to.match(new RegExp(`${bidRequests[1].params.deliveryUrl}`)); }); - it('bidRequest data', () => { + it('bidRequest data', function () { const request = spec.buildRequests(bidRequests); expect(request.data).to.exists; }); - it('bidRequest zoneIds', () => { + it('bidRequest zoneIds', function () { const request = spec.buildRequests(bidRequests); expect(request.data.zoneId).to.equal('59304;59354'); }); - it('bidRequest gdpr consent', () => { + it('bidRequest gdpr consent', function () { const consentString = 'consentString'; const bidderRequest = { bidderCode: 'a4g', @@ -99,7 +99,7 @@ describe('a4gAdapterTests', () => { }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { const bidRequest = [{ 'bidder': 'a4g', 'bidId': '51ef8751f9aead', @@ -124,7 +124,7 @@ describe('a4gAdapterTests', () => { headers: {} }; - it('required keys', () => { + it('required keys', function () { const result = spec.interpretResponse(bidResponse, bidRequest); let requiredKeys = [ diff --git a/test/spec/modules/aardvarkBidAdapter_spec.js b/test/spec/modules/aardvarkBidAdapter_spec.js index 6d4649ea107..628f19f8fd2 100644 --- a/test/spec/modules/aardvarkBidAdapter_spec.js +++ b/test/spec/modules/aardvarkBidAdapter_spec.js @@ -1,9 +1,9 @@ import { expect } from 'chai'; import { spec } from 'modules/aardvarkBidAdapter'; -describe('aardvarkAdapterTest', () => { - describe('forming valid bidRequests', () => { - it('should accept valid bidRequests', () => { +describe('aardvarkAdapterTest', function () { + describe('forming valid bidRequests', function () { + it('should accept valid bidRequests', function () { expect(spec.isBidRequestValid({ bidder: 'aardvark', params: { @@ -14,7 +14,7 @@ describe('aardvarkAdapterTest', () => { })).to.equal(true); }); - it('should reject invalid bidRequests', () => { + it('should reject invalid bidRequests', function () { expect(spec.isBidRequestValid({ bidder: 'aardvark', params: { @@ -25,7 +25,7 @@ describe('aardvarkAdapterTest', () => { }); }); - describe('executing network requests', () => { + describe('executing network requests', function () { const bidRequests = [{ bidder: 'aardvark', params: { @@ -54,20 +54,20 @@ describe('aardvarkAdapterTest', () => { auctionId: 'e97cafd0-ebfc-4f5c-b7c9-baa0fd335a4a' }]; - it('should use HTTP GET method', () => { + it('should use HTTP GET method', function () { const requests = spec.buildRequests(bidRequests); requests.forEach(function(requestItem) { expect(requestItem.method).to.equal('GET'); }); }); - it('should call the correct bidRequest url', () => { + it('should call the correct bidRequest url', function () { const requests = spec.buildRequests(bidRequests); expect(requests.length).to.equal(1); expect(requests[0].url).to.match(new RegExp('^\/\/adzone.pub.com/xiby/TdAx_RAZd/aardvark\?')); }); - it('should have correct data', () => { + it('should have correct data', function () { const requests = spec.buildRequests(bidRequests); expect(requests.length).to.equal(1); expect(requests[0].data.version).to.equal(1); @@ -78,7 +78,7 @@ describe('aardvarkAdapterTest', () => { }); }); - describe('splitting multi-auction ad units into own requests', () => { + describe('splitting multi-auction ad units into own requests', function () { const bidRequests = [{ bidder: 'aardvark', params: { @@ -108,21 +108,21 @@ describe('aardvarkAdapterTest', () => { auctionId: 'e97cafd0-ebfc-4f5c-b7c9-baa0fd335a4a' }]; - it('should use HTTP GET method', () => { + it('should use HTTP GET method', function () { const requests = spec.buildRequests(bidRequests); requests.forEach(function(requestItem) { expect(requestItem.method).to.equal('GET'); }); }); - it('should call the correct bidRequest urls for each auction', () => { + it('should call the correct bidRequest urls for each auction', function () { const requests = spec.buildRequests(bidRequests); expect(requests[0].url).to.match(new RegExp('^\/\/bidder.rtk.io/Toby/TdAx/aardvark\?')); expect(requests[0].data.categories.length).to.equal(2); expect(requests[1].url).to.match(new RegExp('^\/\/adzone.pub.com/xiby/RAZd/aardvark\?')); }); - it('should have correct data', () => { + it('should have correct data', function () { const requests = spec.buildRequests(bidRequests); expect(requests.length).to.equal(2); expect(requests[0].data.version).to.equal(1); @@ -138,7 +138,7 @@ describe('aardvarkAdapterTest', () => { }); }); - describe('GDPR conformity', () => { + describe('GDPR conformity', function () { const bidRequests = [{ bidder: 'aardvark', params: { @@ -160,7 +160,7 @@ describe('aardvarkAdapterTest', () => { } }; - it('should transmit correct data', () => { + it('should transmit correct data', function () { const requests = spec.buildRequests(bidRequests, bidderRequest); expect(requests.length).to.equal(1); expect(requests[0].data.gdpr).to.equal(true); @@ -168,7 +168,7 @@ describe('aardvarkAdapterTest', () => { }); }); - describe('GDPR absence conformity', () => { + describe('GDPR absence conformity', function () { const bidRequests = [{ bidder: 'aardvark', params: { @@ -187,7 +187,7 @@ describe('aardvarkAdapterTest', () => { gdprConsent: undefined }; - it('should transmit correct data', () => { + it('should transmit correct data', function () { const requests = spec.buildRequests(bidRequests, bidderRequest); expect(requests.length).to.equal(1); expect(requests[0].data.gdpr).to.be.undefined; @@ -195,8 +195,8 @@ describe('aardvarkAdapterTest', () => { }); }); - describe('interpretResponse', () => { - it('should handle bid responses', () => { + describe('interpretResponse', function () { + it('should handle bid responses', function () { const serverResponse = { body: [ { @@ -245,7 +245,7 @@ describe('aardvarkAdapterTest', () => { expect(result[1].ad).to.not.be.undefined; }); - it('should handle nobid responses', () => { + it('should handle nobid responses', function () { var emptyResponse = [{ nurl: '', cid: '9e5a09319e18f1', diff --git a/test/spec/modules/adbutlerBidAdapter_spec.js b/test/spec/modules/adbutlerBidAdapter_spec.js index a46039402e6..cf6b52f70e5 100644 --- a/test/spec/modules/adbutlerBidAdapter_spec.js +++ b/test/spec/modules/adbutlerBidAdapter_spec.js @@ -1,10 +1,10 @@ import {expect} from 'chai'; import {spec} from 'modules/adbutlerBidAdapter'; -describe('AdButler adapter', () => { +describe('AdButler adapter', function () { let bidRequests; - beforeEach(() => { + beforeEach(function () { bidRequests = [ { bidder: 'adbutler', @@ -25,9 +25,9 @@ describe('AdButler adapter', () => { ]; }); - describe('implementation', () => { - describe('for requests', () => { - it('should accept valid bid', () => { + describe('implementation', function () { + describe('for requests', function () { + it('should accept valid bid', function () { let validBid = { bidder: 'adbutler', params: { @@ -40,7 +40,7 @@ describe('AdButler adapter', () => { expect(isValid).to.equal(true); }); - it('should reject invalid bid', () => { + it('should reject invalid bid', function () { let invalidBid = { bidder: 'adbutler', params: { @@ -52,7 +52,7 @@ describe('AdButler adapter', () => { expect(isValid).to.equal(false); }); - it('should use custom domain string', () => { + it('should use custom domain string', function () { let bidRequests = [ { bidId: '3c9408cdbf2f68', @@ -73,7 +73,7 @@ describe('AdButler adapter', () => { expect(requestURL).to.have.string('.dan.test'); }); - it('should set default domain', () => { + it('should set default domain', function () { let requests = spec.buildRequests(bidRequests), request = requests[0]; @@ -82,14 +82,14 @@ describe('AdButler adapter', () => { expect(domain).to.equal('http://servedbyadbutler.com'); }); - it('should set the keyword parameter', () => { + it('should set the keyword parameter', function () { let requests = spec.buildRequests(bidRequests), requestURL = requests[0].url; expect(requestURL).to.have.string(';kw=red;'); }); - it('should increment the count for the same zone', () => { + it('should increment the count for the same zone', function () { let bidRequests = [ { sizes: [[300, 250]], @@ -118,8 +118,8 @@ describe('AdButler adapter', () => { }); }); - describe('bid responses', () => { - it('should return complete bid response', () => { + describe('bid responses', function () { + it('should return complete bid response', function () { let serverResponse = { body: { status: 'SUCCESS', @@ -149,7 +149,7 @@ describe('AdButler adapter', () => { expect(bids[0].ad).to.have.string('http://tracking.pixel.com/params=info'); }); - it('should return empty bid response', () => { + it('should return empty bid response', function () { let serverResponse = { status: 'NO_ELIGIBLE_ADS', zone_id: 210083, @@ -162,7 +162,7 @@ describe('AdButler adapter', () => { expect(bids).to.be.lengthOf(0); }); - it('should return empty bid response on incorrect size', () => { + it('should return empty bid response on incorrect size', function () { let serverResponse = { status: 'SUCCESS', account_id: 167283, @@ -177,7 +177,7 @@ describe('AdButler adapter', () => { expect(bids).to.be.lengthOf(0); }); - it('should return empty bid response with CPM too low', () => { + it('should return empty bid response with CPM too low', function () { let serverResponse = { status: 'SUCCESS', account_id: 167283, @@ -192,7 +192,7 @@ describe('AdButler adapter', () => { expect(bids).to.be.lengthOf(0); }); - it('should return empty bid response with CPM too high', () => { + it('should return empty bid response with CPM too high', function () { let serverResponse = { status: 'SUCCESS', account_id: 167283, diff --git a/test/spec/modules/adformBidAdapter_spec.js b/test/spec/modules/adformBidAdapter_spec.js index d888b4b7a5b..d3054794485 100644 --- a/test/spec/modules/adformBidAdapter_spec.js +++ b/test/spec/modules/adformBidAdapter_spec.js @@ -3,10 +3,10 @@ import * as url from 'src/url'; import {spec} from 'modules/adformBidAdapter'; import { BANNER, VIDEO } from 'src/mediaTypes'; -describe('Adform adapter', () => { +describe('Adform adapter', function () { let serverResponse, bidRequest, bidResponses; let bids = []; - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { 'bidder': 'adform', 'params': { @@ -14,11 +14,11 @@ describe('Adform adapter', () => { } }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { assert(spec.isBidRequestValid(bid)); }); - it('should return false when required params are missing', () => { + it('should return false when required params are missing', function () { bid.params = { adxDomain: 'adx.adform.net' }; @@ -26,14 +26,14 @@ describe('Adform adapter', () => { }); }); - describe('buildRequests', () => { - it('should pass multiple bids via single request', () => { + describe('buildRequests', function () { + it('should pass multiple bids via single request', function () { let request = spec.buildRequests(bids); let parsedUrl = parseUrl(request.url); assert.lengthOf(parsedUrl.items, 7); }); - it('should handle global request parameters', () => { + it('should handle global request parameters', function () { let parsedUrl = parseUrl(spec.buildRequests([bids[0]]).url); let query = parsedUrl.query; @@ -45,12 +45,12 @@ describe('Adform adapter', () => { assert.equal(query.url, encodeURIComponent('some// there')); }); - it('should set correct request method', () => { + it('should set correct request method', function () { let request = spec.buildRequests([bids[0]]); assert.equal(request.method, 'GET'); }); - it('should correctly form bid items', () => { + it('should correctly form bid items', function () { let bidList = bids; let request = spec.buildRequests(bidList); let parsedUrl = parseUrl(request.url); @@ -93,13 +93,13 @@ describe('Adform adapter', () => { ]); }); - it('should not change original validBidRequests object', () => { + it('should not change original validBidRequests object', function () { var resultBids = JSON.parse(JSON.stringify(bids[0])); let request = spec.buildRequests([bids[0]]); assert.deepEqual(resultBids, bids[0]); }); - it('should set gross to the request, if there is any gross priceType', () => { + it('should set gross to the request, if there is any gross priceType', function () { let request = spec.buildRequests([bids[5], bids[5]]); let parsedUrl = parseUrl(request.url); @@ -111,8 +111,8 @@ describe('Adform adapter', () => { assert.equal(parsedUrl.query.pt, 'gross'); }); - describe('gdpr', () => { - it('should send GDPR Consent data to adform if gdprApplies', () => { + describe('gdpr', function () { + it('should send GDPR Consent data to adform if gdprApplies', function () { let resultBids = JSON.parse(JSON.stringify(bids[0])); let request = spec.buildRequests([bids[0]], {gdprConsent: {gdprApplies: true, consentString: 'concentDataString'}}); let parsedUrl = parseUrl(request.url).query; @@ -121,7 +121,7 @@ describe('Adform adapter', () => { assert.equal(parsedUrl.gdpr_consent, 'concentDataString'); }); - it('should not send GDPR Consent data to adform if gdprApplies is false or undefined', () => { + it('should not send GDPR Consent data to adform if gdprApplies is false or undefined', function () { let resultBids = JSON.parse(JSON.stringify(bids[0])); let request = spec.buildRequests([bids[0]], {gdprConsent: {gdprApplies: false, consentString: 'concentDataString'}}); let parsedUrl = parseUrl(request.url).query; @@ -134,7 +134,7 @@ describe('Adform adapter', () => { assert.ok(!parsedUrl.gdpr_consent); }); - it('should return GDPR Consent data with request data', () => { + it('should return GDPR Consent data with request data', function () { let request = spec.buildRequests([bids[0]], {gdprConsent: {gdprApplies: true, consentString: 'concentDataString'}}); assert.deepEqual(request.gdpr, { @@ -148,12 +148,12 @@ describe('Adform adapter', () => { }); }); - describe('interpretResponse', () => { - it('should respond with empty response when there is empty serverResponse', () => { + describe('interpretResponse', function () { + it('should respond with empty response when there is empty serverResponse', function () { let result = spec.interpretResponse({ body: {} }, {}); assert.deepEqual(result, []); }); - it('should respond with empty response when response from server is not banner', () => { + it('should respond with empty response when response from server is not banner', function () { serverResponse.body[0].response = 'not banner'; serverResponse.body = [serverResponse.body[0]]; bidRequest.bids = [bidRequest.bids[0]]; @@ -161,7 +161,7 @@ describe('Adform adapter', () => { assert.deepEqual(result, []); }); - it('should interpret server response correctly with one bid', () => { + it('should interpret server response correctly with one bid', function () { serverResponse.body = [serverResponse.body[0]]; bidRequest.bids = [bidRequest.bids[0]]; let result = spec.interpretResponse(serverResponse, bidRequest)[0]; @@ -180,7 +180,7 @@ describe('Adform adapter', () => { assert.equal(result.transactionId, '5f33781f-9552-4ca1'); }); - it('should set correct netRevenue', () => { + it('should set correct netRevenue', function () { serverResponse.body = [serverResponse.body[0]]; bidRequest.bids = [bidRequest.bids[1]]; bidRequest.netRevenue = 'gross'; @@ -189,22 +189,22 @@ describe('Adform adapter', () => { assert.equal(result.netRevenue, false); }); - it('should create bid response item for every requested item', () => { + it('should create bid response item for every requested item', function () { let result = spec.interpretResponse(serverResponse, bidRequest); assert.lengthOf(result, 5); }); - it('should create bid response with vast xml', () => { + it('should create bid response with vast xml', function () { const result = spec.interpretResponse(serverResponse, bidRequest)[3]; assert.equal(result.vastXml, ''); }); - it('should create bid response with vast url', () => { + it('should create bid response with vast url', function () { const result = spec.interpretResponse(serverResponse, bidRequest)[4]; assert.equal(result.vastUrl, 'vast://url'); }); - it('should set mediaType on bid response', () => { + it('should set mediaType on bid response', function () { const expected = [ BANNER, BANNER, BANNER, VIDEO, VIDEO ]; const result = spec.interpretResponse(serverResponse, bidRequest); for (let i = 0; i < result.length; i++) { @@ -212,7 +212,7 @@ describe('Adform adapter', () => { } }); - it('should set default netRevenue as gross', () => { + it('should set default netRevenue as gross', function () { bidRequest.netRevenue = 'gross'; const result = spec.interpretResponse(serverResponse, bidRequest); for (let i = 0; i < result.length; i++) { @@ -220,7 +220,7 @@ describe('Adform adapter', () => { } }); - it('should set gdpr if it exist in bidRequest', () => { + it('should set gdpr if it exist in bidRequest', function () { bidRequest.gdpr = { gdpr: true, gdpr_consent: 'ERW342EIOWT34234KMGds' @@ -239,8 +239,8 @@ describe('Adform adapter', () => { }; }); - describe('verifySizes', () => { - it('should respond with empty response when sizes doesn\'t match', () => { + describe('verifySizes', function () { + it('should respond with empty response when sizes doesn\'t match', function () { serverResponse.body[0].response = 'banner'; serverResponse.body[0].width = 100; serverResponse.body[0].height = 150; @@ -253,7 +253,7 @@ describe('Adform adapter', () => { assert.equal(serverResponse.body[0].response, 'banner'); assert.deepEqual(result, []); }); - it('should respond with empty response when sizes as a strings doesn\'t match', () => { + it('should respond with empty response when sizes as a strings doesn\'t match', function () { serverResponse.body[0].response = 'banner'; serverResponse.body[0].width = 100; serverResponse.body[0].height = 150; @@ -268,7 +268,7 @@ describe('Adform adapter', () => { assert.equal(serverResponse.body[0].response, 'banner'); assert.deepEqual(result, []); }); - it('should support size dimensions as a strings', () => { + it('should support size dimensions as a strings', function () { serverResponse.body[0].response = 'banner'; serverResponse.body[0].width = 300; serverResponse.body[0].height = 600; @@ -285,7 +285,7 @@ describe('Adform adapter', () => { }) }); - beforeEach(() => { + beforeEach(function () { let sizes = [[250, 300], [300, 250], [300, 600]]; let placementCode = ['div-01', 'div-02', 'div-03', 'div-04', 'div-05']; let params = [{ mid: 1, url: 'some// there' }, {adxDomain: null, mid: 2, someVar: 'someValue', pt: 'gross'}, { adxDomain: null, mid: 3, pdom: 'home' }, {mid: 5, pt: 'net'}, {mid: 6, pt: 'gross'}]; diff --git a/test/spec/modules/adgenerationBidAdapter_spec.js b/test/spec/modules/adgenerationBidAdapter_spec.js index 4239712ccaf..558303ccecb 100644 --- a/test/spec/modules/adgenerationBidAdapter_spec.js +++ b/test/spec/modules/adgenerationBidAdapter_spec.js @@ -4,28 +4,28 @@ import {spec} from 'modules/adgenerationBidAdapter'; import {newBidder} from 'src/adapters/bidderFactory'; import {NATIVE} from 'src/mediaTypes'; -describe('AdgenerationAdapter', () => { +describe('AdgenerationAdapter', function () { const adapter = newBidder(spec); const ENDPOINT = ['http://api-test.scaleout.jp/adsv/v1', 'https://d.socdm.com/adsv/v1']; - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { 'bidder': 'adg', 'params': { id: '58278', // banner } }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = {}; @@ -33,7 +33,7 @@ describe('AdgenerationAdapter', () => { }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { const bidRequests = [ { // banner bidder: 'adg', @@ -91,31 +91,31 @@ describe('AdgenerationAdapter', () => { banner: 'posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&imark=1', native: 'posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3' }; - it('sends bid request to ENDPOINT via GET', () => { + it('sends bid request to ENDPOINT via GET', function () { const request = spec.buildRequests(bidRequests)[0]; expect(request.url).to.equal(ENDPOINT[1]); expect(request.method).to.equal('GET'); }); - it('sends bid request to debug ENDPOINT via GET', () => { + it('sends bid request to debug ENDPOINT via GET', function () { bidRequests[0].params.debug = true; const request = spec.buildRequests(bidRequests)[0]; expect(request.url).to.equal(ENDPOINT[0]); expect(request.method).to.equal('GET'); }); - it('should attache params to the banner request', () => { + it('should attache params to the banner request', function () { const request = spec.buildRequests(bidRequests)[0]; expect(request.data).to.equal(data.banner); }); - it('should attache params to the native request', () => { + it('should attache params to the native request', function () { const request = spec.buildRequests(bidRequests)[1]; expect(request.data).to.equal(data.native); }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { const bidRequests = { banner: { bidRequest: { @@ -336,12 +336,12 @@ describe('AdgenerationAdapter', () => { } }; - it('no bid responses', () => { + it('no bid responses', function () { const result = spec.interpretResponse({body: serverResponse.noAd}, bidRequests.banner); expect(result.length).to.equal(0); }); - it('handles banner responses', () => { + it('handles banner responses', function () { const result = spec.interpretResponse({body: serverResponse.banner}, bidRequests.banner)[0]; expect(result.requestId).to.equal(bidResponses.banner.requestId); expect(result.width).to.equal(bidResponses.banner.width); @@ -355,7 +355,7 @@ describe('AdgenerationAdapter', () => { expect(result.ad).to.equal(bidResponses.banner.ad); }); - it('handles native responses', () => { + it('handles native responses', function () { const result = spec.interpretResponse({body: serverResponse.native}, bidRequests.native)[0]; expect(result.requestId).to.equal(bidResponses.native.requestId); expect(result.width).to.equal(bidResponses.native.width); diff --git a/test/spec/modules/adkernelAdnAnalyticsAdapter_spec.js b/test/spec/modules/adkernelAdnAnalyticsAdapter_spec.js index f5d1a5d02f1..1291a375fc0 100644 --- a/test/spec/modules/adkernelAdnAnalyticsAdapter_spec.js +++ b/test/spec/modules/adkernelAdnAnalyticsAdapter_spec.js @@ -33,81 +33,81 @@ const CAMPAIGN = { c5: '5' }; -describe('', () => { +describe('', function () { let sandbox; - before(() => { + before(function () { sandbox = sinon.sandbox.create(); }); - after(() => { + after(function () { sandbox.restore(); analyticsAdapter.disableAnalytics(); }); - describe('UTM source parser', () => { + describe('UTM source parser', function () { let stubSetItem; let stubGetItem; - before(() => { + before(function () { stubSetItem = sandbox.stub(storage, 'setItem'); stubGetItem = sandbox.stub(storage, 'getItem'); }); - afterEach(() => { + afterEach(function () { sandbox.reset(); }); - it('should parse first direct visit as (direct)', () => { + it('should parse first direct visit as (direct)', function () { stubGetItem.withArgs('adk_dpt_analytics').returns(undefined); stubSetItem.returns(undefined); let source = getUmtSource('http://example.com'); expect(source).to.be.eql(DIRECT); }); - it('should respect past campaign visits before direct', () => { + it('should respect past campaign visits before direct', function () { stubGetItem.withArgs('adk_dpt_analytics').returns(JSON.stringify(CAMPAIGN)); stubSetItem.returns(undefined); let source = getUmtSource('http://example.com'); expect(source).to.be.eql(CAMPAIGN); }); - it('should parse visit from google as organic', () => { + it('should parse visit from google as organic', function () { stubGetItem.withArgs('adk_dpt_analytics').returns(undefined); stubSetItem.returns(undefined); let source = getUmtSource('http://example.com', 'https://www.google.com/search?q=pikachu'); expect(source).to.be.eql(GOOGLE_ORGANIC); }); - it('should respect previous campaign visit before organic', () => { + it('should respect previous campaign visit before organic', function () { stubGetItem.withArgs('adk_dpt_analytics').returns(JSON.stringify(CAMPAIGN)); stubSetItem.returns(undefined); let source = getUmtSource('http://example.com', 'https://www.google.com/search?q=pikachu'); expect(source).to.be.eql(CAMPAIGN); }); - it('should parse referral visit', () => { + it('should parse referral visit', function () { stubGetItem.withArgs('adk_dpt_analytics').returns(undefined); stubSetItem.returns(undefined); let source = getUmtSource('http://example.com', 'http://lander.com/lander.html'); expect(source).to.be.eql(REFERRER); }); - it('should respect previous campaign visit before referral', () => { + it('should respect previous campaign visit before referral', function () { stubGetItem.withArgs('adk_dpt_analytics').returns(JSON.stringify(CAMPAIGN)); stubSetItem.returns(undefined); let source = getUmtSource('http://example.com', 'https://www.google.com/search?q=pikachu'); expect(source).to.be.eql(CAMPAIGN); }); - it('should parse referral visit from same domain as direct', () => { + it('should parse referral visit from same domain as direct', function () { stubGetItem.withArgs('adk_dpt_analytics').returns(undefined); stubSetItem.returns(undefined); let source = getUmtSource('http://lander.com/news.html', 'http://lander.com/lander.html'); expect(source).to.be.eql(DIRECT); }); - it('should parse campaign visit', () => { + it('should parse campaign visit', function () { stubGetItem.withArgs('adk_dpt_analytics').returns(undefined); stubSetItem.returns(undefined); let source = getUmtSource('http://lander.com/index.html?utm_campaign=new_campaign&utm_source=adkernel&utm_medium=email&utm_c1=1&utm_c2=2&utm_c3=3&utm_c4=4&utm_c5=5'); @@ -115,12 +115,12 @@ describe('', () => { }); }); - describe('ExpiringQueue', () => { + describe('ExpiringQueue', function () { let timer; - before(() => { + before(function () { timer = sandbox.useFakeTimers(0); }); - after(() => { + after(function () { timer.restore(); }); @@ -184,26 +184,26 @@ describe('', () => { size: '300x250' }; - describe('Analytics adapter', () => { + describe('Analytics adapter', function () { let ajaxStub; let timer; - before(() => { + before(function () { ajaxStub = sandbox.stub(ajax, 'ajax'); timer = sandbox.useFakeTimers(0); }); - beforeEach(() => { + beforeEach(function () { sandbox.stub(events, 'getEvents').callsFake(() => { return [] }); }); - afterEach(() => { + afterEach(function () { events.getEvents.restore(); }); - it('should be configurable', () => { + it('should be configurable', function () { adaptermanager.registerAnalyticsAdapter({ code: 'adkernelAdn', adapter: analyticsAdapter @@ -221,21 +221,21 @@ describe('', () => { expect(analyticsAdapter.context).to.have.property('pubId', 777); }); - it('should handle auction init event', () => { + it('should handle auction init event', function () { events.emit(CONSTANTS.EVENTS.AUCTION_INIT, {config: {}, timeout: 3000}); const ev = analyticsAdapter.context.queue.peekAll(); expect(ev).to.have.length(1); expect(ev[0]).to.be.eql({event: 'auctionInit'}); }); - it('should handle bid request event', () => { + it('should handle bid request event', function () { events.emit(CONSTANTS.EVENTS.BID_REQUESTED, REQUEST); const ev = analyticsAdapter.context.queue.peekAll(); expect(ev).to.have.length(2); expect(ev[1]).to.be.eql({event: 'bidRequested', adapter: 'adapter', tagid: 'container-1'}); }); - it('should handle bid response event', () => { + it('should handle bid response event', function () { events.emit(CONSTANTS.EVENTS.BID_RESPONSE, RESPONSE); const ev = analyticsAdapter.context.queue.peekAll(); expect(ev).to.have.length(3); @@ -248,7 +248,7 @@ describe('', () => { }); }); - it('should handle auction end event', () => { + it('should handle auction end event', function () { timer.tick(447); events.emit(CONSTANTS.EVENTS.AUCTION_END, RESPONSE); let ev = analyticsAdapter.context.queue.peekAll(); @@ -258,7 +258,7 @@ describe('', () => { expect(ev[3]).to.be.eql({event: 'auctionEnd', time: 0.447}); }); - it('should handle winning bid', () => { + it('should handle winning bid', function () { events.emit(CONSTANTS.EVENTS.BID_WON, RESPONSE); timer.tick(4500); expect(ajaxStub.calledTwice).to.be.equal(true); diff --git a/test/spec/modules/adkernelAdnBidAdapter_spec.js b/test/spec/modules/adkernelAdnBidAdapter_spec.js index af9ccfd78ed..fe71d968571 100644 --- a/test/spec/modules/adkernelAdnBidAdapter_spec.js +++ b/test/spec/modules/adkernelAdnBidAdapter_spec.js @@ -2,7 +2,7 @@ import {expect} from 'chai'; import {spec} from 'modules/adkernelAdnBidAdapter'; import * as utils from 'src/utils'; -describe('AdkernelAdn adapter', () => { +describe('AdkernelAdn adapter', function () { const bid1_pub1 = { bidder: 'adkernelAdn', transactionId: 'transact0', @@ -110,12 +110,12 @@ describe('AdkernelAdn adapter', () => { syncpages: ['https://dsp.adkernel.com/sync'] }; - describe('input parameters validation', () => { - it('empty request shouldn\'t generate exception', () => { + describe('input parameters validation', function () { + it('empty request shouldn\'t generate exception', function () { expect(spec.isBidRequestValid({bidderCode: 'adkernelAdn' })).to.be.equal(false); }); - it('request without pubid should be ignored', () => { + it('request without pubid should be ignored', function () { expect(spec.isBidRequestValid({ bidder: 'adkernelAdn', params: {}, @@ -123,7 +123,7 @@ describe('AdkernelAdn adapter', () => { sizes: [[300, 250]] })).to.be.equal(false); }); - it('request with invalid pubid should be ignored', () => { + it('request with invalid pubid should be ignored', function () { expect(spec.isBidRequestValid({ bidder: 'adkernelAdn', params: { @@ -157,41 +157,41 @@ describe('AdkernelAdn adapter', () => { return [pbRequests, tagRequests]; } - describe('banner request building', () => { + describe('banner request building', function () { let [_, tagRequests] = buildRequest([bid1_pub1]); let tagRequest = tagRequests[0]; - it('should have request id', () => { + it('should have request id', function () { expect(tagRequest).to.have.property('id'); }); - it('should have transaction id', () => { + it('should have transaction id', function () { expect(tagRequest).to.have.property('tid'); }); - it('should have sizes', () => { + it('should have sizes', function () { expect(tagRequest.imp[0].banner).to.have.property('format'); expect(tagRequest.imp[0].banner.format).to.be.eql(['300x250', '300x200']); }); - it('should have impression id', () => { + it('should have impression id', function () { expect(tagRequest.imp[0]).to.have.property('id', 'bidid_1'); }); - it('should have tagid', () => { + it('should have tagid', function () { expect(tagRequest.imp[0]).to.have.property('tagid', 'ad-unit-1'); }); - it('should create proper site block', () => { + it('should create proper site block', function () { expect(tagRequest.site).to.have.property('page', 'https://example.com/index.html'); expect(tagRequest.site).to.have.property('secure', 1); }); - it('should not have user object', () => { + it('should not have user object', function () { expect(tagRequest).to.not.have.property('user'); }); - it('shouldn\'t contain gdpr-related information for default request', () => { + it('shouldn\'t contain gdpr-related information for default request', function () { let [_, tagRequests] = buildRequest([bid1_pub1]); expect(tagRequests[0]).to.not.have.property('user'); }); - it('should contain gdpr-related information if consent is configured', () => { + it('should contain gdpr-related information if consent is configured', function () { let [_, bidRequests] = buildRequest([bid1_pub1], {gdprConsent: {gdprApplies: true, consentString: 'test-consent-string'}}); expect(bidRequests[0]).to.have.property('user'); @@ -199,7 +199,7 @@ describe('AdkernelAdn adapter', () => { expect(bidRequests[0].user).to.have.property('consent', 'test-consent-string'); }); - it('should\'t contain consent string if gdpr isn\'t applied', () => { + it('should\'t contain consent string if gdpr isn\'t applied', function () { let [_, bidRequests] = buildRequest([bid1_pub1], {gdprConsent: {gdprApplies: false}}); expect(bidRequests[0]).to.have.property('user'); expect(bidRequests[0].user).to.have.property('gdpr', 0); @@ -207,19 +207,19 @@ describe('AdkernelAdn adapter', () => { }); }); - describe('video request building', () => { + describe('video request building', function () { let [_, tagRequests] = buildRequest([bid_video1, bid_video2]); let tagRequest = tagRequests[0]; - it('should have video object', () => { + it('should have video object', function () { expect(tagRequest.imp[0]).to.have.property('video'); expect(tagRequest.imp[1]).to.have.property('video'); }); - it('should have tagid', () => { + it('should have tagid', function () { expect(tagRequest.imp[0]).to.have.property('tagid', 'video_wrapper'); expect(tagRequest.imp[1]).to.have.property('tagid', 'video_wrapper2'); }); - it('should have size', () => { + it('should have size', function () { expect(tagRequest.imp[0].video).to.have.property('w', 640); expect(tagRequest.imp[0].video).to.have.property('h', 300); expect(tagRequest.imp[1].video).to.have.property('w', 1920); @@ -227,8 +227,8 @@ describe('AdkernelAdn adapter', () => { }); }); - describe('requests routing', () => { - it('should issue a request for each publisher', () => { + describe('requests routing', function () { + it('should issue a request for each publisher', function () { let [pbRequests, tagRequests] = buildRequest([bid1_pub1, bid_video1]); expect(pbRequests).to.have.length(2); expect(pbRequests[0].url).to.have.string(`account=${bid1_pub1.params.pubId}`); @@ -236,7 +236,7 @@ describe('AdkernelAdn adapter', () => { expect(tagRequests[0].imp).to.have.length(1); expect(tagRequests[1].imp).to.have.length(1); }); - it('should issue a request for each host', () => { + it('should issue a request for each host', function () { let [pbRequests, tagRequests] = buildRequest([bid1_pub1, bid1_pub2]); expect(pbRequests).to.have.length(2); expect(pbRequests[0].url).to.have.string('//tag.adkernel.com/tag'); @@ -246,15 +246,15 @@ describe('AdkernelAdn adapter', () => { }); }); - describe('responses processing', () => { + describe('responses processing', function () { let responses; - before(() => { + before(function () { responses = spec.interpretResponse({body: response}); }); - it('should parse all responses', () => { + it('should parse all responses', function () { expect(responses).to.have.length(3); }); - it('should return fully-initialized bid-response', () => { + it('should return fully-initialized bid-response', function () { let resp = responses[0]; expect(resp).to.have.property('bidderCode', 'adkernelAdn'); expect(resp).to.have.property('requestId', '2c5e951baeeadd'); @@ -268,7 +268,7 @@ describe('AdkernelAdn adapter', () => { expect(resp).to.have.property('ad'); expect(resp.ad).to.have.string(''); }); - it('should return fully-initialized video bid-response', () => { + it('should return fully-initialized video bid-response', function () { let resp = responses[2]; expect(resp).to.have.property('bidderCode', 'adkernelAdn'); expect(resp).to.have.property('requestId', '57d602ad1c9545'); @@ -280,7 +280,7 @@ describe('AdkernelAdn adapter', () => { expect(resp).to.have.property('vastUrl', 'http://vast.com/vast.xml'); expect(resp).to.not.have.property('ad'); }); - it('should perform usersync', () => { + it('should perform usersync', function () { let syncs = spec.getUserSyncs({iframeEnabled: false}, [{body: response}]); expect(syncs).to.have.length(0); syncs = spec.getUserSyncs({iframeEnabled: true}, [{body: response}]); @@ -288,12 +288,12 @@ describe('AdkernelAdn adapter', () => { expect(syncs[0]).to.have.property('type', 'iframe'); expect(syncs[0]).to.have.property('url', 'https://dsp.adkernel.com/sync'); }); - it('should handle user-sync only response', () => { + it('should handle user-sync only response', function () { let [pbRequests, tagRequests] = buildRequest([bid1_pub1]); let resp = spec.interpretResponse({body: usersyncOnlyResponse}, pbRequests[0]); expect(resp).to.have.length(0); }); - it('shouldn\' fail on empty response', () => { + it('shouldn\' fail on empty response', function () { let syncs = spec.getUserSyncs({iframeEnabled: true}, [{body: ''}]); expect(syncs).to.have.length(0); }); diff --git a/test/spec/modules/adkernelBidAdapter_spec.js b/test/spec/modules/adkernelBidAdapter_spec.js index 0f5596b8b23..590e0ebb96e 100644 --- a/test/spec/modules/adkernelBidAdapter_spec.js +++ b/test/spec/modules/adkernelBidAdapter_spec.js @@ -3,7 +3,7 @@ import {spec} from 'modules/adkernelBidAdapter'; import * as utils from 'src/utils'; import {parse as parseUrl} from 'src/url'; -describe('Adkernel adapter', () => { +describe('Adkernel adapter', function () { const bid1_zone1 = { bidder: 'adkernel', bidId: 'Bid_01', @@ -127,73 +127,73 @@ describe('Adkernel adapter', () => { return [pbRequests, rtbRequests]; } - describe('input parameters validation', () => { - it('empty request shouldn\'t generate exception', () => { + describe('input parameters validation', function () { + it('empty request shouldn\'t generate exception', function () { expect(spec.isBidRequestValid({ bidderCode: 'adkernel' })).to.be.equal(false); }); - it('request without zone shouldn\'t issue a request', () => { + it('request without zone shouldn\'t issue a request', function () { expect(spec.isBidRequestValid(bid_without_zone)).to.be.equal(false); }); - it('request without host shouldn\'t issue a request', () => { + it('request without host shouldn\'t issue a request', function () { expect(spec.isBidRequestValid(bid_without_host)).to.be.equal(false); }); - it('empty request shouldn\'t generate exception', () => { + it('empty request shouldn\'t generate exception', function () { expect(spec.isBidRequestValid(bid_with_wrong_zoneId)).to.be.equal(false); }); }); - describe('banner request building', () => { + describe('banner request building', function () { let bidRequest, bidRequests, _; - before(() => { + before(function () { [_, bidRequests] = buildRequest([bid1_zone1]); bidRequest = bidRequests[0]; }); - it('should be a first-price auction', () => { + it('should be a first-price auction', function () { expect(bidRequest).to.have.property('at', 1); }); - it('should have banner object', () => { + it('should have banner object', function () { expect(bidRequest.imp[0]).to.have.property('banner'); }); - it('should have w/h', () => { + it('should have w/h', function () { expect(bidRequest.imp[0].banner).to.have.property('format'); expect(bidRequest.imp[0].banner.format).to.be.eql([{w: 300, h: 250}, {w: 300, h: 200}]); }); - it('should respect secure connection', () => { + it('should respect secure connection', function () { expect(bidRequest.imp[0]).to.have.property('secure', 1); }); - it('should have tagid', () => { + it('should have tagid', function () { expect(bidRequest.imp[0]).to.have.property('tagid', 'ad-unit-1'); }); - it('should create proper site block', () => { + it('should create proper site block', function () { expect(bidRequest.site).to.have.property('domain', 'example.com'); expect(bidRequest.site).to.have.property('page', 'https://example.com/index.html'); }); - it('should fill device with caller macro', () => { + it('should fill device with caller macro', function () { expect(bidRequest).to.have.property('device'); expect(bidRequest.device).to.have.property('ip', 'caller'); expect(bidRequest.device).to.have.property('ua', 'caller'); expect(bidRequest.device).to.have.property('dnt', 1); }); - it('shouldn\'t contain gdpr-related information for default request', () => { + it('shouldn\'t contain gdpr-related information for default request', function () { let [_, bidRequests] = buildRequest([bid1_zone1]); expect(bidRequests[0]).to.not.have.property('regs'); expect(bidRequests[0]).to.not.have.property('user'); }); - it('should contain gdpr-related information if consent is configured', () => { + it('should contain gdpr-related information if consent is configured', function () { let [_, bidRequests] = buildRequest([bid1_zone1], {gdprConsent: {gdprApplies: true, consentString: 'test-consent-string', vendorData: {}}}); let bidRequest = bidRequests[0]; @@ -203,7 +203,7 @@ describe('Adkernel adapter', () => { expect(bidRequest.user.ext).to.be.eql({'consent': 'test-consent-string'}); }); - it('should\'t contain consent string if gdpr isn\'t applied', () => { + it('should\'t contain consent string if gdpr isn\'t applied', function () { let [_, bidRequests] = buildRequest([bid1_zone1], {gdprConsent: {gdprApplies: false}}); let bidRequest = bidRequests[0]; expect(bidRequest).to.have.property('regs'); @@ -211,41 +211,41 @@ describe('Adkernel adapter', () => { expect(bidRequest).to.not.have.property('user'); }); - it('should\'t pass dnt if state is unknown', () => { + it('should\'t pass dnt if state is unknown', function () { let [_, bidRequests] = buildRequest([bid1_zone1], {}, 'https://example.com/index.html', false); expect(bidRequests[0].device).to.not.have.property('dnt'); }); }); - describe('video request building', () => { + describe('video request building', function () { let _, bidRequests; - before(() => { + before(function () { [_, bidRequests] = buildRequest([bid_video]); }); - it('should have video object', () => { + it('should have video object', function () { expect(bidRequests[0].imp[0]).to.have.property('video'); }); - it('should have h/w', () => { + it('should have h/w', function () { expect(bidRequests[0].imp[0].video).to.have.property('w', 640); expect(bidRequests[0].imp[0].video).to.have.property('h', 480); }); - it('should have tagid', () => { + it('should have tagid', function () { expect(bidRequests[0].imp[0]).to.have.property('tagid', 'ad-unit-1'); }); }); - describe('requests routing', () => { - it('should issue a request for each host', () => { + describe('requests routing', function () { + it('should issue a request for each host', function () { let [pbRequests, _] = buildRequest([bid1_zone1, bid3_host2]); expect(pbRequests).to.have.length(2); expect(pbRequests[0].url).to.have.string(`//${bid1_zone1.params.host}/`); expect(pbRequests[1].url).to.have.string(`//${bid3_host2.params.host}/`); }); - it('should issue a request for each zone', () => { + it('should issue a request for each zone', function () { let [pbRequests, _] = buildRequest([bid1_zone1, bid2_zone2]); expect(pbRequests).to.have.length(2); expect(pbRequests[0].data.zone).to.be.equal(bid1_zone1.params.zoneId); @@ -253,8 +253,8 @@ describe('Adkernel adapter', () => { }); }); - describe('responses processing', () => { - it('should return fully-initialized banner bid-response', () => { + describe('responses processing', function () { + it('should return fully-initialized banner bid-response', function () { let [pbRequests, _] = buildRequest([bid1_zone1]); let resp = spec.interpretResponse({body: bidResponse1}, pbRequests[0])[0]; expect(resp).to.have.property('requestId', 'Bid_01'); @@ -269,7 +269,7 @@ describe('Adkernel adapter', () => { expect(resp.ad).to.have.string(''); }); - it('should return fully-initialized video bid-response', () => { + it('should return fully-initialized video bid-response', function () { let [pbRequests, _] = buildRequest([bid_video]); let resp = spec.interpretResponse({body: videoBidResponse}, pbRequests[0])[0]; expect(resp).to.have.property('requestId', 'Bid_Video'); @@ -280,20 +280,20 @@ describe('Adkernel adapter', () => { expect(resp.height).to.equal(480); }); - it('should add nurl as pixel for banner response', () => { + it('should add nurl as pixel for banner response', function () { let [pbRequests, _] = buildRequest([bid1_zone1]); let resp = spec.interpretResponse({body: bidResponse1}, pbRequests[0])[0]; let expectedNurl = bidResponse1.seatbid[0].bid[0].nurl + '&px=1'; expect(resp.ad).to.have.string(expectedNurl); }); - it('should handle bidresponse with user-sync only', () => { + it('should handle bidresponse with user-sync only', function () { let [pbRequests, _] = buildRequest([bid1_zone1]); let resp = spec.interpretResponse({body: usersyncOnlyResponse}, pbRequests[0]); expect(resp).to.have.length(0); }); - it('should perform usersync', () => { + it('should perform usersync', function () { let syncs = spec.getUserSyncs({iframeEnabled: false}, [{body: bidResponse1}]); expect(syncs).to.have.length(0); syncs = spec.getUserSyncs({iframeEnabled: true}, [{body: bidResponse1}]); diff --git a/test/spec/modules/admixerBidAdapter_spec.js b/test/spec/modules/admixerBidAdapter_spec.js index 13312e3d24e..54d0dbee6e4 100644 --- a/test/spec/modules/admixerBidAdapter_spec.js +++ b/test/spec/modules/admixerBidAdapter_spec.js @@ -6,16 +6,16 @@ const BIDDER_CODE = 'admixer'; const ENDPOINT_URL = '//inv-nets.admixer.net/prebid.1.0.aspx'; const ZONE_ID = '2eb6bd58-865c-47ce-af7f-a918108c3fd2'; -describe('AdmixerAdapter', () => { +describe('AdmixerAdapter', function () { const adapter = newBidder(spec); - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.be.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { 'bidder': BIDDER_CODE, 'params': { @@ -28,11 +28,11 @@ describe('AdmixerAdapter', () => { 'auctionId': '1d1a030790a475', }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -42,7 +42,7 @@ describe('AdmixerAdapter', () => { }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let bidRequests = [ { 'bidder': BIDDER_CODE, @@ -57,21 +57,21 @@ describe('AdmixerAdapter', () => { } ]; - it('should add referrer and imp to be equal bidRequest', () => { + it('should add referrer and imp to be equal bidRequest', function () { const request = spec.buildRequests(bidRequests); const payload = JSON.parse(request.data.substr(5)); expect(payload.referrer).to.not.be.undefined; expect(payload.imps[0]).to.deep.equal(bidRequests[0]); }); - it('sends bid request to ENDPOINT via GET', () => { + it('sends bid request to ENDPOINT via GET', function () { const request = spec.buildRequests(bidRequests); expect(request.url).to.equal(ENDPOINT_URL); expect(request.method).to.equal('GET'); }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { let response = { body: [{ 'currency': 'USD', @@ -86,7 +86,7 @@ describe('AdmixerAdapter', () => { }] }; - it('should get correct bid response', () => { + it('should get correct bid response', function () { const body = response.body; let expectedResponse = [ { @@ -107,7 +107,7 @@ describe('AdmixerAdapter', () => { expect(result[0]).to.deep.equal(expectedResponse[0]); }); - it('handles nobid responses', () => { + it('handles nobid responses', function () { let response = []; let result = spec.interpretResponse(response); diff --git a/test/spec/modules/adoceanBidAdapter_spec.js b/test/spec/modules/adoceanBidAdapter_spec.js index 39eb514752a..c9f33b940b5 100644 --- a/test/spec/modules/adoceanBidAdapter_spec.js +++ b/test/spec/modules/adoceanBidAdapter_spec.js @@ -2,16 +2,16 @@ import { expect } from 'chai'; import { spec } from 'modules/adoceanBidAdapter'; import { newBidder } from 'src/adapters/bidderFactory'; -describe('AdoceanAdapter', () => { +describe('AdoceanAdapter', function () { const adapter = newBidder(spec); - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { const bid = { 'bidder': 'adocean', 'params': { @@ -26,11 +26,11 @@ describe('AdoceanAdapter', () => { 'auctionId': '1d1a030790a475', }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { const bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -40,7 +40,7 @@ describe('AdoceanAdapter', () => { }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { const bidRequests = [ { 'bidder': 'adocean', @@ -64,32 +64,32 @@ describe('AdoceanAdapter', () => { } }; - it('should add bidIdMap with slaveId => bidId mapping', () => { + it('should add bidIdMap with slaveId => bidId mapping', function () { const request = spec.buildRequests(bidRequests, bidderRequest)[0]; expect(request.bidIdMap).to.exists; const bidIdMap = request.bidIdMap; expect(bidIdMap[bidRequests[0].params.slaveId]).to.equal(bidRequests[0].bidId); }); - it('sends bid request to url via GET', () => { + it('sends bid request to url via GET', function () { const request = spec.buildRequests(bidRequests, bidderRequest)[0]; expect(request.method).to.equal('GET'); expect(request.url).to.match(new RegExp(`^https://${bidRequests[0].params.emiter}/ad.json`)); }); - it('should attach id to url', () => { + it('should attach id to url', function () { const request = spec.buildRequests(bidRequests, bidderRequest)[0]; expect(request.url).to.include('id=' + bidRequests[0].params.masterId); }); - it('should attach consent information to url', () => { + it('should attach consent information to url', function () { const request = spec.buildRequests(bidRequests, bidderRequest)[0]; expect(request.url).to.include('gdpr=1'); expect(request.url).to.include('gdpr_consent=' + bidderRequest.gdprConsent.consentString); }); }) - describe('interpretResponse', () => { + describe('interpretResponse', function () { const response = { 'body': [ { @@ -128,7 +128,7 @@ describe('AdoceanAdapter', () => { 'auctionId': '1d1a030790a475', }; - it('should get correct bid response', () => { + it('should get correct bid response', function () { const expectedResponse = [ { 'requestId': '30b31c1838de1e', @@ -156,7 +156,7 @@ describe('AdoceanAdapter', () => { }); }); - it('handles nobid responses', () => { + it('handles nobid responses', function () { response.body = [ { 'id': 'adoceanmyaolafpjwftbz', diff --git a/test/spec/modules/adomikAnalyticsAdapter_spec.js b/test/spec/modules/adomikAnalyticsAdapter_spec.js index 59e6dadec96..cb3c30705f4 100644 --- a/test/spec/modules/adomikAnalyticsAdapter_spec.js +++ b/test/spec/modules/adomikAnalyticsAdapter_spec.js @@ -9,21 +9,21 @@ describe('Adomik Prebid Analytic', function () { let sendWonEventStub; describe('enableAnalytics', function () { - beforeEach(() => { + beforeEach(function () { sinon.spy(adomikAnalytics, 'track'); sendEventStub = sinon.stub(adomikAnalytics, 'sendTypedEvent'); sendWonEventStub = sinon.stub(adomikAnalytics, 'sendWonEvent'); sinon.stub(events, 'getEvents').returns([]); }); - afterEach(() => { + afterEach(function () { adomikAnalytics.track.restore(); sendEventStub.restore(); sendWonEventStub.restore(); events.getEvents.restore(); }); - after(() => { + after(function () { adomikAnalytics.disableAnalytics(); }); diff --git a/test/spec/modules/adspiritBidAdapter_spec.js b/test/spec/modules/adspiritBidAdapter_spec.js index 5c8400a8cbc..7f907612384 100644 --- a/test/spec/modules/adspiritBidAdapter_spec.js +++ b/test/spec/modules/adspiritBidAdapter_spec.js @@ -1,10 +1,10 @@ import {expect} from 'chai'; import {spec} from 'modules/adspiritBidAdapter'; -describe('Adspirit adapter tests', () => { +describe('Adspirit adapter tests', function () { let bidRequests, serverResponses; - beforeEach(() => { + beforeEach(function () { bidRequests = [ // valid for adspirit { @@ -89,36 +89,36 @@ describe('Adspirit adapter tests', () => { ] }); - describe('test bid request', () => { - it('with valid data 1', () => { + describe('test bid request', function () { + it('with valid data 1', function () { expect(spec.isBidRequestValid(bidRequests[0])).to.equal(true); }); - it('with valid data 2', () => { + it('with valid data 2', function () { expect(spec.isBidRequestValid(bidRequests[1])).to.equal(true); }); - it('with valid data 3', () => { + it('with valid data 3', function () { expect(spec.isBidRequestValid(bidRequests[2])).to.equal(true); }); - it('with invalid data 1 (no host)', () => { + it('with invalid data 1 (no host)', function () { expect(spec.isBidRequestValid(bidRequests[3])).to.equal(false); }); - it('with invalid data 2 (no placementId)', () => { + it('with invalid data 2 (no placementId)', function () { expect(spec.isBidRequestValid(bidRequests[4])).to.equal(false); }); - it('with invalid data 3 (no bidder code)', () => { + it('with invalid data 3 (no bidder code)', function () { expect(spec.isBidRequestValid(bidRequests[5])).to.equal(false); }); }); - describe('test request build', () => { - it('normal', () => { + describe('test request build', function () { + it('normal', function () { var requests = spec.buildRequests([bidRequests[0]]); expect(requests).to.be.lengthOf(1); }); }); - describe('test bid responses', () => { - it('success 1', () => { + describe('test bid responses', function () { + it('success 1', function () { var bids = spec.interpretResponse(serverResponses[0], {'bidRequest': bidRequests[0]}); expect(bids).to.be.lengthOf(1); expect(bids[0].cpm).to.equal(1.5); @@ -126,15 +126,15 @@ describe('Adspirit adapter tests', () => { expect(bids[0].height).to.equal(250); expect(bids[0].ad).to.have.length.above(1); }); - it('fail 1 (cpm=0)', () => { + it('fail 1 (cpm=0)', function () { var bids = spec.interpretResponse(serverResponses[1], {'bidRequest': bidRequests[0]}); expect(bids).to.be.lengthOf(0); }); - it('fail 2 (no response)', () => { + it('fail 2 (no response)', function () { var bids = spec.interpretResponse([], {'bidRequest': bidRequests[0]}); expect(bids).to.be.lengthOf(0); }); - it('fail 3 (status fail)', () => { + it('fail 3 (status fail)', function () { var bids = spec.interpretResponse(serverResponses[2], {'bidRequest': bidRequests[0]}); expect(bids).to.be.lengthOf(0); }); diff --git a/test/spec/modules/adtelligentBidAdapter_spec.js b/test/spec/modules/adtelligentBidAdapter_spec.js index fa3e0479372..6190f53fdc4 100644 --- a/test/spec/modules/adtelligentBidAdapter_spec.js +++ b/test/spec/modules/adtelligentBidAdapter_spec.js @@ -96,28 +96,28 @@ const displayEqResponse = [{ cpm: 0.9 }]; -describe('adtelligentBidAdapter', () => { +describe('adtelligentBidAdapter', function () { const adapter = newBidder(spec); - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { - it('should return true when required params found', () => { + describe('isBidRequestValid', function () { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(VIDEO_REQUEST)).to.equal(12345); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let bid = Object.assign({}, VIDEO_REQUEST); delete bid.params; expect(spec.isBidRequestValid(bid)).to.equal(undefined); }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let videoBidRequests = [VIDEO_REQUEST]; let displayBidRequests = [DISPLAY_REQUEST]; let videoAndDisplayBidRequests = [DISPLAY_REQUEST, VIDEO_REQUEST]; @@ -126,19 +126,19 @@ describe('adtelligentBidAdapter', () => { const videoRequest = spec.buildRequests(videoBidRequests, {}); const videoAndDisplayRequests = spec.buildRequests(videoAndDisplayBidRequests, {}); - it('sends bid request to ENDPOINT via GET', () => { + it('sends bid request to ENDPOINT via GET', function () { expect(videoRequest.method).to.equal('GET'); expect(displayRequest.method).to.equal('GET'); expect(videoAndDisplayRequests.method).to.equal('GET'); }); - it('sends bid request to correct ENDPOINT', () => { + it('sends bid request to correct ENDPOINT', function () { expect(videoRequest.url).to.equal(ENDPOINT); expect(displayRequest.url).to.equal(ENDPOINT); expect(videoAndDisplayRequests.url).to.equal(ENDPOINT); }); - it('sends correct video bid parameters', () => { + it('sends correct video bid parameters', function () { const bid = Object.assign({}, videoRequest.data); delete bid.domain; @@ -152,7 +152,7 @@ describe('adtelligentBidAdapter', () => { expect(bid).to.deep.equal(eq); }); - it('sends correct display bid parameters', () => { + it('sends correct display bid parameters', function () { const bid = Object.assign({}, displayRequest.data); delete bid.domain; @@ -166,7 +166,7 @@ describe('adtelligentBidAdapter', () => { expect(bid).to.deep.equal(eq); }); - it('sends correct video and display bid parameters', () => { + it('sends correct video and display bid parameters', function () { const bid = Object.assign({}, videoAndDisplayRequests.data); delete bid.domain; @@ -185,18 +185,18 @@ describe('adtelligentBidAdapter', () => { }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { let serverResponse; let bidderRequest; let eqResponse; - afterEach(() => { + afterEach(function () { serverResponse = null; bidderRequest = null; eqResponse = null; }); - it('should get correct video bid response', () => { + it('should get correct video bid response', function () { serverResponse = SERVER_VIDEO_RESPONSE; bidderRequest = videoBidderRequest; eqResponse = videoEqResponse; @@ -204,7 +204,7 @@ describe('adtelligentBidAdapter', () => { bidServerResponseCheck(); }); - it('should get correct display bid response', () => { + it('should get correct display bid response', function () { serverResponse = SERVER_DISPLAY_RESPONSE; bidderRequest = displayBidderRequest; eqResponse = displayEqResponse; @@ -225,13 +225,13 @@ describe('adtelligentBidAdapter', () => { expect(noBidResult.length).to.equal(0); } - it('handles video nobid responses', () => { + it('handles video nobid responses', function () { bidderRequest = videoBidderRequest; nobidServerResponseCheck(); }); - it('handles display nobid responses', () => { + it('handles display nobid responses', function () { bidderRequest = displayBidderRequest; nobidServerResponseCheck(); diff --git a/test/spec/modules/aduptechBidAdapter_spec.js b/test/spec/modules/aduptechBidAdapter_spec.js index 76689e9603f..da0b603ebfc 100644 --- a/test/spec/modules/aduptechBidAdapter_spec.js +++ b/test/spec/modules/aduptechBidAdapter_spec.js @@ -3,17 +3,17 @@ import { BIDDER_CODE, PUBLISHER_PLACEHOLDER, ENDPOINT_URL, ENDPOINT_METHOD, spec import { newBidder } from 'src/adapters/bidderFactory'; import * as utils from 'src/utils'; -describe('AduptechBidAdapter', () => { +describe('AduptechBidAdapter', function () { const adapter = newBidder(spec); - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { - it('should return true when necessary information is given', () => { + describe('isBidRequestValid', function () { + it('should return true when necessary information is given', function () { expect(spec.isBidRequestValid({ sizes: [[100, 200]], params: { @@ -23,11 +23,11 @@ describe('AduptechBidAdapter', () => { })).to.be.true; }); - it('should return false on empty bid', () => { + it('should return false on empty bid', function () { expect(spec.isBidRequestValid({})).to.be.false; }); - it('should return false on missing sizes', () => { + it('should return false on missing sizes', function () { expect(spec.isBidRequestValid({ params: { publisher: 'test', @@ -36,7 +36,7 @@ describe('AduptechBidAdapter', () => { })).to.be.false; }); - it('should return false on empty sizes', () => { + it('should return false on empty sizes', function () { expect(spec.isBidRequestValid({ sizes: [], params: { @@ -46,27 +46,27 @@ describe('AduptechBidAdapter', () => { })).to.be.false; }); - it('should return false on missing params', () => { + it('should return false on missing params', function () { expect(spec.isBidRequestValid({ sizes: [[100, 200]], })).to.be.false; }); - it('should return false on invalid params', () => { + it('should return false on invalid params', function () { expect(spec.isBidRequestValid({ sizes: [[100, 200]], params: 'bar' })).to.be.false; }); - it('should return false on empty params', () => { + it('should return false on empty params', function () { expect(spec.isBidRequestValid({ sizes: [[100, 200]], params: {} })).to.be.false; }); - it('should return false on missing publisher', () => { + it('should return false on missing publisher', function () { expect(spec.isBidRequestValid({ sizes: [[100, 200]], params: { @@ -75,7 +75,7 @@ describe('AduptechBidAdapter', () => { })).to.be.false; }); - it('should return false on missing placement', () => { + it('should return false on missing placement', function () { expect(spec.isBidRequestValid({ sizes: [[100, 200]], params: { @@ -85,8 +85,8 @@ describe('AduptechBidAdapter', () => { }); }); - describe('buildRequests', () => { - it('should send one bid request per ad unit to the endpoint via POST', () => { + describe('buildRequests', function () { + it('should send one bid request per ad unit to the endpoint via POST', function () { const bidRequests = [ { bidder: BIDDER_CODE, @@ -146,7 +146,7 @@ describe('AduptechBidAdapter', () => { }); }); - it('should pass gdpr informations', () => { + it('should pass gdpr informations', function () { const bidderRequest = { gdprConsent: { consentString: 'consentString', @@ -175,7 +175,7 @@ describe('AduptechBidAdapter', () => { expect(result[0].data.gdpr.consentString).to.exist.and.to.equal(bidderRequest.gdprConsent.consentString); }); - it('should encode publisher param in endpoint url', () => { + it('should encode publisher param in endpoint url', function () { const bidRequests = [ { bidder: BIDDER_CODE, @@ -196,13 +196,13 @@ describe('AduptechBidAdapter', () => { expect(result[0].url).to.equal(ENDPOINT_URL.replace(PUBLISHER_PLACEHOLDER, encodeURIComponent(bidRequests[0].params.publisher))); }); - it('should handle empty bidRequests', () => { + it('should handle empty bidRequests', function () { expect(spec.buildRequests([])).to.deep.equal([]); }); }); - describe('interpretResponse', () => { - it('should correctly interpret the server response', () => { + describe('interpretResponse', function () { + it('should correctly interpret the server response', function () { const serverResponse = { body: { bid: { @@ -238,11 +238,11 @@ describe('AduptechBidAdapter', () => { ]); }); - it('should handle empty serverResponse', () => { + it('should handle empty serverResponse', function () { expect(spec.interpretResponse({})).to.deep.equal([]); }); - it('should handle missing bid', () => { + it('should handle missing bid', function () { expect(spec.interpretResponse({ body: { creative: {} @@ -250,7 +250,7 @@ describe('AduptechBidAdapter', () => { })).to.deep.equal([]); }); - it('should handle missing creative', () => { + it('should handle missing creative', function () { expect(spec.interpretResponse({ body: { bid: {} diff --git a/test/spec/modules/adxcgAnalyticsAdapter_spec.js b/test/spec/modules/adxcgAnalyticsAdapter_spec.js index 9b6b057ee56..dfccbf6e87e 100644 --- a/test/spec/modules/adxcgAnalyticsAdapter_spec.js +++ b/test/spec/modules/adxcgAnalyticsAdapter_spec.js @@ -5,23 +5,23 @@ let adaptermanager = require('src/adaptermanager'); let events = require('src/events'); let constants = require('src/constants.json'); -describe('adxcg analytics adapter', () => { +describe('adxcg analytics adapter', function () { let xhr; let requests; - beforeEach(() => { + beforeEach(function () { xhr = sinon.useFakeXMLHttpRequest(); requests = []; xhr.onCreate = request => requests.push(request); sinon.stub(events, 'getEvents').returns([]); }); - afterEach(() => { + afterEach(function () { xhr.restore(); events.getEvents.restore(); }); - describe('track', () => { + describe('track', function () { let initOptions = { publisherId: '42' }; @@ -164,18 +164,18 @@ describe('adxcg analytics adapter', () => { adapter: adxcgAnalyticsAdapter }); - beforeEach(() => { + beforeEach(function () { adaptermanager.enableAnalytics({ provider: 'adxcg', options: initOptions }); }); - afterEach(() => { + afterEach(function () { adxcgAnalyticsAdapter.disableAnalytics(); }); - it('builds and sends auction data', () => { + it('builds and sends auction data', function () { // Step 1: Send auction init event events.emit(constants.EVENTS.AUCTION_INIT, { timestamp: auctionTimestamp diff --git a/test/spec/modules/adxcgBidAdapter_spec.js b/test/spec/modules/adxcgBidAdapter_spec.js index 60aadaec21f..faa8db8050a 100644 --- a/test/spec/modules/adxcgBidAdapter_spec.js +++ b/test/spec/modules/adxcgBidAdapter_spec.js @@ -2,8 +2,8 @@ import { expect } from 'chai' import * as url from 'src/url' import { spec } from 'modules/adxcgBidAdapter' -describe('AdxcgAdapter', () => { - describe('isBidRequestValid', () => { +describe('AdxcgAdapter', function () { + describe('isBidRequestValid', function () { let bidBanner = { 'bidder': 'adxcg', 'params': { @@ -37,22 +37,22 @@ describe('AdxcgAdapter', () => { 'auctionId': '1d1a030790a475', } - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bidBanner)).to.equal(true) }) - it('should return true when required params not found', () => { + it('should return true when required params not found', function () { expect(spec.isBidRequestValid({})).to.be.false }) - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let bid = Object.assign({}, bidBanner) delete bid.params bid.params = {} expect(spec.isBidRequestValid(bid)).to.equal(false) }) - it('should return true when required video params not found', () => { + it('should return true when required video params not found', function () { const simpleVideo = JSON.parse(JSON.stringify(bidVideo)) simpleVideo.params.adzoneid = 123 expect(spec.isBidRequestValid(simpleVideo)).to.be.false @@ -63,7 +63,7 @@ describe('AdxcgAdapter', () => { }) }) - describe('request function http', () => { + describe('request function http', function () { let bid = { 'bidder': 'adxcg', 'params': { @@ -76,7 +76,7 @@ describe('AdxcgAdapter', () => { 'auctionId': '1d1a030790a475', } - it('creates a valid adxcg request url', () => { + it('creates a valid adxcg request url', function () { let request = spec.buildRequests([bid]) expect(request).to.exist expect(request.method).to.equal('GET') @@ -96,7 +96,7 @@ describe('AdxcgAdapter', () => { }) }) - describe('gdpr compliance', () => { + describe('gdpr compliance', function () { let bid = { 'bidder': 'adxcg', 'params': { @@ -109,7 +109,7 @@ describe('AdxcgAdapter', () => { 'auctionId': '1d1a030790a475', } - it('should send GDPR Consent data if gdprApplies', () => { + it('should send GDPR Consent data if gdprApplies', function () { let request = spec.buildRequests([bid], {gdprConsent: {gdprApplies: true, consentString: 'consentDataString'}}) let parsedRequestUrl = url.parse(request.url) let query = parsedRequestUrl.search @@ -118,7 +118,7 @@ describe('AdxcgAdapter', () => { expect(query.gdpr_consent).to.equal('consentDataString') }) - it('should not send GDPR Consent data if gdprApplies is false or undefined', () => { + it('should not send GDPR Consent data if gdprApplies is false or undefined', function () { let request = spec.buildRequests([bid], { gdprConsent: { gdprApplies: false, @@ -133,7 +133,7 @@ describe('AdxcgAdapter', () => { }) }) - describe('response handler', () => { + describe('response handler', function () { let BIDDER_REQUEST = { 'bidder': 'adxcg', 'params': { @@ -245,7 +245,7 @@ describe('AdxcgAdapter', () => { header: {'someheader': 'fakedata'} } - it('handles regular responses', () => { + it('handles regular responses', function () { let result = spec.interpretResponse(BANNER_RESPONSE, BIDDER_REQUEST) expect(result).to.have.lengthOf(1) @@ -262,7 +262,7 @@ describe('AdxcgAdapter', () => { expect(result[0].dealId).to.not.exist }) - it('handles regular responses with dealid', () => { + it('handles regular responses with dealid', function () { let result = spec.interpretResponse(BANNER_RESPONSE_WITHDEALID, BIDDER_REQUEST) expect(result).to.have.lengthOf(1) @@ -277,7 +277,7 @@ describe('AdxcgAdapter', () => { expect(result[0].ttl).to.equal(300) }) - it('handles video responses', () => { + it('handles video responses', function () { let result = spec.interpretResponse(VIDEO_RESPONSE, BIDDER_REQUEST) expect(result).to.have.lengthOf(1) @@ -292,7 +292,7 @@ describe('AdxcgAdapter', () => { expect(result[0].ttl).to.equal(300) }) - it('handles native responses', () => { + it('handles native responses', function () { let result = spec.interpretResponse(NATIVE_RESPONSE, BIDDER_REQUEST) expect(result[0].width).to.equal(0) @@ -312,7 +312,7 @@ describe('AdxcgAdapter', () => { expect(result[0].native.sponsoredBy).to.equal('sponsoredByContent') }) - it('handles nobid responses', () => { + it('handles nobid responses', function () { let response = [] let bidderRequest = BIDDER_REQUEST @@ -321,12 +321,12 @@ describe('AdxcgAdapter', () => { }) }) - describe('getUserSyncs', () => { + describe('getUserSyncs', function () { let syncoptionsIframe = { 'iframeEnabled': 'true' } - it('should return iframe sync option', () => { + it('should return iframe sync option', function () { expect(spec.getUserSyncs(syncoptionsIframe)[0].type).to.equal('iframe') expect(spec.getUserSyncs(syncoptionsIframe)[0].url).to.equal('//cdn.adxcg.net/pb-sync.html') }) diff --git a/test/spec/modules/adyoulikeBidAdapter_spec.js b/test/spec/modules/adyoulikeBidAdapter_spec.js index d7a5b1a87b7..26898d3f57e 100644 --- a/test/spec/modules/adyoulikeBidAdapter_spec.js +++ b/test/spec/modules/adyoulikeBidAdapter_spec.js @@ -4,7 +4,7 @@ import { parse } from '../../../src/url'; import { spec } from 'modules/adyoulikeBidAdapter'; import { newBidder } from 'src/adapters/bidderFactory'; -describe('Adyoulike Adapter', () => { +describe('Adyoulike Adapter', function () { const canonicalUrl = 'http://canonical.url/?t=%26'; const defaultDC = 'hb-api'; const bidderCode = 'adyoulike'; @@ -136,13 +136,13 @@ describe('Adyoulike Adapter', () => { let getEndpoint = (dc = defaultDC) => `http://${dc}.omnitagjs.com/hb-api/prebid`; - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { 'bidId': 'bid_id_1', 'bidder': 'adyoulike', @@ -154,18 +154,18 @@ describe('Adyoulike Adapter', () => { 'transactionId': 'bid_id_1_transaction_id' }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let bid = Object.assign({}, bid); delete bid.size; expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -175,10 +175,10 @@ describe('Adyoulike Adapter', () => { }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let canonicalQuery; - beforeEach(() => { + beforeEach(function () { let canonical = document.createElement('link'); canonical.rel = 'canonical'; canonical.href = canonicalUrl; @@ -186,11 +186,11 @@ describe('Adyoulike Adapter', () => { canonicalQuery.withArgs('link[rel="canonical"][href]').returns(canonical); }); - afterEach(() => { + afterEach(function () { canonicalQuery.restore(); }); - it('should add gdpr consent information to the request', () => { + it('should add gdpr consent information to the request', function () { let consentString = 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A=='; let bidderRequest = { 'bidderCode': 'adyoulike', @@ -212,7 +212,7 @@ describe('Adyoulike Adapter', () => { expect(payload.gdprConsent.consentRequired).to.exist.and.to.be.true; }); - it('sends bid request to endpoint with single placement', () => { + it('sends bid request to endpoint with single placement', function () { const request = spec.buildRequests(bidRequestWithSinglePlacement); const payload = JSON.parse(request.data); @@ -226,7 +226,7 @@ describe('Adyoulike Adapter', () => { expect(payload.Bids['bid_id_0'].TransactionID).to.be.equal('bid_id_0_transaction_id'); }); - it('sends bid request to endpoint with single placement without canonical', () => { + it('sends bid request to endpoint with single placement without canonical', function () { canonicalQuery.restore(); const request = spec.buildRequests(bidRequestWithSinglePlacement); const payload = JSON.parse(request.data); @@ -241,7 +241,7 @@ describe('Adyoulike Adapter', () => { expect(payload.Bids['bid_id_0'].TransactionID).to.be.equal('bid_id_0_transaction_id'); }); - it('sends bid request to endpoint with multiple placements', () => { + it('sends bid request to endpoint with multiple placements', function () { const request = spec.buildRequests(bidRequestMultiPlacements); const payload = JSON.parse(request.data); expect(request.url).to.contain(getEndpoint()); @@ -261,7 +261,7 @@ describe('Adyoulike Adapter', () => { expect(payload.PageRefreshed).to.equal(false); }); - it('sends bid request to endpoint setted by parameters', () => { + it('sends bid request to endpoint setted by parameters', function () { const request = spec.buildRequests(bidRequestWithDCPlacement); const payload = JSON.parse(request.data); @@ -269,16 +269,16 @@ describe('Adyoulike Adapter', () => { }); }); // - describe('interpretResponse', () => { + describe('interpretResponse', function () { let serverResponse; - beforeEach(() => { + beforeEach(function () { serverResponse = { body: {} } }); - it('handles nobid responses', () => { + it('handles nobid responses', function () { let response = [{ BidID: '123dfsdf', Attempt: '32344fdse1', @@ -289,7 +289,7 @@ describe('Adyoulike Adapter', () => { expect(result).deep.equal([]); }); - it('receive reponse with single placement', () => { + it('receive reponse with single placement', function () { serverResponse.body = responseWithSinglePlacement; let result = spec.interpretResponse(serverResponse, bidRequestWithSinglePlacement); @@ -300,7 +300,7 @@ describe('Adyoulike Adapter', () => { expect(result[0].height).to.equal(300); }); - it('receive reponse with multiple placement', () => { + it('receive reponse with multiple placement', function () { serverResponse.body = responseWithMultiplePlacements; let result = spec.interpretResponse(serverResponse, bidRequestMultiPlacements); diff --git a/test/spec/modules/ajaBidAdapter_spec.js b/test/spec/modules/ajaBidAdapter_spec.js index c6a531c9f1f..5d5e5924cd5 100644 --- a/test/spec/modules/ajaBidAdapter_spec.js +++ b/test/spec/modules/ajaBidAdapter_spec.js @@ -3,10 +3,10 @@ import { newBidder } from 'src/adapters/bidderFactory'; const ENDPOINT = '//ad.as.amanad.adtdp.com/v2/prebid'; -describe('AjaAdapter', () => { +describe('AjaAdapter', function () { const adapter = newBidder(spec); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { 'bidder': 'aja', 'params': { @@ -19,11 +19,11 @@ describe('AjaAdapter', () => { 'auctionId': '1d1a030790a475', }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -33,7 +33,7 @@ describe('AjaAdapter', () => { }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let bidRequests = [ { 'bidder': 'aja', @@ -48,13 +48,13 @@ describe('AjaAdapter', () => { } ]; - it('sends bid request to ENDPOINT via GET', () => { + it('sends bid request to ENDPOINT via GET', function () { const requests = spec.buildRequests(bidRequests); expect(requests[0].url).to.equal(ENDPOINT); expect(requests[0].method).to.equal('GET'); }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { let response = { 'is_ad_return': true, 'ad': { @@ -77,7 +77,7 @@ describe('AjaAdapter', () => { ] }; - it('should get correct banner bid response', () => { + it('should get correct banner bid response', function () { let expectedResponse = [ { 'requestId': '51ef8751f9aead', @@ -99,7 +99,7 @@ describe('AjaAdapter', () => { expect(Object.keys(result[0])).to.have.members(Object.keys(expectedResponse[0])); }); - it('handles video responses', () => { + it('handles video responses', function () { let response = { 'is_ad_return': true, 'ad': { @@ -130,7 +130,7 @@ describe('AjaAdapter', () => { expect(result[0]).to.have.property('mediaType', 'video'); }); - it('handles nobid responses', () => { + it('handles nobid responses', function () { let response = { 'is_ad_return': false, 'ad': {} diff --git a/test/spec/modules/andbeyondBidAdapter_spec.js b/test/spec/modules/andbeyondBidAdapter_spec.js index 5e58101ef66..f9b0758749b 100644 --- a/test/spec/modules/andbeyondBidAdapter_spec.js +++ b/test/spec/modules/andbeyondBidAdapter_spec.js @@ -2,7 +2,7 @@ import {expect} from 'chai'; import {spec} from 'modules/andbeyondBidAdapter'; import * as utils from 'src/utils'; -describe('andbeyond adapter', () => { +describe('andbeyond adapter', function () { const bid1_zone1 = { bidder: 'andbeyond', bidId: 'Bid_01', @@ -80,29 +80,29 @@ describe('andbeyond adapter', () => { cur: 'USD' }; - describe('input parameters validation', () => { - it('empty request shouldn\'t generate exception', () => { + describe('input parameters validation', function () { + it('empty request shouldn\'t generate exception', function () { expect(spec.isBidRequestValid({ bidderCode: 'andbeyond' })).to.be.equal(false); }); - it('request without zone shouldn\'t issue a request', () => { + it('request without zone shouldn\'t issue a request', function () { expect(spec.isBidRequestValid(bid_without_zone)).to.be.equal(false); }); - it('request without host shouldn\'t issue a request', () => { + it('request without host shouldn\'t issue a request', function () { expect(spec.isBidRequestValid(bid_without_host)).to.be.equal(false); }); - it('empty request shouldn\'t generate exception', () => { + it('empty request shouldn\'t generate exception', function () { expect(spec.isBidRequestValid(bid_with_wrong_zoneId)).to.be.equal(false); }); }); - describe('banner request building', () => { + describe('banner request building', function () { let bidRequest; - before(() => { + before(function () { let wmock = sinon.stub(utils, 'getTopWindowLocation').callsFake(() => ({ protocol: 'https:', hostname: 'example.com', @@ -117,33 +117,33 @@ describe('andbeyond adapter', () => { dntmock.restore(); }); - it('should be a first-price auction', () => { + it('should be a first-price auction', function () { expect(bidRequest).to.have.property('at', 1); }); - it('should have banner object', () => { + it('should have banner object', function () { expect(bidRequest.imp[0]).to.have.property('banner'); }); - it('should have w/h', () => { + it('should have w/h', function () { expect(bidRequest.imp[0].banner).to.have.property('format'); expect(bidRequest.imp[0].banner.format).to.be.eql([{w: 300, h: 250}, {w: 300, h: 200}]); }); - it('should respect secure connection', () => { + it('should respect secure connection', function () { expect(bidRequest.imp[0]).to.have.property('secure', 1); }); - it('should have tagid', () => { + it('should have tagid', function () { expect(bidRequest.imp[0]).to.have.property('tagid', 'ad-unit-1'); }); - it('should create proper site block', () => { + it('should create proper site block', function () { expect(bidRequest.site).to.have.property('domain', 'example.com'); expect(bidRequest.site).to.have.property('page', 'https://example.com/index.html'); }); - it('should fill device with caller macro', () => { + it('should fill device with caller macro', function () { expect(bidRequest).to.have.property('device'); expect(bidRequest.device).to.have.property('ip', 'caller'); expect(bidRequest.device).to.have.property('ua', 'caller'); @@ -151,15 +151,15 @@ describe('andbeyond adapter', () => { }); }); - describe('requests routing', () => { - it('should issue a request for each host', () => { + describe('requests routing', function () { + it('should issue a request for each host', function () { let pbRequests = spec.buildRequests([bid1_zone1, bid3_host2]); expect(pbRequests).to.have.length(2); expect(pbRequests[0].url).to.have.string(`//${bid1_zone1.params.host}/`); expect(pbRequests[1].url).to.have.string(`//${bid3_host2.params.host}/`); }); - it('should issue a request for each zone', () => { + it('should issue a request for each zone', function () { let pbRequests = spec.buildRequests([bid1_zone1, bid2_zone2]); expect(pbRequests).to.have.length(2); expect(pbRequests[0].data.zone).to.be.equal(bid1_zone1.params.zoneId); @@ -167,8 +167,8 @@ describe('andbeyond adapter', () => { }); }); - describe('responses processing', () => { - it('should return fully-initialized banner bid-response', () => { + describe('responses processing', function () { + it('should return fully-initialized banner bid-response', function () { let request = spec.buildRequests([bid1_zone1])[0]; let resp = spec.interpretResponse({body: bidResponse1}, request)[0]; expect(resp).to.have.property('requestId', 'Bid_01'); @@ -183,20 +183,20 @@ describe('andbeyond adapter', () => { expect(resp.ad).to.have.string(''); }); - it('should add nurl as pixel for banner response', () => { + it('should add nurl as pixel for banner response', function () { let request = spec.buildRequests([bid1_zone1])[0]; let resp = spec.interpretResponse({body: bidResponse1}, request)[0]; let expectedNurl = bidResponse1.seatbid[0].bid[0].nurl + '&px=1'; expect(resp.ad).to.have.string(expectedNurl); }); - it('should handle bidresponse with user-sync only', () => { + it('should handle bidresponse with user-sync only', function () { let request = spec.buildRequests([bid1_zone1])[0]; let resp = spec.interpretResponse({body: usersyncOnlyResponse}, request); expect(resp).to.have.length(0); }); - it('should perform usersync', () => { + it('should perform usersync', function () { let syncs = spec.getUserSyncs({iframeEnabled: false}, [{body: bidResponse1}]); expect(syncs).to.have.length(0); syncs = spec.getUserSyncs({iframeEnabled: true}, [{body: bidResponse1}]); diff --git a/test/spec/modules/aolBidAdapter_spec.js b/test/spec/modules/aolBidAdapter_spec.js index bc42f69ce63..396ebf36c7d 100644 --- a/test/spec/modules/aolBidAdapter_spec.js +++ b/test/spec/modules/aolBidAdapter_spec.js @@ -75,7 +75,7 @@ let getPixels = () => { '\');'; }; -describe('AolAdapter', () => { +describe('AolAdapter', function () { const MARKETPLACE_URL = '//adserver-us.adtech.advertising.com/pubapi/3.0/'; const NEXAGE_URL = '//hb.nexage.com/bidRequest?'; const ONE_DISPLAY_TTL = 60; @@ -92,7 +92,7 @@ describe('AolAdapter', () => { return bidderRequest; } - describe('interpretResponse()', () => { + describe('interpretResponse()', function () { let bidderSettingsBackup; let bidResponse; let bidRequest; @@ -100,7 +100,7 @@ describe('AolAdapter', () => { let formatPixelsStub; let isOneMobileBidderStub; - beforeEach(() => { + beforeEach(function () { bidderSettingsBackup = $$PREBID_GLOBAL$$.bidderSettings; bidRequest = { bidderCode: 'test-bidder-code', @@ -115,14 +115,14 @@ describe('AolAdapter', () => { isOneMobileBidderStub = sinon.stub(spec, 'isOneMobileBidder'); }); - afterEach(() => { + afterEach(function () { $$PREBID_GLOBAL$$.bidderSettings = bidderSettingsBackup; logWarnSpy.restore(); formatPixelsStub.restore(); isOneMobileBidderStub.restore(); }); - it('should return formatted bid response with required properties', () => { + it('should return formatted bid response with required properties', function () { let formattedBidResponse = spec.interpretResponse(bidResponse, bidRequest); expect(formattedBidResponse).to.deep.equal({ bidderCode: bidRequest.bidderCode, @@ -140,7 +140,7 @@ describe('AolAdapter', () => { }); }); - it('should add pixels to ad content when pixels are present in the response', () => { + it('should add pixels to ad content when pixels are present in the response', function () { bidResponse.body.ext = { pixels: 'pixels-content' }; @@ -162,24 +162,24 @@ describe('AolAdapter', () => { }); }); - describe('buildRequests()', () => { - it('method exists and is a function', () => { + describe('buildRequests()', function () { + it('method exists and is a function', function () { expect(spec.buildRequests).to.exist.and.to.be.a('function'); }); - describe('Marketplace', () => { - it('should not return request when no bids are present', () => { + describe('Marketplace', function () { + it('should not return request when no bids are present', function () { let [request] = spec.buildRequests([]); expect(request).to.be.empty; }); - it('should return request for Marketplace endpoint', () => { + it('should return request for Marketplace endpoint', function () { let bidRequest = getDefaultBidRequest(); let [request] = spec.buildRequests(bidRequest.bids); expect(request.url).to.contain(MARKETPLACE_URL); }); - it('should return request for Marketplace via onedisplay bidder code', () => { + it('should return request for Marketplace via onedisplay bidder code', function () { let bidRequest = createCustomBidRequest({ bids: [{ bidder: 'onedisplay' @@ -233,7 +233,7 @@ describe('AolAdapter', () => { expect(request).to.be.empty; }); - it('should return Marketplace URL for eu region', () => { + it('should return Marketplace URL for eu region', function () { let bidRequest = createCustomBidRequest({ params: { placement: 1234567, @@ -245,7 +245,7 @@ describe('AolAdapter', () => { expect(request.url).to.contain('adserver-eu.adtech.advertising.com/pubapi/3.0/'); }); - it('should return Marketplace URL for eu region when server option is present', () => { + it('should return Marketplace URL for eu region when server option is present', function () { let bidRequest = createCustomBidRequest({ params: { placement: 1234567, @@ -257,7 +257,7 @@ describe('AolAdapter', () => { expect(request.url).to.contain('adserver-eu.adtech.advertising.com/pubapi/3.0/'); }); - it('should return default Marketplace URL in case of unknown region config option', () => { + it('should return default Marketplace URL in case of unknown region config option', function () { let bidRequest = createCustomBidRequest({ params: { placement: 1234567, @@ -269,25 +269,25 @@ describe('AolAdapter', () => { expect(request.url).to.contain(MARKETPLACE_URL); }); - it('should return url with pubapi bid option', () => { + it('should return url with pubapi bid option', function () { let bidRequest = getDefaultBidRequest(); let [request] = spec.buildRequests(bidRequest.bids); expect(request.url).to.contain('cmd=bid;'); }); - it('should return url with version 2 of pubapi', () => { + it('should return url with version 2 of pubapi', function () { let bidRequest = getDefaultBidRequest(); let [request] = spec.buildRequests(bidRequest.bids); expect(request.url).to.contain('v=2;'); }); - it('should return url with cache busting option', () => { + it('should return url with cache busting option', function () { let bidRequest = getDefaultBidRequest(); let [request] = spec.buildRequests(bidRequest.bids); expect(request.url).to.match(/misc=\d+/); }); - it('should return url with default pageId and sizeId', () => { + it('should return url with default pageId and sizeId', function () { let bidRequest = createCustomBidRequest({ params: { placement: 1234567, @@ -298,7 +298,7 @@ describe('AolAdapter', () => { expect(request.url).to.contain('/pubapi/3.0/9599.1/1234567/0/0/ADTECH;'); }); - it('should return url with custom pageId and sizeId when options are present', () => { + it('should return url with custom pageId and sizeId when options are present', function () { let bidRequest = createCustomBidRequest({ params: { placement: 1234567, @@ -311,13 +311,13 @@ describe('AolAdapter', () => { expect(request.url).to.contain('/pubapi/3.0/9599.1/1234567/1111/2222/ADTECH;'); }); - it('should return url with default alias if alias param is missing', () => { + it('should return url with default alias if alias param is missing', function () { let bidRequest = getDefaultBidRequest(); let [request] = spec.buildRequests(bidRequest.bids); expect(request.url).to.match(/alias=\w+?;/); }); - it('should return url with custom alias if it is present', () => { + it('should return url with custom alias if it is present', function () { let bidRequest = createCustomBidRequest({ params: { placement: 1234567, @@ -329,13 +329,13 @@ describe('AolAdapter', () => { expect(request.url).to.contain('alias=desktop_articlepage_something_box_300_250'); }); - it('should return url without bidfloor option if is is missing', () => { + it('should return url without bidfloor option if is is missing', function () { let bidRequest = getDefaultBidRequest(); let [request] = spec.buildRequests(bidRequest.bids); expect(request.url).not.to.contain('bidfloor='); }); - it('should return url with bidFloor option if it is present', () => { + it('should return url with bidFloor option if it is present', function () { let bidRequest = createCustomBidRequest({ params: { placement: 1234567, @@ -347,7 +347,7 @@ describe('AolAdapter', () => { expect(request.url).to.contain('bidfloor=0.8'); }); - it('should return url with key values if keyValues param is present', () => { + it('should return url with key values if keyValues param is present', function () { let bidRequest = createCustomBidRequest({ params: { placement: 1234567, @@ -363,7 +363,7 @@ describe('AolAdapter', () => { expect(request.url).to.contain('kvage=25;kvheight=3.42;kvtest=key'); }); - it('should return request object for One Display when configuration is present', () => { + it('should return request object for One Display when configuration is present', function () { let bidRequest = getDefaultBidRequest(); let [request] = spec.buildRequests(bidRequest.bids); expect(request.method).to.equal('GET'); @@ -371,8 +371,8 @@ describe('AolAdapter', () => { }); }); - describe('One Mobile', () => { - it('should return One Mobile url when One Mobile get params are present', () => { + describe('One Mobile', function () { + it('should return One Mobile url when One Mobile get params are present', function () { let bidRequest = createCustomBidRequest({ params: getNexageGetBidParams() }); @@ -380,7 +380,7 @@ describe('AolAdapter', () => { expect(request.url).to.contain(NEXAGE_URL); }); - it('should return One Mobile url with different host when host option is present', () => { + it('should return One Mobile url with different host when host option is present', function () { let bidParams = Object.assign({ host: 'qa-hb.nexage.com' }, getNexageGetBidParams()); @@ -391,7 +391,7 @@ describe('AolAdapter', () => { expect(request.url).to.contain('qa-hb.nexage.com/bidRequest?'); }); - it('should return One Mobile url when One Mobile and Marketplace params are present', () => { + it('should return One Mobile url when One Mobile and Marketplace params are present', function () { let bidParams = Object.assign(getNexageGetBidParams(), getMarketplaceBidParams()); let bidRequest = createCustomBidRequest({ params: bidParams @@ -425,7 +425,7 @@ describe('AolAdapter', () => { expect(request).to.be.empty; }); - it('should return One Mobile url with required params - dcn & pos', () => { + it('should return One Mobile url with required params - dcn & pos', function () { let bidRequest = createCustomBidRequest({ params: getNexageGetBidParams() }); @@ -433,7 +433,7 @@ describe('AolAdapter', () => { expect(request.url).to.contain(NEXAGE_URL + 'dcn=2c9d2b50015c5ce9db6aeeed8b9500d6&pos=header'); }); - it('should return One Mobile url with cmd=bid option', () => { + it('should return One Mobile url with cmd=bid option', function () { let bidRequest = createCustomBidRequest({ params: getNexageGetBidParams() }); @@ -441,7 +441,7 @@ describe('AolAdapter', () => { expect(request.url).to.contain('cmd=bid'); }); - it('should return One Mobile url with generic params if ext option is present', () => { + it('should return One Mobile url with generic params if ext option is present', function () { let bidRequest = createCustomBidRequest({ params: { dcn: '54321123', @@ -459,7 +459,7 @@ describe('AolAdapter', () => { '¶m1=val1¶m2=val2¶m3=val3¶m4=val4'); }); - it('should return request object for One Mobile POST endpoint when POST configuration is present', () => { + it('should return request object for One Mobile POST endpoint when POST configuration is present', function () { let bidConfig = getNexagePostBidParams(); let bidRequest = createCustomBidRequest({ params: bidConfig @@ -491,11 +491,11 @@ describe('AolAdapter', () => { }); }); - describe('getUserSyncs()', () => { + describe('getUserSyncs()', function () { let bidResponse; let bidRequest; - beforeEach(() => { + beforeEach(function () { $$PREBID_GLOBAL$$.aolGlobals.pixelsDropped = false; config.setConfig({ aol: { @@ -508,7 +508,7 @@ describe('AolAdapter', () => { }; }); - it('should return user syncs only if userSyncOn equals to "bidResponse"', () => { + it('should return user syncs only if userSyncOn equals to "bidResponse"', function () { let userSyncs = spec.getUserSyncs({}, [bidResponse], bidRequest); expect($$PREBID_GLOBAL$$.aolGlobals.pixelsDropped).to.be.true; @@ -518,7 +518,7 @@ describe('AolAdapter', () => { ]); }); - it('should not return user syncs if it has already been returned', () => { + it('should not return user syncs if it has already been returned', function () { $$PREBID_GLOBAL$$.aolGlobals.pixelsDropped = true; let userSyncs = spec.getUserSyncs({}, [bidResponse], bidRequest); @@ -527,7 +527,7 @@ describe('AolAdapter', () => { expect(userSyncs).to.deep.equal([]); }); - it('should not return user syncs if pixels are not present', () => { + it('should not return user syncs if pixels are not present', function () { bidResponse.ext.pixels = null; let userSyncs = spec.getUserSyncs({}, [bidResponse], bidRequest); @@ -537,8 +537,8 @@ describe('AolAdapter', () => { }); }); - describe('formatPixels()', () => { - it('should return pixels wrapped for dropping them once and within nested frames ', () => { + describe('formatPixels()', function () { + it('should return pixels wrapped for dropping them once and within nested frames ', function () { let pixels = ''; let formattedPixels = spec.formatPixels(pixels); @@ -553,30 +553,30 @@ describe('AolAdapter', () => { }); }); - describe('isOneMobileBidder()', () => { - it('should return false when when bidderCode is not present', () => { + describe('isOneMobileBidder()', function () { + it('should return false when when bidderCode is not present', function () { expect(spec.isOneMobileBidder(null)).to.be.false; }); - it('should return false for unknown bidder code', () => { + it('should return false for unknown bidder code', function () { expect(spec.isOneMobileBidder('unknownBidder')).to.be.false; }); - it('should return true for aol bidder code', () => { + it('should return true for aol bidder code', function () { expect(spec.isOneMobileBidder('aol')).to.be.true; }); - it('should return true for one mobile bidder code', () => { + it('should return true for one mobile bidder code', function () { expect(spec.isOneMobileBidder('onemobile')).to.be.true; }); }); - describe('isConsentRequired()', () => { - it('should return false when consentData object is not present', () => { + describe('isConsentRequired()', function () { + it('should return false when consentData object is not present', function () { expect(spec.isConsentRequired(null)).to.be.false; }); - it('should return true when gdprApplies equals true and consentString is not present', () => { + it('should return true when gdprApplies equals true and consentString is not present', function () { let consentData = { consentString: null, gdprApplies: true @@ -585,7 +585,7 @@ describe('AolAdapter', () => { expect(spec.isConsentRequired(consentData)).to.be.true; }); - it('should return false when consentString is present and gdprApplies equals false', () => { + it('should return false when consentString is present and gdprApplies equals false', function () { let consentData = { consentString: 'consent-string', gdprApplies: false @@ -594,7 +594,7 @@ describe('AolAdapter', () => { expect(spec.isConsentRequired(consentData)).to.be.false; }); - it('should return true when consentString is present and gdprApplies equals true', () => { + it('should return true when consentString is present and gdprApplies equals true', function () { let consentData = { consentString: 'consent-string', gdprApplies: true @@ -604,25 +604,25 @@ describe('AolAdapter', () => { }); }); - describe('formatMarketplaceDynamicParams()', () => { + describe('formatMarketplaceDynamicParams()', function () { let formatConsentDataStub; let formatKeyValuesStub; - beforeEach(() => { + beforeEach(function () { formatConsentDataStub = sinon.stub(spec, 'formatConsentData'); formatKeyValuesStub = sinon.stub(spec, 'formatKeyValues'); }); - afterEach(() => { + afterEach(function () { formatConsentDataStub.restore(); formatKeyValuesStub.restore(); }); - it('should return empty string when params are not present', () => { + it('should return empty string when params are not present', function () { expect(spec.formatMarketplaceDynamicParams()).to.be.equal(''); }); - it('should return formatted params when formatConsentData returns data', () => { + it('should return formatted params when formatConsentData returns data', function () { formatConsentDataStub.returns({ euconsent: 'test-consent', gdpr: 1 @@ -630,7 +630,7 @@ describe('AolAdapter', () => { expect(spec.formatMarketplaceDynamicParams()).to.be.equal('euconsent=test-consent;gdpr=1;'); }); - it('should return formatted params when formatKeyValues returns data', () => { + it('should return formatted params when formatKeyValues returns data', function () { formatKeyValuesStub.returns({ param1: 'val1', param2: 'val2', @@ -639,7 +639,7 @@ describe('AolAdapter', () => { expect(spec.formatMarketplaceDynamicParams()).to.be.equal('param1=val1;param2=val2;param3=val3;'); }); - it('should return formatted bid floor param when it is present', () => { + it('should return formatted bid floor param when it is present', function () { let params = { bidFloor: 0.45 }; @@ -647,25 +647,25 @@ describe('AolAdapter', () => { }); }); - describe('formatOneMobileDynamicParams()', () => { + describe('formatOneMobileDynamicParams()', function () { let consentRequiredStub; let secureProtocolStub; - beforeEach(() => { + beforeEach(function () { consentRequiredStub = sinon.stub(spec, 'isConsentRequired'); secureProtocolStub = sinon.stub(spec, 'isSecureProtocol'); }); - afterEach(() => { + afterEach(function () { consentRequiredStub.restore(); secureProtocolStub.restore(); }); - it('should return empty string when params are not present', () => { + it('should return empty string when params are not present', function () { expect(spec.formatOneMobileDynamicParams()).to.be.equal(''); }); - it('should return formatted params when params are present', () => { + it('should return formatted params when params are present', function () { let params = { param1: 'val1', param2: 'val2', @@ -674,7 +674,7 @@ describe('AolAdapter', () => { expect(spec.formatOneMobileDynamicParams(params)).to.contain('¶m1=val1¶m2=val2¶m3=val3'); }); - it('should return formatted gdpr params when isConsentRequired returns true', () => { + it('should return formatted gdpr params when isConsentRequired returns true', function () { let consentData = { consentString: 'test-consent' }; @@ -682,7 +682,7 @@ describe('AolAdapter', () => { expect(spec.formatOneMobileDynamicParams({}, consentData)).to.be.equal('&gdpr=1&euconsent=test-consent'); }); - it('should return formatted secure param when isSecureProtocol returns true', () => { + it('should return formatted secure param when isSecureProtocol returns true', function () { secureProtocolStub.returns(true); expect(spec.formatOneMobileDynamicParams()).to.be.equal('&secure=1'); }); diff --git a/test/spec/modules/appnexusBidAdapter_spec.js b/test/spec/modules/appnexusBidAdapter_spec.js index b65988e3ec1..d9e21a95f78 100644 --- a/test/spec/modules/appnexusBidAdapter_spec.js +++ b/test/spec/modules/appnexusBidAdapter_spec.js @@ -5,16 +5,16 @@ import { deepClone } from 'src/utils'; const ENDPOINT = '//ib.adnxs.com/ut/v3/prebid'; -describe('AppNexusAdapter', () => { +describe('AppNexusAdapter', function () { const adapter = newBidder(spec); - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { 'bidder': 'appnexus', 'params': { @@ -27,11 +27,11 @@ describe('AppNexusAdapter', () => { 'auctionId': '1d1a030790a475', }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return true when required params found', () => { + it('should return true when required params found', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -42,7 +42,7 @@ describe('AppNexusAdapter', () => { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -52,7 +52,7 @@ describe('AppNexusAdapter', () => { }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let bidRequests = [ { 'bidder': 'appnexus', @@ -67,7 +67,7 @@ describe('AppNexusAdapter', () => { } ]; - it('should parse out private sizes', () => { + it('should parse out private sizes', function () { let bidRequest = Object.assign({}, bidRequests[0], { @@ -85,7 +85,7 @@ describe('AppNexusAdapter', () => { expect(payload.tags[0].private_sizes).to.deep.equal([{width: 300, height: 250}]); }); - it('should add source and verison to the tag', () => { + it('should add source and verison to the tag', function () { const request = spec.buildRequests(bidRequests); const payload = JSON.parse(request.data); expect(payload.sdk).to.exist; @@ -95,7 +95,7 @@ describe('AppNexusAdapter', () => { }); }); - it('should populate the ad_types array on all requests', () => { + it('should populate the ad_types array on all requests', function () { ['banner', 'video', 'native'].forEach(type => { const bidRequest = Object.assign({}, bidRequests[0]); bidRequest.mediaTypes = {}; @@ -108,7 +108,7 @@ describe('AppNexusAdapter', () => { }); }); - it('should populate the ad_types array on outstream requests', () => { + it('should populate the ad_types array on outstream requests', function () { const bidRequest = Object.assign({}, bidRequests[0]); bidRequest.mediaTypes = {}; bidRequest.mediaTypes.video = {context: 'outstream'}; @@ -119,13 +119,13 @@ describe('AppNexusAdapter', () => { expect(payload.tags[0].ad_types).to.deep.equal(['video']); }); - it('sends bid request to ENDPOINT via POST', () => { + it('sends bid request to ENDPOINT via POST', function () { const request = spec.buildRequests(bidRequests); expect(request.url).to.equal(ENDPOINT); expect(request.method).to.equal('POST'); }); - it('should attach valid video params to the tag', () => { + it('should attach valid video params to the tag', function () { let bidRequest = Object.assign({}, bidRequests[0], { @@ -148,7 +148,7 @@ describe('AppNexusAdapter', () => { }); }); - it('should attach valid user params to the tag', () => { + it('should attach valid user params to the tag', function () { let bidRequest = Object.assign({}, bidRequests[0], { @@ -171,7 +171,7 @@ describe('AppNexusAdapter', () => { }); }); - it('should attach native params to the request', () => { + it('should attach native params to the request', function () { let bidRequest = Object.assign({}, bidRequests[0], { @@ -198,7 +198,7 @@ describe('AppNexusAdapter', () => { }); }); - it('sets minimum native asset params when not provided on adunit', () => { + it('sets minimum native asset params when not provided on adunit', function () { let bidRequest = Object.assign({}, bidRequests[0], { @@ -217,7 +217,7 @@ describe('AppNexusAdapter', () => { }); }); - it('does not overwrite native ad unit params with mimimum params', () => { + it('does not overwrite native ad unit params with mimimum params', function () { let bidRequest = Object.assign({}, bidRequests[0], { @@ -249,7 +249,7 @@ describe('AppNexusAdapter', () => { }); }); - it('should convert keyword params to proper form and attaches to request', () => { + it('should convert keyword params to proper form and attaches to request', function () { let bidRequest = Object.assign({}, bidRequests[0], { @@ -288,7 +288,7 @@ describe('AppNexusAdapter', () => { }]); }); - it('should add payment rules to the request', () => { + it('should add payment rules to the request', function () { let bidRequest = Object.assign({}, bidRequests[0], { @@ -305,7 +305,7 @@ describe('AppNexusAdapter', () => { expect(payload.tags[0].use_pmt_rule).to.equal(true); }); - it('should add gdpr consent information to the request', () => { + it('should add gdpr consent information to the request', function () { let consentString = 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A=='; let bidderRequest = { 'bidderCode': 'appnexus', @@ -327,7 +327,7 @@ describe('AppNexusAdapter', () => { expect(payload.gdpr_consent.consent_required).to.exist.and.to.be.true; }); - it('supports sending hybrid mobile app parameters', () => { + it('supports sending hybrid mobile app parameters', function () { let appRequest = Object.assign({}, bidRequests[0], { @@ -372,7 +372,7 @@ describe('AppNexusAdapter', () => { }); }) - describe('interpretResponse', () => { + describe('interpretResponse', function () { let response = { 'version': '3.0.0', 'tags': [ @@ -417,7 +417,7 @@ describe('AppNexusAdapter', () => { ] }; - it('should get correct bid response', () => { + it('should get correct bid response', function () { let expectedResponse = [ { 'requestId': '3db3773286ee59', @@ -441,7 +441,7 @@ describe('AppNexusAdapter', () => { expect(Object.keys(result[0])).to.have.members(Object.keys(expectedResponse[0])); }); - it('handles nobid responses', () => { + it('handles nobid responses', function () { let response = { 'version': '0.0.1', 'tags': [{ @@ -457,7 +457,7 @@ describe('AppNexusAdapter', () => { expect(result.length).to.equal(0); }); - it('handles non-banner media responses', () => { + it('handles non-banner media responses', function () { let response = { 'tags': [{ 'uuid': '84ab500420319d', @@ -481,7 +481,7 @@ describe('AppNexusAdapter', () => { expect(result[0]).to.have.property('mediaType', 'video'); }); - it('handles native responses', () => { + it('handles native responses', function () { let response1 = deepClone(response); response1.tags[0].ads[0].ad_type = 'native'; response1.tags[0].ads[0].rtb.native = { @@ -515,7 +515,7 @@ describe('AppNexusAdapter', () => { expect(result[0].native.image.url).to.equal('http://cdn.adnxs.com/img.png'); }); - it('supports configuring outstream renderers', () => { + it('supports configuring outstream renderers', function () { const outstreamResponse = deepClone(response); outstreamResponse.tags[0].ads[0].rtb.video = {}; outstreamResponse.tags[0].ads[0].renderer_url = 'renderer.js'; diff --git a/test/spec/modules/arteebeeBidAdapter_spec.js b/test/spec/modules/arteebeeBidAdapter_spec.js index 041b48b0bc9..013e1bd6c0c 100644 --- a/test/spec/modules/arteebeeBidAdapter_spec.js +++ b/test/spec/modules/arteebeeBidAdapter_spec.js @@ -1,9 +1,9 @@ import {expect} from 'chai'; import {spec} from 'modules/arteebeeBidAdapter'; -describe('Arteebee adapater', () => { - describe('Test validate req', () => { - it('should accept minimum valid bid', () => { +describe('Arteebee adapater', function () { + describe('Test validate req', function () { + it('should accept minimum valid bid', function () { let bid = { bidder: 'arteebee', params: { @@ -16,7 +16,7 @@ describe('Arteebee adapater', () => { expect(isValid).to.equal(true); }); - it('should reject missing pub', () => { + it('should reject missing pub', function () { let bid = { bidder: 'arteebee', params: { @@ -28,7 +28,7 @@ describe('Arteebee adapater', () => { expect(isValid).to.equal(false); }); - it('should reject missing source', () => { + it('should reject missing source', function () { let bid = { bidder: 'arteebee', params: { @@ -41,8 +41,8 @@ describe('Arteebee adapater', () => { }); }); - describe('Test build request', () => { - it('minimum request', () => { + describe('Test build request', function () { + it('minimum request', function () { let bid = { bidder: 'arteebee', params: { @@ -59,7 +59,7 @@ describe('Arteebee adapater', () => { expect(req.imp[0]).to.not.have.property('secure'); }); - it('make test request', () => { + it('make test request', function () { let bid = { bidder: 'arteebee', params: { @@ -77,7 +77,7 @@ describe('Arteebee adapater', () => { expect(req.imp[0]).to.not.have.property('secure'); }); - it('test coppa', () => { + it('test coppa', function () { let bid = { bidder: 'arteebee', params: { @@ -95,7 +95,7 @@ describe('Arteebee adapater', () => { expect(req.imp[0]).to.not.have.property('secure'); }); - it('test gdpr', () => { + it('test gdpr', function () { let bid = { bidder: 'arteebee', params: { @@ -124,8 +124,8 @@ describe('Arteebee adapater', () => { }); }); - describe('Test interpret response', () => { - it('General banner response', () => { + describe('Test interpret response', function () { + it('General banner response', function () { let resp = spec.interpretResponse({ body: { id: 'abcd', diff --git a/test/spec/modules/atomxBidAdapter_spec.js b/test/spec/modules/atomxBidAdapter_spec.js index fdbb01a1838..fdcdb55ec7f 100644 --- a/test/spec/modules/atomxBidAdapter_spec.js +++ b/test/spec/modules/atomxBidAdapter_spec.js @@ -1,9 +1,9 @@ import { expect } from 'chai'; import { spec } from 'modules/atomxBidAdapter'; -describe('atomxAdapterTest', () => { - describe('bidRequestValidity', () => { - it('bidRequest with id param', () => { +describe('atomxAdapterTest', function () { + describe('bidRequestValidity', function () { + it('bidRequest with id param', function () { expect(spec.isBidRequestValid({ bidder: 'atomx', params: { @@ -12,7 +12,7 @@ describe('atomxAdapterTest', () => { })).to.equal(true); }); - it('bidRequest with no id param', () => { + it('bidRequest with no id param', function () { expect(spec.isBidRequestValid({ bidder: 'atomx', params: { @@ -21,7 +21,7 @@ describe('atomxAdapterTest', () => { }); }); - describe('bidRequest', () => { + describe('bidRequest', function () { const bidRequests = [{ 'bidder': 'atomx', 'params': { @@ -47,21 +47,21 @@ describe('atomxAdapterTest', () => { 'auctionId': 'e97cafd0-ebfc-4f5c-b7c9-baa0fd335a4a' }]; - it('bidRequest HTTP method', () => { + it('bidRequest HTTP method', function () { const requests = spec.buildRequests(bidRequests); requests.forEach(function(requestItem) { expect(requestItem.method).to.equal('GET'); }); }); - it('bidRequest url', () => { + it('bidRequest url', function () { const requests = spec.buildRequests(bidRequests); requests.forEach(function(requestItem) { expect(requestItem.url).to.match(new RegExp('p\\.ato\\.mx/placement')); }); }); - it('bidRequest data', () => { + it('bidRequest data', function () { const requests = spec.buildRequests(bidRequests); expect(requests[0].data.id).to.equal('123'); expect(requests[0].data.size).to.equal('300x250'); @@ -72,7 +72,7 @@ describe('atomxAdapterTest', () => { }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { const bidRequest = { 'method': 'GET', 'url': 'https://p.ato.mx/placement', @@ -103,7 +103,7 @@ describe('atomxAdapterTest', () => { headers: {} }; - it('result is correct', () => { + it('result is correct', function () { const result = spec.interpretResponse(bidResponse, bidRequest); expect(result[0].requestId).to.equal('22aidtbx5eabd9'); diff --git a/test/spec/modules/audienceNetworkBidAdapter_spec.js b/test/spec/modules/audienceNetworkBidAdapter_spec.js index 3e6a890e4dc..9e3f37b7395 100644 --- a/test/spec/modules/audienceNetworkBidAdapter_spec.js +++ b/test/spec/modules/audienceNetworkBidAdapter_spec.js @@ -22,34 +22,34 @@ const requestId = 'test-request-id'; const debug = 'adapterver=1.0.1&platform=241394079772386&platver=$prebid.version$'; const pageUrl = encodeURIComponent(utils.getTopWindowUrl()); -describe('AudienceNetwork adapter', () => { - describe('Public API', () => { - it('code', () => { +describe('AudienceNetwork adapter', function () { + describe('Public API', function () { + it('code', function () { expect(code).to.equal(bidder); }); - it('supportedMediaTypes', () => { + it('supportedMediaTypes', function () { expect(supportedMediaTypes).to.deep.equal(['banner', 'video']); }); - it('isBidRequestValid', () => { + it('isBidRequestValid', function () { expect(isBidRequestValid).to.be.a('function'); }); - it('buildRequests', () => { + it('buildRequests', function () { expect(buildRequests).to.be.a('function'); }); - it('interpretResponse', () => { + it('interpretResponse', function () { expect(interpretResponse).to.be.a('function'); }); }); - describe('isBidRequestValid', () => { - it('missing placementId parameter', () => { + describe('isBidRequestValid', function () { + it('missing placementId parameter', function () { expect(isBidRequestValid({ bidder, sizes: [[300, 250]] })).to.equal(false); }); - it('invalid sizes parameter', () => { + it('invalid sizes parameter', function () { expect(isBidRequestValid({ bidder, sizes: ['', undefined, null, '300x100', [300, 100], [300], {}], @@ -57,7 +57,7 @@ describe('AudienceNetwork adapter', () => { })).to.equal(false); }); - it('valid when at least one valid size', () => { + it('valid when at least one valid size', function () { expect(isBidRequestValid({ bidder, sizes: [[1, 1], [300, 250]], @@ -65,7 +65,7 @@ describe('AudienceNetwork adapter', () => { })).to.equal(true); }); - it('valid parameters', () => { + it('valid parameters', function () { expect(isBidRequestValid({ bidder, sizes: [[300, 250], [320, 50]], @@ -73,7 +73,7 @@ describe('AudienceNetwork adapter', () => { })).to.equal(true); }); - it('fullwidth', () => { + it('fullwidth', function () { expect(isBidRequestValid({ bidder, sizes: [[300, 250], [336, 280]], @@ -84,7 +84,7 @@ describe('AudienceNetwork adapter', () => { })).to.equal(true); }); - it('native', () => { + it('native', function () { expect(isBidRequestValid({ bidder, sizes: [[300, 250]], @@ -95,7 +95,7 @@ describe('AudienceNetwork adapter', () => { })).to.equal(true); }); - it('native with non-IAB size', () => { + it('native with non-IAB size', function () { expect(isBidRequestValid({ bidder, sizes: [[728, 90]], @@ -106,7 +106,7 @@ describe('AudienceNetwork adapter', () => { })).to.equal(true); }); - it('video', () => { + it('video', function () { expect(isBidRequestValid({ bidder, sizes: [[playerwidth, playerheight]], @@ -118,17 +118,17 @@ describe('AudienceNetwork adapter', () => { }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let isSafariBrowserStub; - before(() => { + before(function () { isSafariBrowserStub = sinon.stub(utils, 'isSafariBrowser'); }); - after(() => { + after(function () { isSafariBrowserStub.restore(); }); - it('can build URL for IAB unit', () => { + it('can build URL for IAB unit', function () { expect(buildRequests([{ bidder, bidId: requestId, @@ -144,7 +144,7 @@ describe('AudienceNetwork adapter', () => { }]); }); - it('can build URL for video unit', () => { + it('can build URL for video unit', function () { expect(buildRequests([{ bidder, bidId: requestId, @@ -163,7 +163,7 @@ describe('AudienceNetwork adapter', () => { }]); }); - it('can build URL for native unit in non-IAB size', () => { + it('can build URL for native unit in non-IAB size', function () { expect(buildRequests([{ bidder, bidId: requestId, @@ -182,7 +182,7 @@ describe('AudienceNetwork adapter', () => { }]); }); - it('can build URL for fullwidth 300x250 unit, overriding platform', () => { + it('can build URL for fullwidth 300x250 unit, overriding platform', function () { const platform = 'test-platform'; const debugPlatform = debug.replace('241394079772386', platform); @@ -205,7 +205,7 @@ describe('AudienceNetwork adapter', () => { }]); }); - it('can build URL on Safari that includes a cachebuster param', () => { + it('can build URL on Safari that includes a cachebuster param', function () { isSafariBrowserStub.returns(true); expect(buildRequests([{ bidder, @@ -216,8 +216,8 @@ describe('AudienceNetwork adapter', () => { }); }); - describe('interpretResponse', () => { - it('error in response', () => { + describe('interpretResponse', function () { + it('error in response', function () { expect(interpretResponse({ body: { errors: ['test-error-message'] @@ -225,7 +225,7 @@ describe('AudienceNetwork adapter', () => { }, {})).to.deep.equal([]); }); - it('valid native bid in response', () => { + it('valid native bid in response', function () { const [bidResponse] = interpretResponse({ body: { errors: [], @@ -264,7 +264,7 @@ describe('AudienceNetwork adapter', () => { expect(bidResponse.fb_placementid).to.equal(placementId); }); - it('valid IAB bid in response', () => { + it('valid IAB bid in response', function () { const [bidResponse] = interpretResponse({ body: { errors: [], @@ -302,7 +302,7 @@ describe('AudienceNetwork adapter', () => { expect(bidResponse.fb_placementid).to.equal(placementId); }); - it('filters invalid slot sizes', () => { + it('filters invalid slot sizes', function () { const [bidResponse] = interpretResponse({ body: { errors: [], @@ -336,7 +336,7 @@ describe('AudienceNetwork adapter', () => { expect(bidResponse.fb_placementid).to.equal(placementId); }); - it('valid multiple bids in response', () => { + it('valid multiple bids in response', function () { const placementIdNative = 'test-placement-id-native'; const placementIdIab = 'test-placement-id-iab'; @@ -395,7 +395,7 @@ describe('AudienceNetwork adapter', () => { expect(bidResponseIab.fb_placementid).to.equal(placementIdIab); }); - it('valid video bid in response', () => { + it('valid video bid in response', function () { const bidId = 'test-bid-id-video'; const [bidResponse] = interpretResponse({ @@ -426,7 +426,7 @@ describe('AudienceNetwork adapter', () => { expect(bidResponse.height).to.equal(playerheight); }); - it('mixed video and native bids', () => { + it('mixed video and native bids', function () { const videoPlacementId = 'test-video-placement-id'; const videoBidId = 'test-video-bid-id'; const nativePlacementId = 'test-native-placement-id'; @@ -474,7 +474,7 @@ describe('AudienceNetwork adapter', () => { expect(bidResponseNative.ad).to.contain(`placementid:'${nativePlacementId}',format:'native',bidid:'${nativeBidId}'`); }); - it('mixture of valid native bid and error in response', () => { + it('mixture of valid native bid and error in response', function () { const [bidResponse] = interpretResponse({ body: { errors: ['test-error-message'], diff --git a/test/spec/modules/beachfrontBidAdapter_spec.js b/test/spec/modules/beachfrontBidAdapter_spec.js index fb149d59aee..a70fdfb77b6 100644 --- a/test/spec/modules/beachfrontBidAdapter_spec.js +++ b/test/spec/modules/beachfrontBidAdapter_spec.js @@ -2,10 +2,10 @@ import { expect } from 'chai'; import { spec, VIDEO_ENDPOINT, BANNER_ENDPOINT, OUTSTREAM_SRC, DEFAULT_MIMES } from 'modules/beachfrontBidAdapter'; import * as utils from 'src/utils'; -describe('BeachfrontAdapter', () => { +describe('BeachfrontAdapter', function () { let bidRequests; - beforeEach(() => { + beforeEach(function () { bidRequests = [ { bidder: 'beachfront', @@ -31,13 +31,13 @@ describe('BeachfrontAdapter', () => { ]; }); - describe('spec.isBidRequestValid', () => { - it('should return true when the required params are passed', () => { + describe('spec.isBidRequestValid', function () { + it('should return true when the required params are passed', function () { const bidRequest = bidRequests[0]; expect(spec.isBidRequestValid(bidRequest)).to.equal(true); }); - it('should return false when the "bidfloor" param is missing', () => { + it('should return false when the "bidfloor" param is missing', function () { const bidRequest = bidRequests[0]; bidRequest.params = { appId: '11bc5dd5-7421-4dd8-c926-40fa653bec76' @@ -45,7 +45,7 @@ describe('BeachfrontAdapter', () => { expect(spec.isBidRequestValid(bidRequest)).to.equal(false); }); - it('should return false when the "appId" param is missing', () => { + it('should return false when the "appId" param is missing', function () { const bidRequest = bidRequests[0]; bidRequest.params = { bidfloor: 5.00 @@ -53,19 +53,19 @@ describe('BeachfrontAdapter', () => { expect(spec.isBidRequestValid(bidRequest)).to.equal(false); }); - it('should return false when no bid params are passed', () => { + it('should return false when no bid params are passed', function () { const bidRequest = bidRequests[0]; bidRequest.params = {}; expect(spec.isBidRequestValid(bidRequest)).to.equal(false); }); - it('should return false when a bid request is not passed', () => { + it('should return false when a bid request is not passed', function () { expect(spec.isBidRequestValid()).to.equal(false); expect(spec.isBidRequestValid({})).to.equal(false); }); - describe('for multi-format bids', () => { - it('should return true when the required params are passed for video', () => { + describe('for multi-format bids', function () { + it('should return true when the required params are passed for video', function () { const bidRequest = bidRequests[0]; bidRequest.mediaTypes = { video: {} @@ -79,7 +79,7 @@ describe('BeachfrontAdapter', () => { expect(spec.isBidRequestValid(bidRequest)).to.equal(true); }); - it('should return false when the required params are missing for video', () => { + it('should return false when the required params are missing for video', function () { const bidRequest = bidRequests[0]; bidRequest.mediaTypes = { video: {} @@ -93,7 +93,7 @@ describe('BeachfrontAdapter', () => { expect(spec.isBidRequestValid(bidRequest)).to.equal(false); }); - it('should return true when the required params are passed for banner', () => { + it('should return true when the required params are passed for banner', function () { const bidRequest = bidRequests[0]; bidRequest.mediaTypes = { banner: {} @@ -107,7 +107,7 @@ describe('BeachfrontAdapter', () => { expect(spec.isBidRequestValid(bidRequest)).to.equal(true); }); - it('should return false when the required params are missing for banner', () => { + it('should return false when the required params are missing for banner', function () { const bidRequest = bidRequests[0]; bidRequest.mediaTypes = { banner: {} @@ -123,9 +123,9 @@ describe('BeachfrontAdapter', () => { }); }); - describe('spec.buildRequests', () => { - describe('for video bids', () => { - it('should attach the bid request object', () => { + describe('spec.buildRequests', function () { + describe('for video bids', function () { + it('should attach the bid request object', function () { bidRequests[0].mediaTypes = { video: {} }; bidRequests[1].mediaTypes = { video: {} }; const requests = spec.buildRequests(bidRequests); @@ -133,7 +133,7 @@ describe('BeachfrontAdapter', () => { expect(requests[1].bidRequest).to.equal(bidRequests[1]); }); - it('should create a POST request for each bid', () => { + it('should create a POST request for each bid', function () { const bidRequest = bidRequests[0]; bidRequest.mediaTypes = { video: {} }; const requests = spec.buildRequests([ bidRequest ]); @@ -141,7 +141,7 @@ describe('BeachfrontAdapter', () => { expect(requests[0].url).to.equal(VIDEO_ENDPOINT + bidRequest.params.appId); }); - it('should attach request data', () => { + it('should attach request data', function () { const width = 640; const height = 480; const bidRequest = bidRequests[0]; @@ -164,7 +164,7 @@ describe('BeachfrontAdapter', () => { expect(data.cur).to.deep.equal(['USD']); }); - it('must parse bid size from a nested array', () => { + it('must parse bid size from a nested array', function () { const width = 640; const height = 480; const bidRequest = bidRequests[0]; @@ -178,7 +178,7 @@ describe('BeachfrontAdapter', () => { expect(data.imp[0].video).to.deep.contain({ w: width, h: height }); }); - it('must parse bid size from a string', () => { + it('must parse bid size from a string', function () { const width = 640; const height = 480; const bidRequest = bidRequests[0]; @@ -192,7 +192,7 @@ describe('BeachfrontAdapter', () => { expect(data.imp[0].video).to.deep.contain({ w: width, h: height }); }); - it('must handle an empty bid size', () => { + it('must handle an empty bid size', function () { const bidRequest = bidRequests[0]; bidRequest.mediaTypes = { video: { @@ -204,7 +204,7 @@ describe('BeachfrontAdapter', () => { expect(data.imp[0].video).to.deep.contain({ w: undefined, h: undefined }); }); - it('must fall back to the size on the bid object', () => { + it('must fall back to the size on the bid object', function () { const width = 640; const height = 480; const bidRequest = bidRequests[0]; @@ -215,7 +215,7 @@ describe('BeachfrontAdapter', () => { expect(data.imp[0].video).to.deep.contain({ w: width, h: height }); }); - it('must override video targeting params', () => { + it('must override video targeting params', function () { const bidRequest = bidRequests[0]; const mimes = ['video/webm']; bidRequest.mediaTypes = { video: {} }; @@ -225,7 +225,7 @@ describe('BeachfrontAdapter', () => { expect(data.imp[0].video).to.deep.contain({ mimes }); }); - it('must add GDPR consent data to the request', () => { + it('must add GDPR consent data to the request', function () { const bidRequest = bidRequests[0]; bidRequest.mediaTypes = { video: {} }; const consentString = 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A=='; @@ -242,15 +242,15 @@ describe('BeachfrontAdapter', () => { }); }); - describe('for banner bids', () => { - it('should attach the bid requests array', () => { + describe('for banner bids', function () { + it('should attach the bid requests array', function () { bidRequests[0].mediaTypes = { banner: {} }; bidRequests[1].mediaTypes = { banner: {} }; const requests = spec.buildRequests(bidRequests); expect(requests[0].bidRequest).to.deep.equal(bidRequests); }); - it('should create a single POST request for all bids', () => { + it('should create a single POST request for all bids', function () { bidRequests[0].mediaTypes = { banner: {} }; bidRequests[1].mediaTypes = { banner: {} }; const requests = spec.buildRequests(bidRequests); @@ -259,7 +259,7 @@ describe('BeachfrontAdapter', () => { expect(requests[0].url).to.equal(BANNER_ENDPOINT); }); - it('should attach request data', () => { + it('should attach request data', function () { const width = 300; const height = 250; const bidRequest = bidRequests[0]; @@ -285,7 +285,7 @@ describe('BeachfrontAdapter', () => { expect(data.ua).to.equal(navigator.userAgent); }); - it('must parse bid size from a nested array', () => { + it('must parse bid size from a nested array', function () { const width = 300; const height = 250; const bidRequest = bidRequests[0]; @@ -301,7 +301,7 @@ describe('BeachfrontAdapter', () => { ]); }); - it('must parse bid size from a string', () => { + it('must parse bid size from a string', function () { const width = 300; const height = 250; const bidRequest = bidRequests[0]; @@ -317,7 +317,7 @@ describe('BeachfrontAdapter', () => { ]); }); - it('must handle an empty bid size', () => { + it('must handle an empty bid size', function () { const bidRequest = bidRequests[0]; bidRequest.mediaTypes = { banner: { @@ -329,7 +329,7 @@ describe('BeachfrontAdapter', () => { expect(data.slots[0].sizes).to.deep.equal([]); }); - it('must fall back to the size on the bid object', () => { + it('must fall back to the size on the bid object', function () { const width = 300; const height = 250; const bidRequest = bidRequests[0]; @@ -340,7 +340,7 @@ describe('BeachfrontAdapter', () => { expect(data.slots[0].sizes).to.deep.contain({ w: width, h: height }); }); - it('must add GDPR consent data to the request', () => { + it('must add GDPR consent data to the request', function () { const bidRequest = bidRequests[0]; bidRequest.mediaTypes = { banner: {} }; const consentString = 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A=='; @@ -357,8 +357,8 @@ describe('BeachfrontAdapter', () => { }); }); - describe('for multi-format bids', () => { - it('should create a POST request for each bid format', () => { + describe('for multi-format bids', function () { + it('should create a POST request for each bid format', function () { const width = 300; const height = 250; const bidRequest = bidRequests[0]; @@ -386,7 +386,7 @@ describe('BeachfrontAdapter', () => { expect(requests[1].url).to.contain(BANNER_ENDPOINT); }); - it('must parse bid sizes for each bid format', () => { + it('must parse bid sizes for each bid format', function () { const bidRequest = bidRequests[0]; bidRequest.mediaTypes = { video: { @@ -413,16 +413,16 @@ describe('BeachfrontAdapter', () => { }); }); - describe('spec.interpretResponse', () => { - describe('for video bids', () => { - it('should return no bids if the response is not valid', () => { + describe('spec.interpretResponse', function () { + describe('for video bids', function () { + it('should return no bids if the response is not valid', function () { const bidRequest = bidRequests[0]; bidRequest.mediaTypes = { video: {} }; const bidResponse = spec.interpretResponse({ body: null }, { bidRequest }); expect(bidResponse.length).to.equal(0); }); - it('should return no bids if the response "url" is missing', () => { + it('should return no bids if the response "url" is missing', function () { const bidRequest = bidRequests[0]; bidRequest.mediaTypes = { video: {} }; const serverResponse = { @@ -432,7 +432,7 @@ describe('BeachfrontAdapter', () => { expect(bidResponse.length).to.equal(0); }); - it('should return no bids if the response "bidPrice" is missing', () => { + it('should return no bids if the response "bidPrice" is missing', function () { const bidRequest = bidRequests[0]; bidRequest.mediaTypes = { video: {} }; const serverResponse = { @@ -442,7 +442,7 @@ describe('BeachfrontAdapter', () => { expect(bidResponse.length).to.equal(0); }); - it('should return a valid video bid response', () => { + it('should return a valid video bid response', function () { const width = 640; const height = 480; const bidRequest = bidRequests[0]; @@ -473,7 +473,7 @@ describe('BeachfrontAdapter', () => { }); }); - it('should return a renderer for outstream video bids', () => { + it('should return a renderer for outstream video bids', function () { const bidRequest = bidRequests[0]; bidRequest.mediaTypes = { video: { @@ -493,22 +493,22 @@ describe('BeachfrontAdapter', () => { }); }); - describe('for banner bids', () => { - it('should return no bids if the response is not valid', () => { + describe('for banner bids', function () { + it('should return no bids if the response is not valid', function () { const bidRequest = bidRequests[0]; bidRequest.mediaTypes = { banner: {} }; const bidResponse = spec.interpretResponse({ body: null }, { bidRequest }); expect(bidResponse.length).to.equal(0); }); - it('should return no bids if the response is empty', () => { + it('should return no bids if the response is empty', function () { const bidRequest = bidRequests[0]; bidRequest.mediaTypes = { banner: {} }; const bidResponse = spec.interpretResponse({ body: [] }, { bidRequest }); expect(bidResponse.length).to.equal(0); }); - it('should return valid banner bid responses', () => { + it('should return valid banner bid responses', function () { bidRequests[0].mediaTypes = { banner: { sizes: [[ 300, 250 ], [ 728, 90 ]] @@ -555,11 +555,11 @@ describe('BeachfrontAdapter', () => { }); }); - describe('spec.getUserSyncs', () => { - describe('for video bids', () => { + describe('spec.getUserSyncs', function () { + describe('for video bids', function () { let bidResponse; - beforeEach(() => { + beforeEach(function () { bidResponse = { bidPrice: 5.00, url: 'http://reachms.bfmio.com/getmu?aid=bid:19c4a196-fb21-4c81-9a1a-ecc5437a39da', @@ -567,7 +567,7 @@ describe('BeachfrontAdapter', () => { }; }); - it('should return an iframe user sync if iframes are enabled', () => { + it('should return an iframe user sync if iframes are enabled', function () { const syncOptions = { iframeEnabled: true, pixelEnabled: true @@ -580,7 +580,7 @@ describe('BeachfrontAdapter', () => { expect(userSyncs[0].type).to.equal('iframe'); }); - it('should return an image user sync if iframes are disabled', () => { + it('should return an image user sync if iframes are disabled', function () { const syncOptions = { iframeEnabled: false, pixelEnabled: true @@ -593,7 +593,7 @@ describe('BeachfrontAdapter', () => { expect(userSyncs[0].type).to.equal('image'); }); - it('should not return user syncs if none are enabled', () => { + it('should not return user syncs if none are enabled', function () { const syncOptions = { iframeEnabled: false, pixelEnabled: false @@ -606,10 +606,10 @@ describe('BeachfrontAdapter', () => { }); }); - describe('for banner bids', () => { + describe('for banner bids', function () { let bidResponse; - beforeEach(() => { + beforeEach(function () { bidResponse = { slot: bidRequests[0].adUnitCode, adm: '
', @@ -620,7 +620,7 @@ describe('BeachfrontAdapter', () => { }; }); - it('should return user syncs defined the bid response', () => { + it('should return user syncs defined the bid response', function () { const syncUrl = 'http://sync.bfmio.com/sync_iframe?ifpl=5&ifg=1&id=test&gdpr=0&gc=&gce=0'; const syncOptions = { iframeEnabled: true, @@ -638,7 +638,7 @@ describe('BeachfrontAdapter', () => { ]); }); - it('should not return user syncs if iframes are disabled', () => { + it('should not return user syncs if iframes are disabled', function () { const syncUrl = 'http://sync.bfmio.com/sync_iframe?ifpl=5&ifg=1&id=test&gdpr=0&gc=&gce=0'; const syncOptions = { iframeEnabled: false, @@ -654,7 +654,7 @@ describe('BeachfrontAdapter', () => { expect(userSyncs).to.deep.equal([]); }); - it('should not return user syncs if there are none in the bid response', () => { + it('should not return user syncs if there are none in the bid response', function () { const syncOptions = { iframeEnabled: true, pixelEnabled: true diff --git a/test/spec/modules/betweenBidAdapter_spec.js b/test/spec/modules/betweenBidAdapter_spec.js index a99417067f8..b1eea08a147 100644 --- a/test/spec/modules/betweenBidAdapter_spec.js +++ b/test/spec/modules/betweenBidAdapter_spec.js @@ -1,8 +1,8 @@ import { expect } from 'chai'; import { spec } from 'modules/betweenBidAdapter'; -describe('betweenBidAdapterTests', () => { - it('validate_pub_params', () => { +describe('betweenBidAdapterTests', function () { + it('validate_pub_params', function () { expect(spec.isBidRequestValid({ bidder: 'between', params: { @@ -13,7 +13,7 @@ describe('betweenBidAdapterTests', () => { } })).to.equal(true); }); - it('validate_generated_params', () => { + it('validate_generated_params', function () { let bidRequestData = [{ bidId: 'bid1234', bidder: 'between', @@ -24,7 +24,7 @@ describe('betweenBidAdapterTests', () => { let req_data = request[0].data; expect(req_data.bidid).to.equal('bid1234'); }); - it('validate_response_params', () => { + it('validate_response_params', function () { let serverResponse = { body: [{ bidid: 'bid1234', diff --git a/test/spec/modules/bizzclickBidAdapter_spec.js b/test/spec/modules/bizzclickBidAdapter_spec.js index 39587791bba..6f518f32ccf 100644 --- a/test/spec/modules/bizzclickBidAdapter_spec.js +++ b/test/spec/modules/bizzclickBidAdapter_spec.js @@ -1,7 +1,7 @@ import {expect} from 'chai'; import {spec} from '../../../modules/bizzclickBidAdapter'; -describe('BizzclickBidAdapter', () => { +describe('BizzclickBidAdapter', function () { let bid = { bidId: '67d581a232281d', bidder: 'bizzclickBidAdapter', @@ -16,31 +16,31 @@ describe('BizzclickBidAdapter', () => { transactionId: '3bb2f6da-87a6-4029-aeb0-1b244bbfb5' }; - describe('isBidRequestValid', () => { - it('Should return true when placement_id can be cast to a number', () => { + describe('isBidRequestValid', function () { + it('Should return true when placement_id can be cast to a number', function () { expect(spec.isBidRequestValid(bid)).to.be.true; }); - it('Should return false when placement_id is not a number', () => { + it('Should return false when placement_id is not a number', function () { bid.params.placementId = 'aaa'; expect(spec.isBidRequestValid(bid)).to.be.false; }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let serverRequest = spec.buildRequests([bid]); - it('Creates a ServerRequest object with method, URL and data', () => { + it('Creates a ServerRequest object with method, URL and data', function () { expect(serverRequest).to.exist; expect(serverRequest.method).to.exist; expect(serverRequest.url).to.exist; expect(serverRequest.data).to.exist; }); - it('Returns POST method', () => { + it('Returns POST method', function () { expect(serverRequest.method).to.equal('POST'); }); - it('Returns valid URL', () => { + it('Returns valid URL', function () { expect(serverRequest.url).to.equal('//supply.bizzclick.com/?c=o&m=multi'); }); - it('Returns valid data if array of bids is valid', () => { + it('Returns valid data if array of bids is valid', function () { let data = serverRequest.data; expect(data).to.be.an('object'); expect(data).to.have.all.keys('deviceWidth', 'deviceHeight', 'secure', 'host', 'page', 'placements'); @@ -59,13 +59,13 @@ describe('BizzclickBidAdapter', () => { expect(placement.sizes).to.be.an('array'); } }); - it('Returns empty data if no valid requests are passed', () => { + it('Returns empty data if no valid requests are passed', function () { serverRequest = spec.buildRequests([]); let data = serverRequest.data; expect(data.placements).to.be.an('array').that.is.empty; }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { let resObject = { body: [ { requestId: '123', @@ -81,7 +81,7 @@ describe('BizzclickBidAdapter', () => { }] }; let serverResponses = spec.interpretResponse(resObject); - it('Returns an array of valid server responses if response object is valid', () => { + it('Returns an array of valid server responses if response object is valid', function () { expect(serverResponses).to.be.an('array').that.is.not.empty; for (let i = 0; i < serverResponses.length; i++) { let dataItem = serverResponses[i]; @@ -97,16 +97,16 @@ describe('BizzclickBidAdapter', () => { expect(dataItem.currency).to.be.a('string'); expect(dataItem.mediaType).to.be.a('string'); } - it('Returns an empty array if invalid response is passed', () => { + it('Returns an empty array if invalid response is passed', function () { serverResponses = spec.interpretResponse('invalid_response'); expect(serverResponses).to.be.an('array').that.is.empty; }); }); }); - describe('getUserSyncs', () => { + describe('getUserSyncs', function () { let userSync = spec.getUserSyncs(); - it('Returns valid URL and type', () => { + it('Returns valid URL and type', function () { expect(userSync).to.be.an('array').with.lengthOf(1); expect(userSync[0].type).to.exist; expect(userSync[0].url).to.exist; diff --git a/test/spec/modules/brainyBidAdapter_spec.js b/test/spec/modules/brainyBidAdapter_spec.js index 157356e82db..a3ce90d927a 100644 --- a/test/spec/modules/brainyBidAdapter_spec.js +++ b/test/spec/modules/brainyBidAdapter_spec.js @@ -64,17 +64,17 @@ const invalidSyncBidResponse = [{ } }]; -describe('brainy Adapter', () => { - describe('request', () => { - it('should validate bid request', () => { +describe('brainy Adapter', function () { + describe('request', function () { + it('should validate bid request', function () { expect(spec.isBidRequestValid(validBidReq)).to.equal(true); }); - it('should not validate incorrect bid request', () => { + it('should not validate incorrect bid request', function () { expect(spec.isBidRequestValid(invalidBidReq)).to.equal(false); }); }); - describe('build request', () => { - it('Verify bid request', () => { + describe('build request', function () { + it('Verify bid request', function () { const request = spec.buildRequests(bidReq); expect(request[0].method).to.equal('GET'); expect(request[0].url).to.equal(URL); @@ -83,14 +83,14 @@ describe('brainy Adapter', () => { }); }); - describe('interpretResponse', () => { - it('should build bid array', () => { + describe('interpretResponse', function () { + it('should build bid array', function () { const request = spec.buildRequests(bidReq); const result = spec.interpretResponse({body: bidResponse}, request[0]); expect(result.length).to.equal(1); }); - it('should have all relevant fields', () => { + it('should have all relevant fields', function () { const request = spec.buildRequests(bidReq); const result = spec.interpretResponse({body: bidResponse}, request[0]); const bid = result[0]; @@ -101,25 +101,25 @@ describe('brainy Adapter', () => { }); }); - describe('spec.getUserSyncs', () => { + describe('spec.getUserSyncs', function () { let syncOptions - beforeEach(() => { + beforeEach(function () { syncOptions = { enabledBidders: ['brainy'], pixelEnabled: true } }); - it('sucess with usersync url', () => { + it('sucess with usersync url', function () { const result = []; result.push({type: 'image', url: '//testparm.com/ssp-sync/p/sync?uid=2110180601155125000059&buyer=2&slot=34'}); expect(spec.getUserSyncs(syncOptions, bidSyncResponse)).to.deep.equal(result); }); - it('sucess without usersync url', () => { + it('sucess without usersync url', function () { const result = []; expect(spec.getUserSyncs(syncOptions, invalidSyncBidResponse)).to.deep.equal(result); }); - it('empty response', () => { + it('empty response', function () { const serverResponse = [{body: {}}]; const result = []; expect(spec.getUserSyncs(syncOptions, serverResponse)).to.deep.equal(result); diff --git a/test/spec/modules/bridgewellBidAdapter_spec.js b/test/spec/modules/bridgewellBidAdapter_spec.js index 5dae3c474ac..6ca9675a1bb 100644 --- a/test/spec/modules/bridgewellBidAdapter_spec.js +++ b/test/spec/modules/bridgewellBidAdapter_spec.js @@ -169,13 +169,13 @@ describe('bridgewellBidAdapter', function () { ]; const adapter = newBidder(spec); - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bidWithoutCpmWeight = { 'bidder': 'bridgewell', 'params': { @@ -227,18 +227,18 @@ describe('bridgewellBidAdapter', function () { 'auctionId': '1d1a030790a475', }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bidWithoutCpmWeight)).to.equal(true); expect(spec.isBidRequestValid(bidWithCorrectCpmWeight)).to.equal(true); expect(spec.isBidRequestValid(bidWithUncorrectCpmWeight)).to.equal(false); expect(spec.isBidRequestValid(bidWithZeroCpmWeight)).to.equal(false); }); - it('should return false when required params not found', () => { + it('should return false when required params not found', function () { expect(spec.isBidRequestValid({})).to.equal(false); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let bidWithoutCpmWeight = Object.assign({}, bidWithoutCpmWeight); let bidWithCorrectCpmWeight = Object.assign({}, bidWithCorrectCpmWeight); let bidWithUncorrectCpmWeight = Object.assign({}, bidWithUncorrectCpmWeight); @@ -272,8 +272,8 @@ describe('bridgewellBidAdapter', function () { }); }); - describe('buildRequests', () => { - it('should attach valid params to the tag', () => { + describe('buildRequests', function () { + it('should attach valid params to the tag', function () { const request = spec.buildRequests(bidRequests); const payload = request.data; const adUnits = payload.adUnits; @@ -286,14 +286,14 @@ describe('bridgewellBidAdapter', function () { } }); - it('should attach validBidRequests to the tag', () => { + it('should attach validBidRequests to the tag', function () { const request = spec.buildRequests(bidRequests); const validBidRequests = request.validBidRequests; expect(validBidRequests).to.deep.equal(bidRequests); }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { const request = spec.buildRequests(bidRequests); const serverResponses = [ { @@ -440,7 +440,7 @@ describe('bridgewellBidAdapter', function () { } ]; - it('should return all required parameters', () => { + it('should return all required parameters', function () { const result = spec.interpretResponse({'body': serverResponses}, request); result.every(res => expect(res.cpm).to.be.a('number')); result.every(res => expect(res.width).to.be.a('number')); @@ -457,12 +457,12 @@ describe('bridgewellBidAdapter', function () { }); }); - it('should give up bid if server response is undefiend', () => { + it('should give up bid if server response is undefiend', function () { const result = spec.interpretResponse({'body': undefined}, request); expect(result).to.deep.equal([]); }); - it('should give up bid if request sizes is missing', () => { + it('should give up bid if request sizes is missing', function () { let target = Object.assign({}, serverResponses[0]); target.consumed = false; const result = spec.interpretResponse({'body': [target]}, spec.buildRequests([{ @@ -478,7 +478,7 @@ describe('bridgewellBidAdapter', function () { expect(result).to.deep.equal([]); }); - it('should give up bid if response sizes is invalid', () => { + it('should give up bid if response sizes is invalid', function () { let target = { 'id': 'e5b10774-32bf-4931-85ee-05095e8cff21', 'bidder_code': 'bridgewell', @@ -495,7 +495,7 @@ describe('bridgewellBidAdapter', function () { expect(result).to.deep.equal([]); }); - it('should give up bid if cpm is missing', () => { + it('should give up bid if cpm is missing', function () { let target = { 'id': 'e5b10774-32bf-4931-85ee-05095e8cff21', 'bidder_code': 'bridgewell', @@ -511,7 +511,7 @@ describe('bridgewellBidAdapter', function () { expect(result).to.deep.equal([]); }); - it('should give up bid if width or height is missing', () => { + it('should give up bid if width or height is missing', function () { let target = { 'id': 'e5b10774-32bf-4931-85ee-05095e8cff21', 'bidder_code': 'bridgewell', @@ -526,7 +526,7 @@ describe('bridgewellBidAdapter', function () { expect(result).to.deep.equal([]); }); - it('should give up bid if ad is missing', () => { + it('should give up bid if ad is missing', function () { let target = { 'id': 'e5b10774-32bf-4931-85ee-05095e8cff21', 'bidder_code': 'bridgewell', @@ -543,7 +543,7 @@ describe('bridgewellBidAdapter', function () { expect(result).to.deep.equal([]); }); - it('should give up bid if revenue mode is missing', () => { + it('should give up bid if revenue mode is missing', function () { let target = { 'id': 'e5b10774-32bf-4931-85ee-05095e8cff21', 'bidder_code': 'bridgewell', @@ -559,7 +559,7 @@ describe('bridgewellBidAdapter', function () { expect(result).to.deep.equal([]); }); - it('should give up bid if currency is missing', () => { + it('should give up bid if currency is missing', function () { let target = { 'id': 'e5b10774-32bf-4931-85ee-05095e8cff21', 'bidder_code': 'bridgewell', @@ -575,7 +575,7 @@ describe('bridgewellBidAdapter', function () { expect(result).to.deep.equal([]); }); - it('should give up bid if mediaType is missing', () => { + it('should give up bid if mediaType is missing', function () { let target = { 'id': 'e5b10774-32bf-4931-85ee-05095e8cff21', 'bidder_code': 'bridgewell', @@ -592,7 +592,7 @@ describe('bridgewellBidAdapter', function () { expect(result).to.deep.equal([]); }); - it('should give up bid if property native of mediaType native is missing', () => { + it('should give up bid if property native of mediaType native is missing', function () { let target = { 'id': '0e4048d3-5c74-4380-a21a-00ba35629f7d', 'bidder_code': 'bridgewell', @@ -609,7 +609,7 @@ describe('bridgewellBidAdapter', function () { expect(result).to.deep.equal([]); }); - it('should give up bid if native title is missing', () => { + it('should give up bid if native title is missing', function () { let target = { 'id': '0e4048d3-5c74-4380-a21a-00ba35629f7d', 'bidder_code': 'bridgewell', @@ -643,7 +643,7 @@ describe('bridgewellBidAdapter', function () { expect(result).to.deep.equal([]); }); - it('should give up bid if native title is too long', () => { + it('should give up bid if native title is too long', function () { let target = { 'id': '0e4048d3-5c74-4380-a21a-00ba35629f7d', 'bidder_code': 'bridgewell', @@ -678,7 +678,7 @@ describe('bridgewellBidAdapter', function () { expect(result).to.deep.equal([]); }); - it('should give up bid if native body is missing', () => { + it('should give up bid if native body is missing', function () { let target = { 'id': '0e4048d3-5c74-4380-a21a-00ba35629f7d', 'bidder_code': 'bridgewell', @@ -711,7 +711,7 @@ describe('bridgewellBidAdapter', function () { const result = spec.interpretResponse({'body': [target]}, request); expect(result).to.deep.equal([]); - it('should give up bid if native image url is missing', () => { + it('should give up bid if native image url is missing', function () { let target = { 'id': '0e4048d3-5c74-4380-a21a-00ba35629f7d', 'bidder_code': 'bridgewell', @@ -746,7 +746,7 @@ describe('bridgewellBidAdapter', function () { }); }); - it('should give up bid if native image is missing', () => { + it('should give up bid if native image is missing', function () { let target = { 'id': '0e4048d3-5c74-4380-a21a-00ba35629f7d', 'bidder_code': 'bridgewell', @@ -776,7 +776,7 @@ describe('bridgewellBidAdapter', function () { expect(result).to.deep.equal([]); }); - it('should give up bid if native image url is missing', () => { + it('should give up bid if native image url is missing', function () { let target = { 'id': '0e4048d3-5c74-4380-a21a-00ba35629f7d', 'bidder_code': 'bridgewell', @@ -808,7 +808,7 @@ describe('bridgewellBidAdapter', function () { expect(result).to.deep.equal([]); }); - it('should give up bid if native image sizes is unmatch', () => { + it('should give up bid if native image sizes is unmatch', function () { let target = { 'id': '0e4048d3-5c74-4380-a21a-00ba35629f7d', 'bidder_code': 'bridgewell', @@ -841,7 +841,7 @@ describe('bridgewellBidAdapter', function () { expect(result).to.deep.equal([]); }); - it('should give up bid if native sponsoredBy is missing', () => { + it('should give up bid if native sponsoredBy is missing', function () { let target = { 'id': '0e4048d3-5c74-4380-a21a-00ba35629f7d', 'bidder_code': 'bridgewell', @@ -875,7 +875,7 @@ describe('bridgewellBidAdapter', function () { expect(result).to.deep.equal([]); }); - it('should give up bid if native icon is missing', () => { + it('should give up bid if native icon is missing', function () { let target = { 'id': '0e4048d3-5c74-4380-a21a-00ba35629f7d', 'bidder_code': 'bridgewell', @@ -905,7 +905,7 @@ describe('bridgewellBidAdapter', function () { expect(result).to.deep.equal([]); }); - it('should give up bid if native icon url is missing', () => { + it('should give up bid if native icon url is missing', function () { let target = { 'id': '0e4048d3-5c74-4380-a21a-00ba35629f7d', 'bidder_code': 'bridgewell', @@ -939,7 +939,7 @@ describe('bridgewellBidAdapter', function () { expect(result).to.deep.equal([]); }); - it('should give up bid if native icon sizes is unmatch', () => { + it('should give up bid if native icon sizes is unmatch', function () { let target = { 'id': '0e4048d3-5c74-4380-a21a-00ba35629f7d', 'bidder_code': 'bridgewell', @@ -972,7 +972,7 @@ describe('bridgewellBidAdapter', function () { expect(result).to.deep.equal([]); }); - it('should give up bid if native clickUrl is missing', () => { + it('should give up bid if native clickUrl is missing', function () { let target = { 'id': '0e4048d3-5c74-4380-a21a-00ba35629f7d', 'bidder_code': 'bridgewell', @@ -1006,7 +1006,7 @@ describe('bridgewellBidAdapter', function () { expect(result).to.deep.equal([]); }); - it('should give up bid if native clickTrackers is missing', () => { + it('should give up bid if native clickTrackers is missing', function () { let target = { 'id': '0e4048d3-5c74-4380-a21a-00ba35629f7d', 'bidder_code': 'bridgewell', @@ -1040,7 +1040,7 @@ describe('bridgewellBidAdapter', function () { expect(result).to.deep.equal([]); }); - it('should give up bid if native clickTrackers is empty', () => { + it('should give up bid if native clickTrackers is empty', function () { let target = { 'id': '0e4048d3-5c74-4380-a21a-00ba35629f7d', 'bidder_code': 'bridgewell', @@ -1075,7 +1075,7 @@ describe('bridgewellBidAdapter', function () { expect(result).to.deep.equal([]); }); - it('should give up bid if native impressionTrackers is missing', () => { + it('should give up bid if native impressionTrackers is missing', function () { let target = { 'id': '0e4048d3-5c74-4380-a21a-00ba35629f7d', 'bidder_code': 'bridgewell', @@ -1109,7 +1109,7 @@ describe('bridgewellBidAdapter', function () { expect(result).to.deep.equal([]); }); - it('should give up bid if native impressionTrackers is empty', () => { + it('should give up bid if native impressionTrackers is empty', function () { let target = { 'id': '0e4048d3-5c74-4380-a21a-00ba35629f7d', 'bidder_code': 'bridgewell', @@ -1144,7 +1144,7 @@ describe('bridgewellBidAdapter', function () { expect(result).to.deep.equal([]); }); - it('should give up bid if mediaType is not support', () => { + it('should give up bid if mediaType is not support', function () { let target = { 'id': '0e4048d3-5c74-4380-a21a-00ba35629f7d', 'bidder_code': 'bridgewell', diff --git a/test/spec/modules/c1xBidAdapter_spec.js b/test/spec/modules/c1xBidAdapter_spec.js index bd7fa5df669..268ad46d0ce 100644 --- a/test/spec/modules/c1xBidAdapter_spec.js +++ b/test/spec/modules/c1xBidAdapter_spec.js @@ -5,16 +5,16 @@ import { newBidder } from 'src/adapters/bidderFactory'; const ENDPOINT = 'https://ht.c1exchange.com/ht'; const BIDDER_CODE = 'c1x'; -describe('C1XAdapter', () => { +describe('C1XAdapter', function () { const adapter = newBidder(c1xAdapter); - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { 'bidder': BIDDER_CODE, 'adUnitCode': 'adunit-code', @@ -24,11 +24,11 @@ describe('C1XAdapter', () => { } }; - it('should return true when required params are passed', () => { + it('should return true when required params are passed', function () { expect(c1xAdapter.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when required params are not found', () => { + it('should return false when required params are not found', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -38,7 +38,7 @@ describe('C1XAdapter', () => { }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let bidRequests = [ { 'bidder': BIDDER_CODE, @@ -61,19 +61,19 @@ describe('C1XAdapter', () => { return parsedData; }; - it('sends bid request to ENDPOINT via GET', () => { + it('sends bid request to ENDPOINT via GET', function () { const request = c1xAdapter.buildRequests(bidRequests); expect(request.url).to.equal(ENDPOINT); expect(request.method).to.equal('GET'); }); - it('should generate correct bid Id tag', () => { + it('should generate correct bid Id tag', function () { const request = c1xAdapter.buildRequests(bidRequests); expect(request.bids[0].adUnitCode).to.equal('adunit-code'); expect(request.bids[0].bidId).to.equal('30b31c1838de1e'); }); - it('should convert params to proper form and attach to request', () => { + it('should convert params to proper form and attach to request', function () { const request = c1xAdapter.buildRequests(bidRequests); const originalPayload = parseRequest(request.data); const payloadObj = JSON.parse(originalPayload); @@ -83,7 +83,7 @@ describe('C1XAdapter', () => { expect(payloadObj.site).to.equal('9999'); }); - it('should convert floor price to proper form and attach to request', () => { + it('should convert floor price to proper form and attach to request', function () { let bidRequest = Object.assign({}, bidRequests[0], { @@ -100,7 +100,7 @@ describe('C1XAdapter', () => { expect(payloadObj.a1p).to.equal('4.35'); }); - it('should convert pageurl to proper form and attach to request', () => { + it('should convert pageurl to proper form and attach to request', function () { let bidRequest = Object.assign({}, bidRequests[0], { @@ -115,7 +115,7 @@ describe('C1XAdapter', () => { expect(payloadObj.pageurl).to.equal('http://c1exchange.com/'); }); - it('should convert GDPR Consent to proper form and attach to request', () => { + it('should convert GDPR Consent to proper form and attach to request', function () { let consentString = 'BOP2gFWOQIFovABABAENBGAAAAAAMw'; let bidderRequest = { 'bidderCode': 'c1x', @@ -134,7 +134,7 @@ describe('C1XAdapter', () => { }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { let response = { 'bid': true, 'cpm': 1.5, @@ -146,7 +146,7 @@ describe('C1XAdapter', () => { 'bidType': 'GROSS_BID' }; - it('should get correct bid response', () => { + it('should get correct bid response', function () { let expectedResponse = [ { width: 300, @@ -169,7 +169,7 @@ describe('C1XAdapter', () => { expect(Object.keys(result[0])).to.have.members(Object.keys(expectedResponse[0])); }); - it('handles nobid responses', () => { + it('handles nobid responses', function () { let response = { bid: false, adId: 'c1x-test' diff --git a/test/spec/modules/ccxBidAdapter_spec.js b/test/spec/modules/ccxBidAdapter_spec.js index 535b3906a27..292503c9e04 100644 --- a/test/spec/modules/ccxBidAdapter_spec.js +++ b/test/spec/modules/ccxBidAdapter_spec.js @@ -2,7 +2,7 @@ import { expect } from 'chai'; import { spec } from 'modules/ccxBidAdapter'; import * as utils from 'src/utils'; -describe('ccxAdapter', () => { +describe('ccxAdapter', function () { let bids = [ { adUnitCode: 'banner', @@ -39,17 +39,17 @@ describe('ccxAdapter', () => { transactionId: 'aefddd38-cfa0-48ab-8bdd-325de4bab5f9' } ]; - describe('isBidRequestValid', () => { - it('Valid bid requests', () => { + describe('isBidRequestValid', function () { + it('Valid bid requests', function () { expect(spec.isBidRequestValid(bids[0])).to.be.true; expect(spec.isBidRequestValid(bids[1])).to.be.true; }); - it('Invalid bid reqeusts - no placementId', () => { + it('Invalid bid reqeusts - no placementId', function () { let bidsClone = utils.deepClone(bids); bidsClone[0].params = undefined; expect(spec.isBidRequestValid(bidsClone[0])).to.be.false; }); - it('Invalid bid reqeusts - invalid banner sizes', () => { + it('Invalid bid reqeusts - invalid banner sizes', function () { let bidsClone = utils.deepClone(bids); bidsClone[0].mediaTypes.banner.sizes = [300, 250]; expect(spec.isBidRequestValid(bidsClone[0])).to.be.false; @@ -58,14 +58,14 @@ describe('ccxAdapter', () => { bidsClone[0].mediaTypes.banner.sizes = []; expect(spec.isBidRequestValid(bidsClone[0])).to.be.false; }); - it('Invalid bid reqeusts - invalid video sizes', () => { + it('Invalid bid reqeusts - invalid video sizes', function () { let bidsClone = utils.deepClone(bids); bidsClone[1].mediaTypes.video.playerSize = []; expect(spec.isBidRequestValid(bidsClone[1])).to.be.false; bidsClone[1].mediaTypes.video.sizes = [640, 480]; expect(spec.isBidRequestValid(bidsClone[1])).to.be.false; }); - it('Valid bid reqeust - old style sizes', () => { + it('Valid bid reqeust - old style sizes', function () { let bidsClone = utils.deepClone(bids); delete (bidsClone[0].mediaTypes); delete (bidsClone[1].mediaTypes); diff --git a/test/spec/modules/clickforceBidAdapter_spec.js b/test/spec/modules/clickforceBidAdapter_spec.js index c09b69a6320..3d4fc70c057 100644 --- a/test/spec/modules/clickforceBidAdapter_spec.js +++ b/test/spec/modules/clickforceBidAdapter_spec.js @@ -2,16 +2,16 @@ import { expect } from 'chai'; import { spec } from 'modules/clickforceBidAdapter'; import { newBidder } from 'src/adapters/bidderFactory'; -describe('ClickforceAdapter', () => { +describe('ClickforceAdapter', function () { const adapter = newBidder(spec); - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { 'bidder': 'clickforce', 'params': { @@ -26,11 +26,11 @@ describe('ClickforceAdapter', () => { 'auctionId': '1d1a030790a475' }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -40,7 +40,7 @@ describe('ClickforceAdapter', () => { }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let bidRequests = [{ 'bidder': 'clickforce', 'params': { @@ -57,12 +57,12 @@ describe('ClickforceAdapter', () => { const request = spec.buildRequests(bidRequests); - it('sends bid request to our endpoint via POST', () => { + it('sends bid request to our endpoint via POST', function () { expect(request.method).to.equal('POST'); }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { let response = [{ 'cpm': 0.5, 'width': '300', @@ -147,19 +147,19 @@ describe('ClickforceAdapter', () => { } }]; - it('should get the correct bid response by display ad', () => { + it('should get the correct bid response by display ad', function () { let bidderRequest; let result = spec.interpretResponse({ body: response }, {bidderRequest}); expect(Object.keys(result[0])).to.have.members(Object.keys(expectedResponse[0])); }); - it('should get the correct bid response by native ad', () => { + it('should get the correct bid response by native ad', function () { let bidderRequest; let result = spec.interpretResponse({ body: response1 }, {bidderRequest}); expect(Object.keys(result[0])).to.have.members(Object.keys(expectedResponse1[0])); }); - it('handles empty bid response', () => { + it('handles empty bid response', function () { let response = { body: {} }; @@ -168,8 +168,8 @@ describe('ClickforceAdapter', () => { }); }); - describe('getUserSyncs function', () => { - it('should register type is iframe', () => { + describe('getUserSyncs function', function () { + it('should register type is iframe', function () { const syncOptions = { 'iframeEnabled': 'true' } @@ -178,7 +178,7 @@ describe('ClickforceAdapter', () => { expect(userSync[0].url).to.equal('https://cdn.doublemax.net/js/capmapping.htm'); }); - it('should register type is image', () => { + it('should register type is image', function () { const syncOptions = { 'pixelEnabled': 'true' } diff --git a/test/spec/modules/colossussspBidAdapter_spec.js b/test/spec/modules/colossussspBidAdapter_spec.js index 54952fbf4b5..62b4158676e 100644 --- a/test/spec/modules/colossussspBidAdapter_spec.js +++ b/test/spec/modules/colossussspBidAdapter_spec.js @@ -1,7 +1,7 @@ import {expect} from 'chai'; import {spec} from '../../../modules/colossussspBidAdapter'; -describe('ColossussspAdapter', () => { +describe('ColossussspAdapter', function () { let bid = { bidId: '2dd581a2b6281d', bidder: 'colossusssp', @@ -15,31 +15,31 @@ describe('ColossussspAdapter', () => { transactionId: '3bb2f6da-87a6-4029-aeb0-bfe951372e62' }; - describe('isBidRequestValid', () => { - it('Should return true when placement_id can be cast to a number', () => { + describe('isBidRequestValid', function () { + it('Should return true when placement_id can be cast to a number', function () { expect(spec.isBidRequestValid(bid)).to.be.true; }); - it('Should return false when placement_id is not a number', () => { + it('Should return false when placement_id is not a number', function () { bid.params.placement_id = 'aaa'; expect(spec.isBidRequestValid(bid)).to.be.false; }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let serverRequest = spec.buildRequests([bid]); - it('Creates a ServerRequest object with method, URL and data', () => { + it('Creates a ServerRequest object with method, URL and data', function () { expect(serverRequest).to.exist; expect(serverRequest.method).to.exist; expect(serverRequest.url).to.exist; expect(serverRequest.data).to.exist; }); - it('Returns POST method', () => { + it('Returns POST method', function () { expect(serverRequest.method).to.equal('POST'); }); - it('Returns valid URL', () => { + it('Returns valid URL', function () { expect(serverRequest.url).to.equal('//colossusssp.com/?c=o&m=multi'); }); - it('Returns valid data if array of bids is valid', () => { + it('Returns valid data if array of bids is valid', function () { let data = serverRequest.data; expect(data).to.be.an('object'); expect(data).to.have.all.keys('deviceWidth', 'deviceHeight', 'language', 'secure', 'host', 'page', 'placements'); @@ -59,13 +59,13 @@ describe('ColossussspAdapter', () => { expect(placement.sizes).to.be.an('array'); } }); - it('Returns empty data if no valid requests are passed', () => { + it('Returns empty data if no valid requests are passed', function () { serverRequest = spec.buildRequests([]); let data = serverRequest.data; expect(data.placements).to.be.an('array').that.is.empty; }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { let resObject = { body: [ { requestId: '123', @@ -81,7 +81,7 @@ describe('ColossussspAdapter', () => { } ] }; let serverResponses = spec.interpretResponse(resObject); - it('Returns an array of valid server responses if response object is valid', () => { + it('Returns an array of valid server responses if response object is valid', function () { expect(serverResponses).to.be.an('array').that.is.not.empty; for (let i = 0; i < serverResponses.length; i++) { let dataItem = serverResponses[i]; @@ -98,16 +98,16 @@ describe('ColossussspAdapter', () => { expect(dataItem.currency).to.be.a('string'); expect(dataItem.mediaType).to.be.a('string'); } - it('Returns an empty array if invalid response is passed', () => { + it('Returns an empty array if invalid response is passed', function () { serverResponses = spec.interpretResponse('invalid_response'); expect(serverResponses).to.be.an('array').that.is.empty; }); }); }); - describe('getUserSyncs', () => { + describe('getUserSyncs', function () { let userSync = spec.getUserSyncs(); - it('Returns valid URL and type', () => { + it('Returns valid URL and type', function () { expect(userSync).to.be.an('array').with.lengthOf(1); expect(userSync[0].type).to.exist; expect(userSync[0].url).to.exist; diff --git a/test/spec/modules/consentManagement_spec.js b/test/spec/modules/consentManagement_spec.js index fe6bfc1ebfd..baa9a43f6aa 100644 --- a/test/spec/modules/consentManagement_spec.js +++ b/test/spec/modules/consentManagement_spec.js @@ -7,18 +7,18 @@ let assert = require('chai').assert; let expect = require('chai').expect; describe('consentManagement', function () { - describe('setConfig tests:', () => { - describe('empty setConfig value', () => { - beforeEach(() => { + describe('setConfig tests:', function () { + describe('empty setConfig value', function () { + beforeEach(function () { sinon.stub(utils, 'logInfo'); }); - afterEach(() => { + afterEach(function () { utils.logInfo.restore(); config.resetConfig(); }); - it('should use system default values', () => { + it('should use system default values', function () { setConfig({}); expect(userCMP).to.be.equal('iab'); expect(consentTimeout).to.be.equal(10000); @@ -27,12 +27,12 @@ describe('consentManagement', function () { }); }); - describe('valid setConfig value', () => { - afterEach(() => { + describe('valid setConfig value', function () { + afterEach(function () { config.resetConfig(); $$PREBID_GLOBAL$$.requestBids.removeHook(requestBidsHook); }); - it('results in all user settings overriding system defaults', () => { + it('results in all user settings overriding system defaults', function () { let allConfig = { cmpApi: 'iab', timeout: 7500, @@ -47,7 +47,7 @@ describe('consentManagement', function () { }); }); - describe('requestBidsHook tests:', () => { + describe('requestBidsHook tests:', function () { let goodConfigWithCancelAuction = { cmpApi: 'iab', timeout: 7500, @@ -62,19 +62,19 @@ describe('consentManagement', function () { let didHookReturn; - afterEach(() => { + afterEach(function () { gdprDataHandler.consentData = null; resetConsentData(); }); - describe('error checks:', () => { - beforeEach(() => { + describe('error checks:', function () { + beforeEach(function () { didHookReturn = false; sinon.stub(utils, 'logWarn'); sinon.stub(utils, 'logError'); }); - afterEach(() => { + afterEach(function () { utils.logWarn.restore(); utils.logError.restore(); config.resetConfig(); @@ -82,7 +82,7 @@ describe('consentManagement', function () { resetConsentData(); }); - it('should throw a warning and return to hooked function when an unknown CMP framework ID is used', () => { + it('should throw a warning and return to hooked function when an unknown CMP framework ID is used', function () { let badCMPConfig = { cmpApi: 'bad' }; @@ -98,7 +98,7 @@ describe('consentManagement', function () { expect(consent).to.be.null; }); - it('should throw proper errors when CMP is not found', () => { + it('should throw proper errors when CMP is not found', function () { setConfig(goodConfigWithCancelAuction); requestBidsHook({}, () => { @@ -112,15 +112,15 @@ describe('consentManagement', function () { }); }); - describe('already known consentData:', () => { + describe('already known consentData:', function () { let cmpStub = sinon.stub(); - beforeEach(() => { + beforeEach(function () { didHookReturn = false; window.__cmp = function() {}; }); - afterEach(() => { + afterEach(function () { config.resetConfig(); $$PREBID_GLOBAL$$.requestBids.removeHook(requestBidsHook); cmpStub.restore(); @@ -128,7 +128,7 @@ describe('consentManagement', function () { resetConsentData(); }); - it('should bypass CMP and simply use previously stored consentData', () => { + it('should bypass CMP and simply use previously stored consentData', function () { let testConsentData = { gdprApplies: true, consentData: 'xyz' @@ -158,10 +158,10 @@ describe('consentManagement', function () { }); }); - describe('CMP workflow for safeframe page', () => { + describe('CMP workflow for safeframe page', function () { let registerStub = sinon.stub(); - beforeEach(() => { + beforeEach(function () { didHookReturn = false; window.$sf = { ext: { @@ -173,7 +173,7 @@ describe('consentManagement', function () { sinon.stub(utils, 'logWarn'); }); - afterEach(() => { + afterEach(function () { delete window.$sf; config.resetConfig(); $$PREBID_GLOBAL$$.requestBids.removeHook(requestBidsHook); @@ -183,7 +183,7 @@ describe('consentManagement', function () { resetConsentData(); }); - it('should return the consent data from a safeframe callback', () => { + it('should return the consent data from a safeframe callback', function () { var testConsentData = { data: { msgName: 'cmpReturn', @@ -215,18 +215,18 @@ describe('consentManagement', function () { }); }); - describe('CMP workflow for iframed page', () => { + describe('CMP workflow for iframed page', function () { let ifr = null; let stringifyResponse = false; - beforeEach(() => { + beforeEach(function () { sinon.stub(utils, 'logError'); sinon.stub(utils, 'logWarn'); ifr = createIFrameMarker(); window.addEventListener('message', cmpMessageHandler, false); }); - afterEach(() => { + afterEach(function () { config.resetConfig(); $$PREBID_GLOBAL$$.requestBids.removeHook(requestBidsHook); delete window.__cmp; @@ -288,17 +288,17 @@ describe('consentManagement', function () { } }); - describe('CMP workflow for normal pages:', () => { + describe('CMP workflow for normal pages:', function () { let cmpStub = sinon.stub(); - beforeEach(() => { + beforeEach(function () { didHookReturn = false; sinon.stub(utils, 'logError'); sinon.stub(utils, 'logWarn'); window.__cmp = function() {}; }); - afterEach(() => { + afterEach(function () { config.resetConfig(); $$PREBID_GLOBAL$$.requestBids.removeHook(requestBidsHook); cmpStub.restore(); @@ -308,7 +308,7 @@ describe('consentManagement', function () { resetConsentData(); }); - it('performs lookup check and stores consentData for a valid existing user', () => { + it('performs lookup check and stores consentData for a valid existing user', function () { let testConsentData = { gdprApplies: true, consentData: 'BOJy+UqOJy+UqABAB+AAAAAZ+A==' @@ -331,7 +331,7 @@ describe('consentManagement', function () { expect(consent.gdprApplies).to.be.true; }); - it('throws an error when processCmpData check failed while config had allowAuction set to false', () => { + it('throws an error when processCmpData check failed while config had allowAuction set to false', function () { let testConsentData = {}; let bidsBackHandlerReturn = false; @@ -352,7 +352,7 @@ describe('consentManagement', function () { expect(consent).to.be.null; }); - it('throws a warning + stores consentData + calls callback when processCmpData check failed while config had allowAuction set to true', () => { + it('throws a warning + stores consentData + calls callback when processCmpData check failed while config had allowAuction set to true', function () { let testConsentData = {}; cmpStub = sinon.stub(window, '__cmp').callsFake((...args) => { diff --git a/test/spec/modules/consumableBidAdapter_spec.js b/test/spec/modules/consumableBidAdapter_spec.js index 45c56885c03..d13c3c56398 100644 --- a/test/spec/modules/consumableBidAdapter_spec.js +++ b/test/spec/modules/consumableBidAdapter_spec.js @@ -104,11 +104,11 @@ const RESPONSE = { } }; -describe('Consumable BidAdapter', () => { +describe('Consumable BidAdapter', function () { let bidRequests; let adapter = spec; - beforeEach(() => { + beforeEach(function () { bidRequests = [ { bidder: 'consumable', @@ -128,8 +128,8 @@ describe('Consumable BidAdapter', () => { ]; }); - describe('bid request validation', () => { - it('should accept valid bid requests', () => { + describe('bid request validation', function () { + it('should accept valid bid requests', function () { let bid = { bidder: 'consumable', params: { @@ -142,7 +142,7 @@ describe('Consumable BidAdapter', () => { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should accept valid bid requests with extra fields', () => { + it('should accept valid bid requests with extra fields', function () { let bid = { bidder: 'consumable', params: { @@ -156,7 +156,7 @@ describe('Consumable BidAdapter', () => { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should reject bid requests without siteId', () => { + it('should reject bid requests without siteId', function () { let bid = { bidder: 'consumable', params: { @@ -168,7 +168,7 @@ describe('Consumable BidAdapter', () => { expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should reject bid requests without networkId', () => { + it('should reject bid requests without networkId', function () { let bid = { bidder: 'consumable', params: { @@ -181,44 +181,44 @@ describe('Consumable BidAdapter', () => { }); }); - describe('buildRequests validation', () => { - it('creates request data', () => { + describe('buildRequests validation', function () { + it('creates request data', function () { let request = spec.buildRequests(bidRequests); expect(request).to.exist.and.to.be.a('object'); }); - it('request to consumable should contain a url', () => { + it('request to consumable should contain a url', function () { let request = spec.buildRequests(bidRequests); expect(request.url).to.have.string('serverbid.com'); }); - it('requires valid bids to make request', () => { + it('requires valid bids to make request', function () { let request = spec.buildRequests([]); expect(request.bidRequest).to.be.empty; }); - it('sends bid request to ENDPOINT via POST', () => { + it('sends bid request to ENDPOINT via POST', function () { let request = spec.buildRequests(bidRequests); expect(request.method).to.have.string('POST'); }); }); - describe('interpretResponse validation', () => { - it('response should have valid bidderCode', () => { + describe('interpretResponse validation', function () { + it('response should have valid bidderCode', function () { let bidRequest = spec.buildRequests(REQUEST.bidRequest); let bid = bidFactory.createBid(1, bidRequest.bidRequest[0]); expect(bid.bidderCode).to.equal('consumable'); }); - it('response should include objects for all bids', () => { + it('response should include objects for all bids', function () { let bids = spec.interpretResponse(RESPONSE, REQUEST); expect(bids.length).to.equal(2); }); - it('registers bids', () => { + it('registers bids', function () { let bids = spec.interpretResponse(RESPONSE, REQUEST); bids.forEach(b => { expect(b).to.have.property('cpm'); @@ -238,29 +238,29 @@ describe('Consumable BidAdapter', () => { }); }); - it('handles nobid responses', () => { + it('handles nobid responses', function () { let EMPTY_RESP = Object.assign({}, RESPONSE, {'body': {'decisions': null}}) let bids = spec.interpretResponse(EMPTY_RESP, REQUEST); expect(bids).to.be.empty; }); - it('handles no server response', () => { + it('handles no server response', function () { let bids = spec.interpretResponse(null, REQUEST); expect(bids).to.be.empty; }); }); - describe('getUserSyncs', () => { + describe('getUserSyncs', function () { let syncOptions = {'iframeEnabled': true}; - it('handles empty sync options', () => { + it('handles empty sync options', function () { let opts = spec.getUserSyncs({}); expect(opts).to.be.empty; }); - it('should return a sync url if iframe syncs are enabled', () => { + it('should return a sync url if iframe syncs are enabled', function () { let opts = spec.getUserSyncs(syncOptions); expect(opts.length).to.equal(1); diff --git a/test/spec/modules/contentigniteBidAdapter_spec.js b/test/spec/modules/contentigniteBidAdapter_spec.js index cdf70e15615..1867791a234 100644 --- a/test/spec/modules/contentigniteBidAdapter_spec.js +++ b/test/spec/modules/contentigniteBidAdapter_spec.js @@ -1,10 +1,10 @@ import { expect } from 'chai'; import { spec } from '../../../modules/contentigniteBidAdapter'; -describe('Content Ignite adapter', () => { +describe('Content Ignite adapter', function () { let bidRequests; - beforeEach(() => { + beforeEach(function () { bidRequests = [ { bidder: 'contentignite', @@ -25,9 +25,9 @@ describe('Content Ignite adapter', () => { ]; }); - describe('implementation', () => { - describe('for requests', () => { - it('should accept valid bid', () => { + describe('implementation', function () { + describe('for requests', function () { + it('should accept valid bid', function () { const validBid = { bidder: 'contentignite', params: { @@ -40,7 +40,7 @@ describe('Content Ignite adapter', () => { expect(isValid).to.equal(true); }); - it('should reject invalid bid', () => { + it('should reject invalid bid', function () { const invalidBid = { bidder: 'contentignite', params: { @@ -52,14 +52,14 @@ describe('Content Ignite adapter', () => { expect(isValid).to.equal(false); }); - it('should set the keyword parameter', () => { + it('should set the keyword parameter', function () { const requests = spec.buildRequests(bidRequests), requestURL = requests[0].url; expect(requestURL).to.have.string(';kw=business;'); }); - it('should increment the count for the same zone', () => { + it('should increment the count for the same zone', function () { const bidRequests = [ { sizes: [[728, 90]], @@ -87,8 +87,8 @@ describe('Content Ignite adapter', () => { }); }); - describe('bid responses', () => { - it('should return complete bid response', () => { + describe('bid responses', function () { + it('should return complete bid response', function () { const serverResponse = { body: { status: 'SUCCESS', @@ -116,7 +116,7 @@ describe('Content Ignite adapter', () => { expect(bids[0].ad).to.have.length.above(1); }); - it('should return empty bid response', () => { + it('should return empty bid response', function () { const serverResponse = { status: 'NO_ELIGIBLE_ADS', zone_id: 299680, @@ -131,7 +131,7 @@ describe('Content Ignite adapter', () => { expect(bids).to.be.lengthOf(0); }); - it('should return empty bid response on incorrect size', () => { + it('should return empty bid response on incorrect size', function () { const serverResponse = { status: 'SUCCESS', account_id: 168237, @@ -148,7 +148,7 @@ describe('Content Ignite adapter', () => { expect(bids).to.be.lengthOf(0); }); - it('should return empty bid response with CPM too low', () => { + it('should return empty bid response with CPM too low', function () { const serverResponse = { status: 'SUCCESS', account_id: 168237, @@ -165,7 +165,7 @@ describe('Content Ignite adapter', () => { expect(bids).to.be.lengthOf(0); }); - it('should return empty bid response with CPM too high', () => { + it('should return empty bid response with CPM too high', function () { const serverResponse = { status: 'SUCCESS', account_id: 168237, diff --git a/test/spec/modules/coxBidAdapter_spec.js b/test/spec/modules/coxBidAdapter_spec.js index 9dd5a5a92b4..8d8b29ed4d7 100644 --- a/test/spec/modules/coxBidAdapter_spec.js +++ b/test/spec/modules/coxBidAdapter_spec.js @@ -3,10 +3,10 @@ import { spec } from 'modules/coxBidAdapter'; import { newBidder } from 'src/adapters/bidderFactory'; import { deepClone } from 'src/utils'; -describe('CoxBidAdapter', () => { +describe('CoxBidAdapter', function () { const adapter = newBidder(spec); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { const CONFIG = { 'bidder': 'cox', 'params': { @@ -16,18 +16,18 @@ describe('CoxBidAdapter', () => { } }; - it('should return true when required params present', () => { + it('should return true when required params present', function () { expect(spec.isBidRequestValid(CONFIG)).to.equal(true); }); - it('should return false when id param is missing', () => { + it('should return false when id param is missing', function () { let config = deepClone(CONFIG); config.params.id = null; expect(spec.isBidRequestValid(config)).to.equal(false); }); - it('should return false when size param is missing', () => { + it('should return false when size param is missing', function () { let config = deepClone(CONFIG); config.params.size = null; @@ -35,7 +35,7 @@ describe('CoxBidAdapter', () => { }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { const PROD_DOMAIN = 'ad.afy11.net'; const PPE_DOMAIN = 'ppe-ad.afy11.net'; const STG_DOMAIN = 'staging-ad.afy11.net'; @@ -52,13 +52,13 @@ describe('CoxBidAdapter', () => { 'bidId': 'bId-bar' }]; - it('should send bid request to PROD_DOMAIN via GET', () => { + it('should send bid request to PROD_DOMAIN via GET', function () { let request = spec.buildRequests(BID_INFO); expect(request.url).to.have.string(PROD_DOMAIN); expect(request.method).to.equal('GET'); }); - it('should send bid request to PPE_DOMAIN when configured', () => { + it('should send bid request to PPE_DOMAIN when configured', function () { let clone = deepClone(BID_INFO); clone[0].params.env = 'PPE'; @@ -66,7 +66,7 @@ describe('CoxBidAdapter', () => { expect(request.url).to.have.string(PPE_DOMAIN); }); - it('should send bid request to STG_DOMAIN when configured', () => { + it('should send bid request to STG_DOMAIN when configured', function () { let clone = deepClone(BID_INFO); clone[0].params.env = 'STG'; @@ -74,7 +74,7 @@ describe('CoxBidAdapter', () => { expect(request.url).to.have.string(STG_DOMAIN); }); - it('should return empty when id is invalid', () => { + it('should return empty when id is invalid', function () { let clone = deepClone(BID_INFO); clone[0].params.id = null; @@ -82,7 +82,7 @@ describe('CoxBidAdapter', () => { expect(request).to.be.an('object').that.is.empty; }); - it('should return empty when size is invalid', () => { + it('should return empty when size is invalid', function () { let clone = deepClone(BID_INFO); clone[0].params.size = 'FOO'; @@ -91,7 +91,7 @@ describe('CoxBidAdapter', () => { }); }) - describe('interpretResponse', () => { + describe('interpretResponse', function () { const BID_INFO_1 = [{ 'bidder': 'cox', 'params': { @@ -157,12 +157,12 @@ describe('CoxBidAdapter', () => { 'ad': '

2000005658887
300x250

' }; - it('should return correct pbjs bid', () => { + it('should return correct pbjs bid', function () { let result = spec.interpretResponse(RESPONSE_2, spec.buildRequests(BID_INFO_2)); expect(result[0]).to.eql(PBJS_BID_2); }); - it('should handle multiple bid instances', () => { + it('should handle multiple bid instances', function () { let request1 = spec.buildRequests(BID_INFO_1); let request2 = spec.buildRequests(BID_INFO_2); @@ -173,7 +173,7 @@ describe('CoxBidAdapter', () => { expect(result1[0]).to.eql(PBJS_BID_1); }); - it('should return empty when price is zero', () => { + it('should return empty when price is zero', function () { let clone = deepClone(RESPONSE_1); clone.body.zones.as2000005657007.price = 0; @@ -181,7 +181,7 @@ describe('CoxBidAdapter', () => { expect(result).to.be.an('array').that.is.empty; }); - it('should return empty when there is no ad', () => { + it('should return empty when there is no ad', function () { let clone = deepClone(RESPONSE_1); clone.body.zones.as2000005657007.ad = null; @@ -189,7 +189,7 @@ describe('CoxBidAdapter', () => { expect(result).to.be.an('array').that.is.empty; }); - it('should return empty when there is no ad unit info', () => { + it('should return empty when there is no ad unit info', function () { let clone = deepClone(RESPONSE_1); delete (clone.body.zones.as2000005657007); @@ -198,26 +198,26 @@ describe('CoxBidAdapter', () => { }); }); - describe('getUserSyncs', () => { + describe('getUserSyncs', function () { const RESPONSE = [{ body: { 'zones': {}, 'tpCookieSync': ['http://pixel.foo.com/', 'http://pixel.bar.com/'] }}]; - it('should return correct pbjs syncs when pixels are enabled', () => { + it('should return correct pbjs syncs when pixels are enabled', function () { let syncs = spec.getUserSyncs({ pixelEnabled: true }, RESPONSE); expect(syncs.map(x => x.type)).to.eql(['image', 'image']); expect(syncs.map(x => x.url)).to.have.members(['http://pixel.bar.com/', 'http://pixel.foo.com/']); }); - it('should return empty when pixels are not enabled', () => { + it('should return empty when pixels are not enabled', function () { let syncs = spec.getUserSyncs({ pixelEnabled: false }, RESPONSE); expect(syncs).to.be.an('array').that.is.empty; }); - it('should return empty when response has no sync data', () => { + it('should return empty when response has no sync data', function () { let clone = deepClone(RESPONSE); delete (clone[0].body.tpCookieSync); @@ -225,7 +225,7 @@ describe('CoxBidAdapter', () => { expect(syncs).to.be.an('array').that.is.empty; }); - it('should return empty when response is empty', () => { + it('should return empty when response is empty', function () { let syncs = spec.getUserSyncs({ pixelEnabled: true }, [{}]); expect(syncs).to.be.an('array').that.is.empty; }); diff --git a/test/spec/modules/criteoBidAdapter_spec.js b/test/spec/modules/criteoBidAdapter_spec.js index 6e2276d7e22..e232bf0e3d9 100755 --- a/test/spec/modules/criteoBidAdapter_spec.js +++ b/test/spec/modules/criteoBidAdapter_spec.js @@ -2,9 +2,9 @@ import { expect } from 'chai'; import { spec } from 'modules/criteoBidAdapter'; import * as utils from 'src/utils'; -describe('The Criteo bidding adapter', () => { - describe('isBidRequestValid', () => { - it('should return false when given an invalid bid', () => { +describe('The Criteo bidding adapter', function () { + describe('isBidRequestValid', function () { + it('should return false when given an invalid bid', function () { const bid = { bidder: 'criteo', }; @@ -12,7 +12,7 @@ describe('The Criteo bidding adapter', () => { expect(isValid).to.equal(false); }); - it('should return true when given a zoneId bid', () => { + it('should return true when given a zoneId bid', function () { const bid = { bidder: 'criteo', params: { @@ -23,7 +23,7 @@ describe('The Criteo bidding adapter', () => { expect(isValid).to.equal(true); }); - it('should return true when given a networkId bid', () => { + it('should return true when given a networkId bid', function () { const bid = { bidder: 'criteo', params: { @@ -34,7 +34,7 @@ describe('The Criteo bidding adapter', () => { expect(isValid).to.equal(true); }); - it('should return true when given a mixed bid with both a zoneId and a networkId', () => { + it('should return true when given a mixed bid with both a zoneId and a networkId', function () { const bid = { bidder: 'criteo', params: { @@ -47,7 +47,7 @@ describe('The Criteo bidding adapter', () => { }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { const bidderRequest = { timeout: 3000, gdprConsent: { gdprApplies: 1, @@ -60,7 +60,7 @@ describe('The Criteo bidding adapter', () => { }, }; - it('should properly build a zoneId request', () => { + it('should properly build a zoneId request', function () { const bidRequests = [ { bidder: 'criteo', @@ -88,7 +88,7 @@ describe('The Criteo bidding adapter', () => { expect(ortbRequest.gdprConsent.consentGiven).to.equal(true); }); - it('should properly build a networkId request', () => { + it('should properly build a networkId request', function () { const bidderRequest = { timeout: 3000, gdprConsent: { @@ -129,7 +129,7 @@ describe('The Criteo bidding adapter', () => { expect(ortbRequest.gdprConsent.consentGiven).to.equal(undefined); }); - it('should properly build a mixed request', () => { + it('should properly build a mixed request', function () { const bidderRequest = { timeout: 3000 }; const bidRequests = [ { @@ -170,7 +170,7 @@ describe('The Criteo bidding adapter', () => { expect(ortbRequest.gdprConsent).to.equal(undefined); }); - it('should properly build request with undefined gdpr consent fields when they are not provided', () => { + it('should properly build request with undefined gdpr consent fields when they are not provided', function () { const bidRequests = [ { bidder: 'criteo', @@ -194,15 +194,15 @@ describe('The Criteo bidding adapter', () => { }); }); - describe('interpretResponse', () => { - it('should return an empty array when parsing a no bid response', () => { + describe('interpretResponse', function () { + it('should return an empty array when parsing a no bid response', function () { const response = {}; const request = { bidRequests: [] }; const bids = spec.interpretResponse(response, request); expect(bids).to.have.lengthOf(0); }); - it('should properly parse a bid response with a networkId', () => { + it('should properly parse a bid response with a networkId', function () { const response = { body: { slots: [{ @@ -232,7 +232,7 @@ describe('The Criteo bidding adapter', () => { expect(bids[0].height).to.equal(90); }); - it('should properly parse a bid responsewith with a zoneId', () => { + it('should properly parse a bid responsewith with a zoneId', function () { const response = { body: { slots: [{ @@ -263,7 +263,7 @@ describe('The Criteo bidding adapter', () => { expect(bids[0].height).to.equal(90); }); - it('should properly parse a bid responsewith with a zoneId passed as a string', () => { + it('should properly parse a bid responsewith with a zoneId passed as a string', function () { const response = { body: { slots: [{ diff --git a/test/spec/modules/currency_spec.js b/test/spec/modules/currency_spec.js index 74e2b8a3c38..e96b15d11e9 100644 --- a/test/spec/modules/currency_spec.js +++ b/test/spec/modules/currency_spec.js @@ -21,21 +21,21 @@ describe('currency', function () { let fn = sinon.spy(); let hookFn = createHook('asyncSeries', fn, 'addBidResponse'); - beforeEach(() => { + beforeEach(function () { fakeCurrencyFileServer = sinon.fakeServer.create(); }); - afterEach(() => { + afterEach(function () { fakeCurrencyFileServer.restore(); }); - describe('setConfig', () => { - it('results in currencySupportEnabled = false when currency not configured', () => { + describe('setConfig', function () { + it('results in currencySupportEnabled = false when currency not configured', function () { setConfig({}); expect(currencySupportEnabled).to.equal(false); }); - it('results in currencySupportEnabled = true and currencyRates being loaded when configured', () => { + it('results in currencySupportEnabled = true and currencyRates being loaded when configured', function () { fakeCurrencyFileServer.respondWith(JSON.stringify(getCurrencyRates())); setConfig({ 'adServerCurrency': 'JPY' }); fakeCurrencyFileServer.respond(); @@ -44,8 +44,8 @@ describe('currency', function () { }); }); - describe('bidder override', () => { - it('allows setConfig to set bidder currency', () => { + describe('bidder override', function () { + it('allows setConfig to set bidder currency', function () { setConfig({}); var bid = { cpm: 1, bidder: 'rubicon' }; @@ -67,7 +67,7 @@ describe('currency', function () { expect(innerBid.getCpmInNewCurrency('GBP')).to.equal('1.000'); }); - it('uses adapter currency over currency override if specified', () => { + it('uses adapter currency over currency override if specified', function () { setConfig({}); var bid = { cpm: 1, currency: 'JPY', bidder: 'rubicon' }; @@ -89,7 +89,7 @@ describe('currency', function () { expect(innerBid.getCpmInNewCurrency('JPY')).to.equal('1.000'); }); - it('uses rates specified in json when provided', () => { + it('uses rates specified in json when provided', function () { setConfig({ adServerCurrency: 'USD', rates: { @@ -111,7 +111,7 @@ describe('currency', function () { expect(innerBid.getCpmInNewCurrency('JPY')).to.equal('100.000'); }); - it('uses default rates when currency file fails to load', () => { + it('uses default rates when currency file fails to load', function () { setConfig({}); setConfig({ @@ -139,8 +139,8 @@ describe('currency', function () { }); }); - describe('currency.addBidResponseDecorator bidResponseQueue', () => { - it('not run until currency rates file is loaded', () => { + describe('currency.addBidResponseDecorator bidResponseQueue', function () { + it('not run until currency rates file is loaded', function () { setConfig({}); fakeCurrencyFileServer.respondWith(JSON.stringify(getCurrencyRates())); @@ -161,8 +161,8 @@ describe('currency', function () { }); }); - describe('currency.addBidResponseDecorator', () => { - it('should leave bid at 1 when currency support is not enabled and fromCurrency is USD', () => { + describe('currency.addBidResponseDecorator', function () { + it('should leave bid at 1 when currency support is not enabled and fromCurrency is USD', function () { setConfig({}); var bid = { 'cpm': 1, 'currency': 'USD' }; var innerBid; @@ -172,7 +172,7 @@ describe('currency', function () { expect(innerBid.cpm).to.equal(1); }); - it('should result in NO_BID when currency support is not enabled and fromCurrency is not USD', () => { + it('should result in NO_BID when currency support is not enabled and fromCurrency is not USD', function () { setConfig({}); var bid = { 'cpm': 1, 'currency': 'GBP' }; var innerBid; @@ -182,7 +182,7 @@ describe('currency', function () { expect(innerBid.statusMessage).to.equal('Bid returned empty or error response'); }); - it('should not buffer bid when currency is already in desired currency', () => { + it('should not buffer bid when currency is already in desired currency', function () { setConfig({ 'adServerCurrency': 'USD' }); @@ -194,7 +194,7 @@ describe('currency', function () { expect(bid).to.equal(innerBid); }); - it('should result in NO_BID when fromCurrency is not supported in file', () => { + it('should result in NO_BID when fromCurrency is not supported in file', function () { fakeCurrencyFileServer.respondWith(JSON.stringify(getCurrencyRates())); setConfig({ 'adServerCurrency': 'JPY' }); fakeCurrencyFileServer.respond(); @@ -206,7 +206,7 @@ describe('currency', function () { expect(innerBid.statusMessage).to.equal('Bid returned empty or error response'); }); - it('should result in NO_BID when adServerCurrency is not supported in file', () => { + it('should result in NO_BID when adServerCurrency is not supported in file', function () { fakeCurrencyFileServer.respondWith(JSON.stringify(getCurrencyRates())); setConfig({ 'adServerCurrency': 'ABC' }); fakeCurrencyFileServer.respond(); @@ -218,7 +218,7 @@ describe('currency', function () { expect(innerBid.statusMessage).to.equal('Bid returned empty or error response'); }); - it('should return 1 when currency support is enabled and same currency code is requested as is set to adServerCurrency', () => { + it('should return 1 when currency support is enabled and same currency code is requested as is set to adServerCurrency', function () { fakeCurrencyFileServer.respondWith(JSON.stringify(getCurrencyRates())); setConfig({ 'adServerCurrency': 'JPY' }); fakeCurrencyFileServer.respond(); @@ -231,7 +231,7 @@ describe('currency', function () { expect(innerBid.currency).to.equal('JPY'); }); - it('should return direct conversion rate when fromCurrency is one of the configured bases', () => { + it('should return direct conversion rate when fromCurrency is one of the configured bases', function () { fakeCurrencyFileServer.respondWith(JSON.stringify(getCurrencyRates())); setConfig({ 'adServerCurrency': 'GBP' }); fakeCurrencyFileServer.respond(); @@ -244,7 +244,7 @@ describe('currency', function () { expect(innerBid.currency).to.equal('GBP'); }); - it('should return reciprocal conversion rate when adServerCurrency is one of the configured bases, but fromCurrency is not', () => { + it('should return reciprocal conversion rate when adServerCurrency is one of the configured bases, but fromCurrency is not', function () { fakeCurrencyFileServer.respondWith(JSON.stringify(getCurrencyRates())); setConfig({ 'adServerCurrency': 'GBP' }); fakeCurrencyFileServer.respond(); @@ -257,7 +257,7 @@ describe('currency', function () { expect(innerBid.currency).to.equal('GBP'); }); - it('should return intermediate conversion rate when neither fromCurrency nor adServerCurrency is one of the configured bases', () => { + it('should return intermediate conversion rate when neither fromCurrency nor adServerCurrency is one of the configured bases', function () { fakeCurrencyFileServer.respondWith(JSON.stringify(getCurrencyRates())); setConfig({ 'adServerCurrency': 'CNY' }); fakeCurrencyFileServer.respond(); diff --git a/test/spec/modules/danmarketBidAdapter_spec.js b/test/spec/modules/danmarketBidAdapter_spec.js index 243e2fdfb66..973cd2afb1c 100644 --- a/test/spec/modules/danmarketBidAdapter_spec.js +++ b/test/spec/modules/danmarketBidAdapter_spec.js @@ -5,13 +5,13 @@ import { newBidder } from 'src/adapters/bidderFactory'; describe('DAN_Marketplace Adapter', function () { const adapter = newBidder(spec); - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { 'bidder': 'danmarket', 'params': { @@ -24,11 +24,11 @@ describe('DAN_Marketplace Adapter', function () { 'auctionId': '1d1a030790a475', }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -38,7 +38,7 @@ describe('DAN_Marketplace Adapter', function () { }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let bidRequests = [ { 'bidder': 'danmarket', @@ -75,7 +75,7 @@ describe('DAN_Marketplace Adapter', function () { } ]; - it('should attach valid params to the tag', () => { + it('should attach valid params to the tag', function () { const request = spec.buildRequests([bidRequests[0]]); const payload = request.data; expect(payload).to.be.an('object'); @@ -84,7 +84,7 @@ describe('DAN_Marketplace Adapter', function () { expect(payload).to.have.property('auids', '5'); }); - it('auids must not be duplicated', () => { + it('auids must not be duplicated', function () { const request = spec.buildRequests(bidRequests); const payload = request.data; expect(payload).to.be.an('object'); @@ -93,7 +93,7 @@ describe('DAN_Marketplace Adapter', function () { expect(payload).to.have.property('auids', '5,6'); }); - it('pt parameter must be "gross" if params.priceType === "gross"', () => { + it('pt parameter must be "gross" if params.priceType === "gross"', function () { bidRequests[1].params.priceType = 'gross'; const request = spec.buildRequests(bidRequests); const payload = request.data; @@ -104,7 +104,7 @@ describe('DAN_Marketplace Adapter', function () { delete bidRequests[1].params.priceType; }); - it('pt parameter must be "net" or "gross"', () => { + it('pt parameter must be "net" or "gross"', function () { bidRequests[1].params.priceType = 'some'; const request = spec.buildRequests(bidRequests); const payload = request.data; @@ -115,7 +115,7 @@ describe('DAN_Marketplace Adapter', function () { delete bidRequests[1].params.priceType; }); - it('if gdprConsent is present payload must have gdpr params', () => { + it('if gdprConsent is present payload must have gdpr params', function () { const request = spec.buildRequests(bidRequests, {gdprConsent: {consentString: 'AAA', gdprApplies: true}}); const payload = request.data; expect(payload).to.be.an('object'); @@ -123,7 +123,7 @@ describe('DAN_Marketplace Adapter', function () { expect(payload).to.have.property('gdpr_applies', 1); }); - it('if gdprApplies is false gdpr_applies must be 0', () => { + it('if gdprApplies is false gdpr_applies must be 0', function () { const request = spec.buildRequests(bidRequests, {gdprConsent: {consentString: 'AAA', gdprApplies: false}}); const payload = request.data; expect(payload).to.be.an('object'); @@ -131,7 +131,7 @@ describe('DAN_Marketplace Adapter', function () { expect(payload).to.have.property('gdpr_applies', 0); }); - it('if gdprApplies is undefined gdpr_applies must be 1', () => { + it('if gdprApplies is undefined gdpr_applies must be 1', function () { const request = spec.buildRequests(bidRequests, {gdprConsent: {consentString: 'AAA'}}); const payload = request.data; expect(payload).to.be.an('object'); @@ -140,7 +140,7 @@ describe('DAN_Marketplace Adapter', function () { }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { const responses = [ {'bid': [{'price': 1.15, 'adm': '
test content 1
', 'auid': 4, 'h': 250, 'w': 300}], 'seat': '1'}, {'bid': [{'price': 0.5, 'adm': '
test content 2
', 'auid': 5, 'h': 90, 'w': 728}], 'seat': '1'}, @@ -151,7 +151,7 @@ describe('DAN_Marketplace Adapter', function () { {'seat': '1'}, ]; - it('should get correct bid response', () => { + it('should get correct bid response', function () { const bidRequests = [ { 'bidder': 'danmarket', @@ -185,7 +185,7 @@ describe('DAN_Marketplace Adapter', function () { expect(result).to.deep.equal(expectedResponse); }); - it('should get correct multi bid response', () => { + it('should get correct multi bid response', function () { const bidRequests = [ { 'bidder': 'danmarket', @@ -265,7 +265,7 @@ describe('DAN_Marketplace Adapter', function () { expect(result).to.deep.equal(expectedResponse); }); - it('handles wrong and nobid responses', () => { + it('handles wrong and nobid responses', function () { const bidRequests = [ { 'bidder': 'danmarket', diff --git a/test/spec/modules/dfpAdServerVideo_spec.js b/test/spec/modules/dfpAdServerVideo_spec.js index 8f779412c80..8afc597d3b4 100644 --- a/test/spec/modules/dfpAdServerVideo_spec.js +++ b/test/spec/modules/dfpAdServerVideo_spec.js @@ -13,8 +13,8 @@ const bid = { adserverTargeting: { }, }; -describe('The DFP video support module', () => { - it('should make a legal request URL when given the required params', () => { +describe('The DFP video support module', function () { + it('should make a legal request URL when given the required params', function () { const url = parse(buildDfpVideoUrl({ adUnit: adUnit, bid: bid, @@ -39,7 +39,7 @@ describe('The DFP video support module', () => { expect(queryParams).to.have.property('url'); }); - it('can take an adserver url as a parameter', () => { + it('can take an adserver url as a parameter', function () { const bidCopy = Object.assign({ }, bid); bidCopy.vastUrl = 'vastUrl.example'; @@ -55,7 +55,7 @@ describe('The DFP video support module', () => { expect(queryObject.description_url).to.equal('vastUrl.example'); }); - it('requires a params object or url', () => { + it('requires a params object or url', function () { const url = buildDfpVideoUrl({ adUnit: adUnit, bid: bid, @@ -64,7 +64,7 @@ describe('The DFP video support module', () => { expect(url).to.be.undefined; }); - it('overwrites url params when both url and params object are given', () => { + it('overwrites url params when both url and params object are given', function () { const url = parse(buildDfpVideoUrl({ adUnit: adUnit, bid: bid, @@ -76,7 +76,7 @@ describe('The DFP video support module', () => { expect(queryObject.iu).to.equal('my/adUnit'); }); - it('should override param defaults with user-provided ones', () => { + it('should override param defaults with user-provided ones', function () { const url = parse(buildDfpVideoUrl({ adUnit: adUnit, bid: bid, @@ -89,7 +89,7 @@ describe('The DFP video support module', () => { expect(parseQS(url.query)).to.have.property('output', 'vast'); }); - it('should include the cache key and adserver targeting in cust_params', () => { + it('should include the cache key and adserver targeting in cust_params', function () { const bidCopy = Object.assign({ }, bid); bidCopy.adserverTargeting = { hb_adid: 'ad_id', @@ -110,7 +110,7 @@ describe('The DFP video support module', () => { expect(customParams).to.have.property('hb_cache_id', bid.videoCacheKey); }); - describe('special targeting unit test', () => { + describe('special targeting unit test', function () { const allTargetingData = { 'hb_format': 'video', 'hb_source': 'client', @@ -133,7 +133,7 @@ describe('The DFP video support module', () => { }; let targetingStub; - before(() => { + before(function () { targetingStub = sinon.stub(targeting, 'getAllTargeting'); targetingStub.returns({'video1': allTargetingData}); @@ -142,12 +142,12 @@ describe('The DFP video support module', () => { }); }); - after(() => { + after(function () { config.resetConfig(); targetingStub.restore(); }); - it('should include all adserver targeting in cust_params if pbjs.enableSendAllBids is true', () => { + it('should include all adserver targeting in cust_params if pbjs.enableSendAllBids is true', function () { const adUnitsCopy = utils.deepClone(adUnit); adUnitsCopy.bids.push({ 'bidder': 'testBidder2', @@ -183,7 +183,7 @@ describe('The DFP video support module', () => { }); }); - it('should merge the user-provided cust_params with the default ones', () => { + it('should merge the user-provided cust_params with the default ones', function () { const bidCopy = Object.assign({ }, bid); bidCopy.adserverTargeting = { hb_adid: 'ad_id', @@ -206,7 +206,7 @@ describe('The DFP video support module', () => { expect(customParams).to.have.property('my_targeting', 'foo'); }); - it('should merge the user-provided cust-params with the default ones when using url object', () => { + it('should merge the user-provided cust-params with the default ones when using url object', function () { const bidCopy = Object.assign({ }, bid); bidCopy.adserverTargeting = { hb_adid: 'ad_id', @@ -228,7 +228,7 @@ describe('The DFP video support module', () => { expect(customParams).to.have.property('hb_cache_id', 'abc'); }); - it('should not overwrite an existing description_url for object input and cache disabled', () => { + it('should not overwrite an existing description_url for object input and cache disabled', function () { const bidCopy = Object.assign({}, bid); bidCopy.vastUrl = 'vastUrl.example'; @@ -245,7 +245,7 @@ describe('The DFP video support module', () => { expect(queryObject.description_url).to.equal('descriptionurl.example'); }); - it('should work with nobid responses', () => { + it('should work with nobid responses', function () { const url = buildDfpVideoUrl({ adUnit: adUnit, params: { 'iu': 'my/adUnit' } diff --git a/test/spec/modules/dgadsBidAdapter_spec.js b/test/spec/modules/dgadsBidAdapter_spec.js index 89affd94880..25f484678a0 100644 --- a/test/spec/modules/dgadsBidAdapter_spec.js +++ b/test/spec/modules/dgadsBidAdapter_spec.js @@ -4,17 +4,17 @@ import {spec} from 'modules/dgadsBidAdapter'; import {newBidder} from 'src/adapters/bidderFactory'; import { BANNER, NATIVE } from 'src/mediaTypes'; -describe('dgadsBidAdapter', () => { +describe('dgadsBidAdapter', function () { const adapter = newBidder(spec); const VALID_ENDPOINT = 'https://ads-tr.bigmining.com/ad/p/bid'; - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { 'bidder': 'dgads', params: { @@ -22,11 +22,11 @@ describe('dgadsBidAdapter', () => { location_id: '1' } }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when required params(location_id) are not passed', () => { + it('should return false when required params(location_id) are not passed', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -35,7 +35,7 @@ describe('dgadsBidAdapter', () => { expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should return false when required params(site_id) are not passed', () => { + it('should return false when required params(site_id) are not passed', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -45,7 +45,7 @@ describe('dgadsBidAdapter', () => { }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { const bidRequests = [ { // banner bidder: 'dgads', @@ -97,7 +97,7 @@ describe('dgadsBidAdapter', () => { transactionId: 'c1f1eff6-23c6-4844-a321-575212939e37' } ]; - it('no bidRequests', () => { + it('no bidRequests', function () { const noBidRequests = []; expect(Object.keys(spec.buildRequests(noBidRequests)).length).to.equal(0); }); @@ -107,12 +107,12 @@ describe('dgadsBidAdapter', () => { transaction_id: 'c1f1eff6-23c6-4844-a321-575212939e37', bid_id: '2db3101abaec66' }; - it('sends bid request to VALID_ENDPOINT via POST', () => { + it('sends bid request to VALID_ENDPOINT via POST', function () { const request = spec.buildRequests(bidRequests)[0]; expect(request.url).to.equal(VALID_ENDPOINT); expect(request.method).to.equal('POST'); }); - it('should attache params to the request', () => { + it('should attache params to the request', function () { const request = spec.buildRequests(bidRequests)[0]; expect(request.data['location_id']).to.equal(data['location_id']); expect(request.data['site_id']).to.equal(data['site_id']); @@ -121,7 +121,7 @@ describe('dgadsBidAdapter', () => { }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { const bidRequests = { banner: { bidRequest: { @@ -252,11 +252,11 @@ describe('dgadsBidAdapter', () => { } }; - it('no bid responses', () => { + it('no bid responses', function () { const result = spec.interpretResponse({body: serverResponse.noAd}, bidRequests.banner); expect(result.length).to.equal(0); }); - it('handles banner responses', () => { + it('handles banner responses', function () { const result = spec.interpretResponse({body: serverResponse.banner}, bidRequests.banner)[0]; expect(result.requestId).to.equal(bidResponses.banner.requestId); expect(result.width).to.equal(bidResponses.banner.width); @@ -269,7 +269,7 @@ describe('dgadsBidAdapter', () => { expect(result.ad).to.equal(bidResponses.banner.ad); }); - it('handles native responses', () => { + it('handles native responses', function () { const result = spec.interpretResponse({body: serverResponse.native}, bidRequests.native)[0]; expect(result.requestId).to.equal(bidResponses.native.requestId); expect(result.creativeId).to.equal(bidResponses.native.creativeId); diff --git a/test/spec/modules/districtmDmxBidAdapter_spec.js b/test/spec/modules/districtmDmxBidAdapter_spec.js index cfdab445f71..a0bd76f9591 100644 --- a/test/spec/modules/districtmDmxBidAdapter_spec.js +++ b/test/spec/modules/districtmDmxBidAdapter_spec.js @@ -420,58 +420,58 @@ const responsesNegative = { const emptyResponse = { body: {} }; const emptyResponseSeatBid = { body: { seatbid: [] } }; -describe('DistrictM Adaptor', () => { +describe('DistrictM Adaptor', function () { const districtm = spec; - describe('All needed functions are available', () => { - it(`isBidRequestValid is present and type function`, () => { + describe('All needed functions are available', function () { + it(`isBidRequestValid is present and type function`, function () { expect(districtm.isBidRequestValid).to.exist.and.to.be.a('function') }); - it(`BuildRequests is present and type function`, () => { + it(`BuildRequests is present and type function`, function () { expect(districtm.buildRequests).to.exist.and.to.be.a('function') }); - it(`interpretResponse is present and type function`, () => { + it(`interpretResponse is present and type function`, function () { expect(districtm.interpretResponse).to.exist.and.to.be.a('function') }); - it(`getUserSyncs is present and type function`, () => { + it(`getUserSyncs is present and type function`, function () { expect(districtm.getUserSyncs).to.exist.and.to.be.a('function') }); }); - describe(`these properties are available or not`, () => { - it(`code should have a value of districtmDMX`, () => { + describe(`these properties are available or not`, function () { + it(`code should have a value of districtmDMX`, function () { expect(districtm.code).to.be.equal('districtmDMX'); }); - it(`timeout should not be defined`, () => { + it(`timeout should not be defined`, function () { expect(districtm.onTimeout).to.be.an('undefined'); }); }); - describe(`isBidRequestValid test response`, () => { + describe(`isBidRequestValid test response`, function () { let params = { dmxid: 10001, memberid: 10003, }; - it(`function should return true`, () => { + it(`function should return true`, function () { expect(districtm.isBidRequestValid({params})).to.be.equal(true); }); - it(`function should return false`, () => { + it(`function should return false`, function () { expect(districtm.isBidRequestValid({ params: { memberid: 12345 } })).to.be.equal(false); }); - it(`expect to have two property available dmxid and memberid`, () => { + it(`expect to have two property available dmxid and memberid`, function () { expect(params).to.have.property('dmxid'); expect(params).to.have.property('memberid'); }); }); - describe(`getUserSyncs test usage`, () => { - it(`return value should be an array`, () => { + describe(`getUserSyncs test usage`, function () { + it(`return value should be an array`, function () { expect(districtm.getUserSyncs({ iframeEnabled: true })).to.be.an('array'); }); - it(`array should have only one object and it should have a property type = 'iframe'`, () => { + it(`array should have only one object and it should have a property type = 'iframe'`, function () { expect(districtm.getUserSyncs({ iframeEnabled: true }).length).to.be.equal(1); let [userSync] = districtm.getUserSyncs({ iframeEnabled: true }); expect(userSync).to.have.property('type'); @@ -479,53 +479,53 @@ describe('DistrictM Adaptor', () => { }); }); - describe(`buildRequests test usage`, () => { + describe(`buildRequests test usage`, function () { const buildRequestResults = districtm.buildRequests(bidRequest, bidderRequest); - it(`the function should return an array`, () => { + it(`the function should return an array`, function () { expect(buildRequestResults).to.be.an('object'); }); - it(`the function should return array length of 1`, () => { + it(`the function should return array length of 1`, function () { expect(buildRequestResults.data).to.be.a('string'); }); }); - describe(`interpretResponse test usage`, () => { + describe(`interpretResponse test usage`, function () { const responseResults = districtm.interpretResponse(responses, {bidderRequest}); const emptyResponseResults = districtm.interpretResponse(emptyResponse, {bidderRequest}); const emptyResponseResultsNegation = districtm.interpretResponse(responsesNegative, {bidderRequest}); const emptyResponseResultsEmptySeat = districtm.interpretResponse(emptyResponseSeatBid, {bidderRequest}); - it(`the function should return an array`, () => { + it(`the function should return an array`, function () { expect(responseResults).to.be.an('array'); }); - it(`the function should return array length of 1`, () => { + it(`the function should return array length of 1`, function () { expect(responseResults.length).to.be.equal(1); }); - it(`the response return nothing`, () => { + it(`the response return nothing`, function () { expect(emptyResponseResults.length).to.be.equal(0); }); - it(`the response seatbid return nothing`, () => { + it(`the response seatbid return nothing`, function () { expect(emptyResponseResultsEmptySeat.length).to.be.equal(0); }); - it(`on invalid CPM`, () => { + it(`on invalid CPM`, function () { expect(emptyResponseResultsNegation.length).to.be.equal(0); }); }); - describe(`Helper function testing`, () => { + describe(`Helper function testing`, function () { const bid = matchRequest('29a28a1bbc8a8d', {bidderRequest}); const {width, height} = defaultSize(bid); - it(`test matchRequest`, () => { + it(`test matchRequest`, function () { expect(matchRequest('29a28a1bbc8a8d', {bidderRequest})).to.be.an('object'); }); - it(`test checkDeepArray`, () => { + it(`test checkDeepArray`, function () { expect(_.isEqual(checkDeepArray([728, 90]), [728, 90])).to.be.equal(true); expect(_.isEqual(checkDeepArray([[728, 90]]), [728, 90])).to.be.equal(true); expect(_.isEqual(checkDeepArray([[728, 90], [300, 250]]), [728, 90])).to.be.equal(true); expect(_.isEqual(checkDeepArray([[300, 250], [300, 250]]), [728, 90])).to.be.equal(false); expect(_.isEqual(checkDeepArray([300, 250]), [300, 250])).to.be.equal(true); }); - it(`test defaultSize`, () => { + it(`test defaultSize`, function () { expect(width).to.be.equal(300); expect(height).to.be.equal(250); }); diff --git a/test/spec/modules/divreachBidAdapter_spec.js b/test/spec/modules/divreachBidAdapter_spec.js index 8beb0830385..f874a206a87 100644 --- a/test/spec/modules/divreachBidAdapter_spec.js +++ b/test/spec/modules/divreachBidAdapter_spec.js @@ -6,16 +6,16 @@ const BIDDER_CODE = 'divreach'; const ENDPOINT_URL = '//ads.divreach.com/prebid.1.0.aspx'; const ZONE_ID = '2eb6bd58-865c-47ce-af7f-a918108c3fd2'; -describe('DivReachAdapter', () => { +describe('DivReachAdapter', function () { const adapter = newBidder(spec); - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.be.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { 'bidder': BIDDER_CODE, 'params': { @@ -28,11 +28,11 @@ describe('DivReachAdapter', () => { 'auctionId': '1d1a030790a475', }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -42,7 +42,7 @@ describe('DivReachAdapter', () => { }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let bidRequests = [ { 'bidder': BIDDER_CODE, @@ -57,21 +57,21 @@ describe('DivReachAdapter', () => { } ]; - it('should add referrer and imp to be equal bidRequest', () => { + it('should add referrer and imp to be equal bidRequest', function () { const request = spec.buildRequests(bidRequests); const payload = JSON.parse(request.data.substr(5)); expect(payload.referrer).to.not.be.undefined; expect(payload.imps[0]).to.deep.equal(bidRequests[0]); }); - it('sends bid request to ENDPOINT via GET', () => { + it('sends bid request to ENDPOINT via GET', function () { const request = spec.buildRequests(bidRequests); expect(request.url).to.equal(ENDPOINT_URL); expect(request.method).to.equal('GET'); }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { let response = { body: [{ 'currency': 'USD', @@ -86,7 +86,7 @@ describe('DivReachAdapter', () => { }] }; - it('should get correct bid response', () => { + it('should get correct bid response', function () { const body = response.body; let expectedResponse = [ { @@ -107,7 +107,7 @@ describe('DivReachAdapter', () => { expect(result[0]).to.deep.equal(expectedResponse[0]); }); - it('handles nobid responses', () => { + it('handles nobid responses', function () { let response = []; let result = spec.interpretResponse(response); diff --git a/test/spec/modules/ebdrBidAdapter_spec.js b/test/spec/modules/ebdrBidAdapter_spec.js index 3ec5a4f0a81..d742e28f2e6 100644 --- a/test/spec/modules/ebdrBidAdapter_spec.js +++ b/test/spec/modules/ebdrBidAdapter_spec.js @@ -3,10 +3,10 @@ import { spec } from 'modules/ebdrBidAdapter'; import { VIDEO, BANNER } from 'src/mediaTypes'; import * as utils from 'src/utils'; -describe('ebdrBidAdapter', () => { +describe('ebdrBidAdapter', function () { let bidRequests; - beforeEach(() => { + beforeEach(function () { bidRequests = [ { code: 'div-gpt-ad-1460505748561-0', @@ -51,13 +51,13 @@ describe('ebdrBidAdapter', () => { ]; }); - describe('spec.isBidRequestValid', () => { - it('should return true when the required params are passed', () => { + describe('spec.isBidRequestValid', function () { + it('should return true when the required params are passed', function () { const bidRequest = bidRequests[0]; expect(spec.isBidRequestValid(bidRequest)).to.equal(true); }); - it('should return true when the only required param is missing', () => { + it('should return true when the only required param is missing', function () { const bidRequest = bidRequests[0]; bidRequest.params = { zoneid: '99998', @@ -66,7 +66,7 @@ describe('ebdrBidAdapter', () => { expect(spec.isBidRequestValid(bidRequest)).to.equal(true); }); - it('should return true when the "bidfloor" param is missing', () => { + it('should return true when the "bidfloor" param is missing', function () { const bidRequest = bidRequests[0]; bidRequest.params = { zoneid: '99998', @@ -74,34 +74,34 @@ describe('ebdrBidAdapter', () => { expect(spec.isBidRequestValid(bidRequest)).to.equal(true); }); - it('should return false when no bid params are passed', () => { + it('should return false when no bid params are passed', function () { const bidRequest = bidRequests[0]; bidRequest.params = {}; expect(spec.isBidRequestValid(bidRequest)).to.equal(false); }); - it('should return false when a bid request is not passed', () => { + it('should return false when a bid request is not passed', function () { expect(spec.isBidRequestValid()).to.equal(false); expect(spec.isBidRequestValid({})).to.equal(false); }); }); - describe('spec.buildRequests', () => { - describe('for banner bids', () => { - it('must handle an empty bid size', () => { + describe('spec.buildRequests', function () { + describe('for banner bids', function () { + it('must handle an empty bid size', function () { bidRequests[0].mediaTypes = { banner: {} }; const requests = spec.buildRequests(bidRequests); const bidRequest = {}; bidRequest['2c5e8a1a84522d'] = { mediaTypes: BANNER, w: null, h: null }; expect(requests.bids['2c5e8a1a84522d']).to.deep.equals(bidRequest['2c5e8a1a84522d']); }); - it('should create a single GET', () => { + it('should create a single GET', function () { bidRequests[0].mediaTypes = { banner: {} }; bidRequests[1].mediaTypes = { banner: {} }; const requests = spec.buildRequests(bidRequests); expect(requests.method).to.equal('GET'); }); - it('must parse bid size from a nested array', () => { + it('must parse bid size from a nested array', function () { const width = 640; const height = 480; const bidRequest = bidRequests[0]; @@ -112,8 +112,8 @@ describe('ebdrBidAdapter', () => { expect(requests.bids['2c5e8a1a84522d']).to.deep.equal(data['2c5e8a1a84522d']); }); }); - describe('for video bids', () => { - it('must handle an empty bid size', () => { + describe('for video bids', function () { + it('must handle an empty bid size', function () { bidRequests[1].mediaTypes = { video: {} }; const requests = spec.buildRequests(bidRequests); const bidRequest = {}; @@ -121,7 +121,7 @@ describe('ebdrBidAdapter', () => { expect(requests.bids['23a01e95856577']).to.deep.equals(bidRequest['23a01e95856577']); }); - it('should create a GET request for each bid', () => { + it('should create a GET request for each bid', function () { const bidRequest = bidRequests[1]; const requests = spec.buildRequests([ bidRequest ]); expect(requests.method).to.equal('GET'); @@ -129,16 +129,16 @@ describe('ebdrBidAdapter', () => { }); }); - describe('spec.interpretResponse', () => { - describe('for video bids', () => { - it('should return no bids if the response is not valid', () => { + describe('spec.interpretResponse', function () { + describe('for video bids', function () { + it('should return no bids if the response is not valid', function () { const bidRequest = bidRequests[0]; bidRequest.mediaTypes = { video: {} }; const bidResponse = spec.interpretResponse({ body: null }, { bidRequest }); expect(bidResponse.length).to.equal(0); }); - it('should return a valid video bid response', () => { + it('should return a valid video bid response', function () { const ebdrReq = {bids: {}}; bidRequests.forEach(bid => { let _mediaTypes = (bid.mediaTypes && bid.mediaTypes.video ? VIDEO : BANNER); @@ -165,22 +165,22 @@ describe('ebdrBidAdapter', () => { }); }); - describe('for banner bids', () => { - it('should return no bids if the response is not valid', () => { + describe('for banner bids', function () { + it('should return no bids if the response is not valid', function () { const bidRequest = bidRequests[0]; bidRequest.mediaTypes = { banner: {} }; const bidResponse = spec.interpretResponse({ body: null }, { bidRequest }); expect(bidResponse.length).to.equal(0); }); - it('should return no bids if the response is empty', () => { + it('should return no bids if the response is empty', function () { const bidRequest = bidRequests[0]; bidRequest.mediaTypes = { banner: {} }; const bidResponse = spec.interpretResponse({ body: [] }, { bidRequest }); expect(bidResponse.length).to.equal(0); }); - it('should return valid banner bid responses', () => { + it('should return valid banner bid responses', function () { const ebdrReq = {bids: {}}; bidRequests.forEach(bid => { let _mediaTypes = (bid.mediaTypes && bid.mediaTypes.video ? VIDEO : BANNER); @@ -206,27 +206,27 @@ describe('ebdrBidAdapter', () => { }); }); }); - describe('spec.getUserSyncs', () => { + describe('spec.getUserSyncs', function () { let syncOptions - beforeEach(() => { + beforeEach(function () { syncOptions = { enabledBidders: ['ebdr'], // only these bidders are allowed to sync pixelEnabled: true } }); - it('sucess with usersync url', () => { + it('sucess with usersync url', function () { const serverResponse = {id: '1d0c4017f02458', seatbid: [{bid: [{id: '2c5e8a1a84522d', impid: '2c5e8a1a84522d', price: 0.81, adid: 'abcde-12345', nurl: '', adm: '
', adomain: ['advertiserdomain.com'], iurl: '//match.bnmla.com/usersync?sspid=59&redir=', cid: 'campaign1', crid: 'abcde-12345', w: 300, h: 250}], seat: '19513bcfca8006'}], bidid: '19513bcfca8006', cur: 'USD', w: 300, h: 250}; const result = []; result.push({type: 'image', url: '//match.bnmla.com/usersync?sspid=59&redir='}); expect(spec.getUserSyncs(syncOptions, { body: serverResponse })).to.deep.equal(result); }); - it('sucess without usersync url', () => { + it('sucess without usersync url', function () { const serverResponse = {id: '1d0c4017f02458', seatbid: [{bid: [{id: '2c5e8a1a84522d', impid: '2c5e8a1a84522d', price: 0.81, adid: 'abcde-12345', nurl: '', adm: '
', adomain: ['advertiserdomain.com'], iurl: '', cid: 'campaign1', crid: 'abcde-12345', w: 300, h: 250}], seat: '19513bcfca8006'}], bidid: '19513bcfca8006', cur: 'USD', w: 300, h: 250}; const result = []; expect(spec.getUserSyncs(syncOptions, { body: serverResponse })).to.deep.equal(result); }); - it('empty response', () => { + it('empty response', function () { const serverResponse = {}; const result = []; expect(spec.getUserSyncs(syncOptions, { body: serverResponse })).to.deep.equal(result); diff --git a/test/spec/modules/eplanningAnalyticsAdapter_spec.js b/test/spec/modules/eplanningAnalyticsAdapter_spec.js index cd538815954..2b10f10adf2 100644 --- a/test/spec/modules/eplanningAnalyticsAdapter_spec.js +++ b/test/spec/modules/eplanningAnalyticsAdapter_spec.js @@ -6,25 +6,25 @@ let adaptermanager = require('src/adaptermanager'); let events = require('src/events'); let constants = require('src/constants.json'); -describe('eplanning analytics adapter', () => { +describe('eplanning analytics adapter', function () { let xhr; let requests; - beforeEach(() => { + beforeEach(function () { xhr = sinon.useFakeXMLHttpRequest(); requests = []; xhr.onCreate = request => { requests.push(request) }; sinon.stub(events, 'getEvents').returns([]); }); - afterEach(() => { + afterEach(function () { xhr.restore(); events.getEvents.restore(); eplAnalyticsAdapter.disableAnalytics(); }); - describe('track', () => { - it('builds and sends auction data', () => { + describe('track', function () { + it('builds and sends auction data', function () { sinon.spy(eplAnalyticsAdapter, 'track'); let auctionTimestamp = 1496510254313; diff --git a/test/spec/modules/eplanningBidAdapter_spec.js b/test/spec/modules/eplanningBidAdapter_spec.js index a56bff42285..80129a03bd2 100644 --- a/test/spec/modules/eplanningBidAdapter_spec.js +++ b/test/spec/modules/eplanningBidAdapter_spec.js @@ -3,7 +3,7 @@ import { spec } from 'modules/eplanningBidAdapter'; import { newBidder } from 'src/adapters/bidderFactory'; import * as utils from 'src/utils'; -describe('E-Planning Adapter', () => { +describe('E-Planning Adapter', function () { const adapter = newBidder('spec'); const CI = '12345'; const ADUNIT_CODE = 'adunit-code'; @@ -167,55 +167,55 @@ describe('E-Planning Adapter', () => { } }; - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { - it('should return true when bid has ci parameter', () => { + describe('isBidRequestValid', function () { + it('should return true when bid has ci parameter', function () { expect(spec.isBidRequestValid(validBid)).to.equal(true); }); - it('should return false when bid does not have ci parameter and is not a test bid', () => { + it('should return false when bid does not have ci parameter and is not a test bid', function () { expect(spec.isBidRequestValid(invalidBid)).to.equal(false); }); - it('should return true when bid does not have ci parameter but is a test bid', () => { + it('should return true when bid does not have ci parameter but is a test bid', function () { expect(spec.isBidRequestValid(testBid)).to.equal(true); }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let bidRequests = [validBid]; - it('should create the url correctly', () => { + it('should create the url correctly', function () { const url = spec.buildRequests(bidRequests).url; expect(url).to.equal('//ads.us.e-planning.net/hb/1/' + CI + '/1/localhost/ROS'); }); - it('should return GET method', () => { + it('should return GET method', function () { const method = spec.buildRequests(bidRequests).method; expect(method).to.equal('GET'); }); - it('should return r parameter with value pbjs', () => { + it('should return r parameter with value pbjs', function () { const r = spec.buildRequests(bidRequests).data.r; expect(r).to.equal('pbjs'); }); - it('should return pbv parameter with value prebid version', () => { + it('should return pbv parameter with value prebid version', function () { const pbv = spec.buildRequests(bidRequests).data.pbv; expect(pbv).to.equal('$prebid.version$'); }); - it('should return e parameter with value according to the adunit sizes', () => { + it('should return e parameter with value according to the adunit sizes', function () { const e = spec.buildRequests(bidRequests).data.e; expect(e).to.equal(CLEAN_ADUNIT_CODE + ':300x250,300x600'); }); - it('should return correct e parameter with more than one adunit', () => { + it('should return correct e parameter with more than one adunit', function () { const NEW_CODE = ADUNIT_CODE + '2'; const CLEAN_NEW_CODE = CLEAN_ADUNIT_CODE + '2'; const anotherBid = { @@ -232,7 +232,7 @@ describe('E-Planning Adapter', () => { expect(e).to.equal(CLEAN_ADUNIT_CODE + ':300x250,300x600+' + CLEAN_NEW_CODE + ':100x100'); }); - it('should return correct e parameter when the adunit has no size', () => { + it('should return correct e parameter when the adunit has no size', function () { const noSizeBid = { 'bidder': 'eplanning', 'params': { @@ -245,12 +245,12 @@ describe('E-Planning Adapter', () => { expect(e).to.equal(CLEAN_ADUNIT_CODE + ':1x1'); }); - it('should return ur parameter with current window url', () => { + it('should return ur parameter with current window url', function () { const ur = spec.buildRequests(bidRequests).data.ur; expect(ur).to.equal(utils.getTopWindowUrl()); }); - it('should return fr parameter when there is a referrer', () => { + it('should return fr parameter when there is a referrer', function () { const referrer = 'thisisafakereferrer'; const stubGetReferrer = sinon.stub(utils, 'getTopWindowReferrer'); stubGetReferrer.returns(referrer); @@ -259,7 +259,7 @@ describe('E-Planning Adapter', () => { stubGetReferrer.restore() }); - it('should return crs parameter with document charset', () => { + it('should return crs parameter with document charset', function () { let expected; try { expected = window.top.document.characterSet; @@ -272,30 +272,30 @@ describe('E-Planning Adapter', () => { expect(chset).to.equal(expected); }); - it('should return the testing url when the request has the t parameter', () => { + it('should return the testing url when the request has the t parameter', function () { const url = spec.buildRequests([testBid]).url; const expectedUrl = '//' + TEST_ISV + '/layers/t_pbjs_2.json'; expect(url).to.equal(expectedUrl); }); - it('should return the parameter ncb with value 1', () => { + it('should return the parameter ncb with value 1', function () { const ncb = spec.buildRequests(bidRequests).data.ncb; expect(ncb).to.equal('1'); }); }); - describe('interpretResponse', () => { - it('should return an empty array when there is no ads in the response', () => { + describe('interpretResponse', function () { + it('should return an empty array when there is no ads in the response', function () { const bidResponses = spec.interpretResponse(responseWithNoAd); expect(bidResponses).to.be.empty; }); - it('should return an empty array when there is no spaces in the response', () => { + it('should return an empty array when there is no spaces in the response', function () { const bidResponses = spec.interpretResponse(responseWithNoSpace); expect(bidResponses).to.be.empty; }); - it('should correctly map the parameters in the response', () => { + it('should correctly map the parameters in the response', function () { const bidResponse = spec.interpretResponse(response, { adUnitToBidId: { [CLEAN_ADUNIT_CODE]: BID_ID } })[0]; const expectedResponse = { requestId: BID_ID, @@ -312,7 +312,7 @@ describe('E-Planning Adapter', () => { }); }); - describe('getUserSyncs', () => { + describe('getUserSyncs', function () { const sOptionsAllEnabled = { pixelEnabled: true, iframeEnabled: true @@ -330,30 +330,30 @@ describe('E-Planning Adapter', () => { iframeEnabled: true }; - it('should return an empty array if the response has no syncs', () => { + it('should return an empty array if the response has no syncs', function () { const noSyncsResponse = { cs: [] }; const syncs = spec.getUserSyncs(sOptionsAllEnabled, [noSyncsResponse]); expect(syncs).to.be.empty; }); - it('should return an empty array if there is no sync options enabled', () => { + it('should return an empty array if there is no sync options enabled', function () { const syncs = spec.getUserSyncs(sOptionsAllDisabled, [response]); expect(syncs).to.be.empty; }); - it('should only return pixels if iframe is not enabled', () => { + it('should only return pixels if iframe is not enabled', function () { const syncs = spec.getUserSyncs(sOptionsOnlyPixel, [response]); syncs.forEach(sync => expect(sync.type).to.equal('image')); }); - it('should only return iframes if pixel is not enabled', () => { + it('should only return iframes if pixel is not enabled', function () { const syncs = spec.getUserSyncs(sOptionsOnlyIframe, [response]); syncs.forEach(sync => expect(sync.type).to.equal('iframe')); }); }); - describe('adUnits mapping to bidId', () => { - it('should correctly map the bidId to the adunit', () => { + describe('adUnits mapping to bidId', function () { + it('should correctly map the bidId to the adunit', function () { const requests = spec.buildRequests([validBid, validBid2]); const responses = spec.interpretResponse(responseWithTwoAdunits, requests); expect(responses[0].requestId).to.equal(BID_ID); diff --git a/test/spec/modules/etargetBidAdapter_spec.js b/test/spec/modules/etargetBidAdapter_spec.js index 2af61505afa..e4cccbf5cf3 100644 --- a/test/spec/modules/etargetBidAdapter_spec.js +++ b/test/spec/modules/etargetBidAdapter_spec.js @@ -3,10 +3,10 @@ import * as url from 'src/url'; import {spec} from 'modules/etargetBidAdapter'; import { BANNER, VIDEO } from 'src/mediaTypes'; -describe('etarget adapter', () => { +describe('etarget adapter', function () { let serverResponse, bidRequest, bidResponses; let bids = []; - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { 'bidder': 'etarget', 'params': { @@ -15,29 +15,29 @@ describe('etarget adapter', () => { } }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { assert(spec.isBidRequestValid(bid)); }); }); - describe('buildRequests', () => { - it('should pass multiple bids via single request', () => { + describe('buildRequests', function () { + it('should pass multiple bids via single request', function () { let request = spec.buildRequests(bids); let parsedUrl = parseUrl(request.url); assert.lengthOf(parsedUrl.items, 7); }); - it('should handle global request parameters', () => { + it('should handle global request parameters', function () { let parsedUrl = parseUrl(spec.buildRequests([bids[0]]).url); assert.equal(parsedUrl.path, '//sk.search.etargetnet.com/hb'); }); - it('should set correct request method', () => { + it('should set correct request method', function () { let request = spec.buildRequests([bids[0]]); assert.equal(request.method, 'POST'); }); - it('should correctly form bid items', () => { + it('should correctly form bid items', function () { let bidList = bids; let request = spec.buildRequests(bidList); let parsedUrl = parseUrl(request.url); @@ -88,14 +88,14 @@ describe('etarget adapter', () => { ]); }); - it('should not change original validBidRequests object', () => { + it('should not change original validBidRequests object', function () { var resultBids = JSON.parse(JSON.stringify(bids[0])); let request = spec.buildRequests([bids[0]]); assert.deepEqual(resultBids, bids[0]); }); - describe('gdpr', () => { - it('should send GDPR Consent data to etarget if gdprApplies', () => { + describe('gdpr', function () { + it('should send GDPR Consent data to etarget if gdprApplies', function () { let resultBids = JSON.parse(JSON.stringify(bids[0])); let request = spec.buildRequests([bids[0]], {gdprConsent: {gdprApplies: true, consentString: 'concentDataString'}}); let parsedUrl = parseUrl(request.url).query; @@ -104,7 +104,7 @@ describe('etarget adapter', () => { assert.equal(parsedUrl.gdpr_consent, 'concentDataString'); }); - it('should not send GDPR Consent data to etarget if gdprApplies is false or undefined', () => { + it('should not send GDPR Consent data to etarget if gdprApplies is false or undefined', function () { let resultBids = JSON.parse(JSON.stringify(bids[0])); let request = spec.buildRequests([bids[0]], {gdprConsent: {gdprApplies: false, consentString: 'concentDataString'}}); let parsedUrl = parseUrl(request.url).query; @@ -117,7 +117,7 @@ describe('etarget adapter', () => { assert.ok(!parsedUrl.gdpr_consent); }); - it('should return GDPR Consent data with request data', () => { + it('should return GDPR Consent data with request data', function () { let request = spec.buildRequests([bids[0]], {gdprConsent: {gdprApplies: true, consentString: 'concentDataString'}}); assert.deepEqual(request.gdpr, { @@ -131,12 +131,12 @@ describe('etarget adapter', () => { }); }); - describe('interpretResponse', () => { - it('should respond with empty response when there is empty serverResponse', () => { + describe('interpretResponse', function () { + it('should respond with empty response when there is empty serverResponse', function () { let result = spec.interpretResponse({ body: {} }, {}); assert.deepEqual(result, []); }); - it('should respond with empty response when response from server is not banner', () => { + it('should respond with empty response when response from server is not banner', function () { serverResponse.body[0].response = 'not banner'; serverResponse.body = [serverResponse.body[0]]; bidRequest.bids = [bidRequest.bids[0]]; @@ -144,7 +144,7 @@ describe('etarget adapter', () => { assert.deepEqual(result, []); }); - it('should interpret server response correctly with one bid', () => { + it('should interpret server response correctly with one bid', function () { serverResponse.body = [serverResponse.body[0]]; bidRequest.bids = [bidRequest.bids[0]]; let result = spec.interpretResponse(serverResponse, bidRequest)[0]; @@ -160,7 +160,7 @@ describe('etarget adapter', () => { assert.equal(result.transactionId, '5f33781f-9552-4ca1'); }); - it('should set correct netRevenue', () => { + it('should set correct netRevenue', function () { serverResponse.body = [serverResponse.body[0]]; bidRequest.bids = [bidRequest.bids[1]]; bidRequest.netRevenue = 'net'; @@ -169,22 +169,22 @@ describe('etarget adapter', () => { assert.equal(result.netRevenue, true); }); - it('should create bid response item for every requested item', () => { + it('should create bid response item for every requested item', function () { let result = spec.interpretResponse(serverResponse, bidRequest); assert.lengthOf(result, 5); }); - it('should create bid response with vast xml', () => { + it('should create bid response with vast xml', function () { const result = spec.interpretResponse(serverResponse, bidRequest)[3]; assert.equal(result.vastXml, ''); }); - it('should create bid response with vast url', () => { + it('should create bid response with vast url', function () { const result = spec.interpretResponse(serverResponse, bidRequest)[4]; assert.equal(result.vastUrl, 'vast://url'); }); - it('should set mediaType on bid response', () => { + it('should set mediaType on bid response', function () { const expected = [ BANNER, BANNER, BANNER, VIDEO, VIDEO ]; const result = spec.interpretResponse(serverResponse, bidRequest); for (let i = 0; i < result.length; i++) { @@ -192,7 +192,7 @@ describe('etarget adapter', () => { } }); - it('should set default netRevenue as gross', () => { + it('should set default netRevenue as gross', function () { bidRequest.netRevenue = 'gross'; const result = spec.interpretResponse(serverResponse, bidRequest); for (let i = 0; i < result.length; i++) { @@ -200,7 +200,7 @@ describe('etarget adapter', () => { } }); - it('should set gdpr if it exist in bidRequest', () => { + it('should set gdpr if it exist in bidRequest', function () { bidRequest.gdpr = { gdpr: true, gdpr_consent: 'ERW342EIOWT34234KMGds' @@ -219,8 +219,8 @@ describe('etarget adapter', () => { }; }); - describe('verifySizes', () => { - it('should respond with empty response when sizes doesn\'t match', () => { + describe('verifySizes', function () { + it('should respond with empty response when sizes doesn\'t match', function () { serverResponse.body[0].response = 'banner'; serverResponse.body[0].width = 100; serverResponse.body[0].height = 150; @@ -233,7 +233,7 @@ describe('etarget adapter', () => { assert.equal(serverResponse.body[0].response, 'banner'); assert.deepEqual(result, []); }); - it('should respond with empty response when sizes as a strings doesn\'t match', () => { + it('should respond with empty response when sizes as a strings doesn\'t match', function () { serverResponse.body[0].response = 'banner'; serverResponse.body[0].width = 100; serverResponse.body[0].height = 150; @@ -248,7 +248,7 @@ describe('etarget adapter', () => { assert.equal(serverResponse.body[0].response, 'banner'); assert.deepEqual(result, []); }); - it('should support size dimensions as a strings', () => { + it('should support size dimensions as a strings', function () { serverResponse.body[0].response = 'banner'; serverResponse.body[0].width = 300; serverResponse.body[0].height = 600; @@ -265,7 +265,7 @@ describe('etarget adapter', () => { }) }); - beforeEach(() => { + beforeEach(function () { let sizes = [[250, 300], [300, 250], [300, 600]]; let placementCode = ['div-01', 'div-02', 'div-03', 'div-04', 'div-05']; let params = [{refid: 1, country: 1, url: 'some// there'}, {refid: 2, country: 1, someVar: 'someValue', pt: 'gross'}, {refid: 3, country: 1, pdom: 'home'}, {refid: 5, country: 1, pt: 'net'}, {refid: 6, country: 1, pt: 'gross'}]; diff --git a/test/spec/modules/fairtradeBidAdapter_spec.js b/test/spec/modules/fairtradeBidAdapter_spec.js index 07c26e8f0c1..ecd5db3c051 100644 --- a/test/spec/modules/fairtradeBidAdapter_spec.js +++ b/test/spec/modules/fairtradeBidAdapter_spec.js @@ -5,13 +5,13 @@ import { newBidder } from 'src/adapters/bidderFactory'; describe('FairTradeAdapter', function () { const adapter = newBidder(spec); - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { 'bidder': 'fairtrade', 'params': { @@ -24,11 +24,11 @@ describe('FairTradeAdapter', function () { 'auctionId': '1d1a030790a475', }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -38,7 +38,7 @@ describe('FairTradeAdapter', function () { }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let bidRequests = [ { 'bidder': 'fairtrade', @@ -75,7 +75,7 @@ describe('FairTradeAdapter', function () { } ]; - it('should attach valid params to the tag', () => { + it('should attach valid params to the tag', function () { const request = spec.buildRequests([bidRequests[0]]); const payload = request.data; expect(payload).to.be.an('object'); @@ -85,7 +85,7 @@ describe('FairTradeAdapter', function () { expect(payload).to.have.property('r', '22edbae2733bf6'); }); - it('auids must not be duplicated', () => { + it('auids must not be duplicated', function () { const request = spec.buildRequests(bidRequests); const payload = request.data; expect(payload).to.be.an('object'); @@ -95,7 +95,7 @@ describe('FairTradeAdapter', function () { expect(payload).to.have.property('r', '22edbae2733bf6'); }); - it('pt parameter must be "gross" if params.priceType === "gross"', () => { + it('pt parameter must be "gross" if params.priceType === "gross"', function () { bidRequests[1].params.priceType = 'gross'; const request = spec.buildRequests(bidRequests); const payload = request.data; @@ -107,7 +107,7 @@ describe('FairTradeAdapter', function () { delete bidRequests[1].params.priceType; }); - it('pt parameter must be "net" or "gross"', () => { + it('pt parameter must be "net" or "gross"', function () { bidRequests[1].params.priceType = 'some'; const request = spec.buildRequests(bidRequests); const payload = request.data; @@ -120,7 +120,7 @@ describe('FairTradeAdapter', function () { }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { const responses = [ {'bid': [{'price': 1.15, 'adm': '
test content 1
', 'auid': 165, 'h': 250, 'w': 300}], 'seat': '1'}, {'bid': [{'price': 0.5, 'adm': '
test content 2
', 'auid': 166, 'h': 90, 'w': 728}], 'seat': '1'}, @@ -131,7 +131,7 @@ describe('FairTradeAdapter', function () { {'seat': '1'}, ]; - it('should get correct bid response', () => { + it('should get correct bid response', function () { const bidRequests = [ { 'bidder': 'fairtrade', @@ -165,7 +165,7 @@ describe('FairTradeAdapter', function () { expect(result).to.deep.equal(expectedResponse); }); - it('should get correct multi bid response', () => { + it('should get correct multi bid response', function () { const bidRequests = [ { 'bidder': 'fairtrade', @@ -245,7 +245,7 @@ describe('FairTradeAdapter', function () { expect(result).to.deep.equal(expectedResponse); }); - it('handles wrong and nobid responses', () => { + it('handles wrong and nobid responses', function () { const bidRequests = [ { 'bidder': 'fairtrade', diff --git a/test/spec/modules/fidelityBidAdapter_spec.js b/test/spec/modules/fidelityBidAdapter_spec.js index 007f4e6b480..e8e008103e6 100644 --- a/test/spec/modules/fidelityBidAdapter_spec.js +++ b/test/spec/modules/fidelityBidAdapter_spec.js @@ -2,16 +2,16 @@ import { expect } from 'chai'; import { spec } from 'modules/fidelityBidAdapter'; import { newBidder } from 'src/adapters/bidderFactory'; -describe('FidelityAdapter', () => { +describe('FidelityAdapter', function () { const adapter = newBidder(spec); - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { 'bidder': 'fidelity', 'params': { @@ -26,11 +26,11 @@ describe('FidelityAdapter', () => { 'auctionId': '1d1a030790a475', }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return true when required params found', () => { + it('should return true when required params found', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -39,7 +39,7 @@ describe('FidelityAdapter', () => { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -49,7 +49,7 @@ describe('FidelityAdapter', () => { }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let bidderRequest = { bidderCode: 'fidelity', requestId: 'c45dd708-a418-42ec-b8a7-b70a6c6fab0a', @@ -75,7 +75,7 @@ describe('FidelityAdapter', () => { timeout: 5000 }; - it('should add source and verison to the tag', () => { + it('should add source and verison to the tag', function () { const [request] = spec.buildRequests(bidderRequest.bids, bidderRequest); const payload = request.data; expect(payload.from).to.exist; @@ -91,7 +91,7 @@ describe('FidelityAdapter', () => { expect(payload.defloc).to.exist; }); - it('should add gdpr consent information to the request', () => { + it('should add gdpr consent information to the request', function () { let consentString = 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A=='; bidderRequest.gdprConsent = { gdprApplies: true, @@ -112,14 +112,14 @@ describe('FidelityAdapter', () => { expect(payload.consent_given).to.equal(1); }); - it('sends bid request to ENDPOINT via GET', () => { + it('sends bid request to ENDPOINT via GET', function () { const [request] = spec.buildRequests(bidderRequest.bids, bidderRequest); expect(request.url).to.equal('//t.fidelity-media.com/delivery/hb.php'); expect(request.method).to.equal('GET'); }); }) - describe('interpretResponse', () => { + describe('interpretResponse', function () { let response = { 'id': '543210', 'seatbid': [ { @@ -134,7 +134,7 @@ describe('FidelityAdapter', () => { } ] }; - it('should get correct bid response', () => { + it('should get correct bid response', function () { let expectedResponse = [ { requestId: 'bidId-123456-1', @@ -153,7 +153,7 @@ describe('FidelityAdapter', () => { expect(Object.keys(result[0])).to.deep.equal(Object.keys(expectedResponse[0])); }); - it('handles nobid responses', () => { + it('handles nobid responses', function () { let response = { 'id': '543210', 'seatbid': [ ] @@ -164,10 +164,10 @@ describe('FidelityAdapter', () => { }); }); - describe('user sync', () => { + describe('user sync', function () { const syncUrl = '//x.fidelity-media.com/delivery/matches.php?type=iframe'; - it('should register the sync iframe', () => { + it('should register the sync iframe', function () { expect(spec.getUserSyncs({})).to.be.undefined; expect(spec.getUserSyncs({iframeEnabled: false})).to.be.undefined; const options = spec.getUserSyncs({iframeEnabled: true}); diff --git a/test/spec/modules/freewheel-sspBidAdapter_spec.js b/test/spec/modules/freewheel-sspBidAdapter_spec.js index 00c725027a1..adc6e1bcde4 100644 --- a/test/spec/modules/freewheel-sspBidAdapter_spec.js +++ b/test/spec/modules/freewheel-sspBidAdapter_spec.js @@ -1,197 +1,197 @@ -import { expect } from 'chai'; -import { spec } from 'modules/freewheel-sspBidAdapter'; -import { newBidder } from 'src/adapters/bidderFactory'; - -const ENDPOINT = '//ads.stickyadstv.com/www/delivery/swfIndex.php'; - -describe('freewheel-ssp BidAdapter Test', () => { - const adapter = newBidder(spec); - - describe('inherited functions', () => { - it('exists and is a function', () => { - expect(adapter.callBids).to.exist.and.to.be.a('function'); - }); - }); - - describe('isBidRequestValid', () => { - let bid = { - 'bidder': 'freewheel-ssp', - 'params': { - 'zoneId': '277225' - }, - 'adUnitCode': 'adunit-code', - 'sizes': [[300, 250], [300, 600]], - 'bidId': '30b31c1838de1e', - 'bidderRequestId': '22edbae2733bf6', - 'auctionId': '1d1a030790a475', - }; - - it('should return true when required params found', () => { - expect(spec.isBidRequestValid(bid)).to.equal(true); - }); - - it('should return false when required params are not passed', () => { - let bid = Object.assign({}, bid); - delete bid.params; - bid.params = { - wrong: 'missing zone id' - }; - expect(spec.isBidRequestValid(bid)).to.equal(false); - }); - }); - - describe('buildRequests', () => { - let bidRequests = [ - { - 'bidder': 'freewheel-ssp', - 'params': { - 'zoneId': '277225' - }, - 'adUnitCode': 'adunit-code', - 'sizes': [[300, 250], [300, 600]], - 'bidId': '30b31c1838de1e', - 'bidderRequestId': '22edbae2733bf6', - 'auctionId': '1d1a030790a475', - 'gdprConsent': { - 'consentString': 'BOJ/P2HOJ/P2HABABMAAAAAZ+A==', - 'gdprApplies': true - } - } - ]; - - it('should add parameters to the tag', () => { - const request = spec.buildRequests(bidRequests, bidRequests[0]); - const payload = request.data; - expect(payload.reqType).to.equal('AdsSetup'); - expect(payload.protocolVersion).to.equal('2.0'); - expect(payload.zoneId).to.equal('277225'); - expect(payload.componentId).to.equal('mustang'); - expect(payload.playerSize).to.equal('300x600'); - expect(payload._fw_gdpr).to.equal(true); - expect(payload._fw_gdpr_consent).to.equal('BOJ/P2HOJ/P2HABABMAAAAAZ+A=='); - }); - - it('sends bid request to ENDPOINT via GET', () => { - const request = spec.buildRequests(bidRequests, bidRequests[0]); - expect(request.url).to.contain(ENDPOINT); - expect(request.method).to.equal('GET'); - }); - }) - - describe('interpretResponse', () => { - let bidRequests = [ - { - 'bidder': 'freewheel-ssp', - 'params': { - 'zoneId': '277225' - }, - 'adUnitCode': 'adunit-code', - 'sizes': [[300, 250], [300, 600]], - 'bidId': '30b31c1838de1e', - 'bidderRequestId': '22edbae2733bf6', - 'auctionId': '1d1a030790a475', - } - ]; - - let formattedBidRequests = [ - { - 'bidder': 'freewheel-ssp', - 'params': { - 'zoneId': '277225', - 'format': 'floorad' - }, - 'adUnitCode': 'adunit-code', - 'sizes': [[600, 250], [300, 600]], - 'bidId': '30b3other1c1838de1e', - 'bidderRequestId': '22edbae273other3bf6', - 'auctionId': '1d1a03079test0a475', - }, - { - 'bidder': 'stickyadstv', - 'params': { - 'zoneId': '277225', - 'format': 'test' - }, - 'adUnitCode': 'adunit-code', - 'sizes': [[300, 600]], - 'bidId': '2', - 'bidderRequestId': '3', - 'auctionId': '4', - } - ]; - - let response = '' + - '' + - ' ' + - ' Adswizz' + - ' ' + - ' ' + - ' ' + - ' 00:00:09' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - ' 0.2000' + - ' ' + - ' ' + - ' ' + - ''; - - let ad = '
'; - let formattedAd = '
'; - - it('should get correct bid response', () => { - var request = spec.buildRequests(formattedBidRequests, formattedBidRequests[0]); - - let expectedResponse = [ - { - requestId: '30b31c1838de1e', - cpm: '0.2000', - width: 300, - height: 600, - creativeId: '28517153', - currency: 'EUR', - netRevenue: true, - ttl: 360, - ad: ad - } - ]; - - let result = spec.interpretResponse(response, request); - expect(Object.keys(result[0])).to.deep.equal(Object.keys(expectedResponse[0])); - }); - - it('should get correct bid response with formated ad', () => { - var request = spec.buildRequests(formattedBidRequests, formattedBidRequests[0]); - - let expectedResponse = [ - { - requestId: '30b31c1838de1e', - cpm: '0.2000', - width: 300, - height: 600, - creativeId: '28517153', - currency: 'EUR', - netRevenue: true, - ttl: 360, - ad: formattedAd - } - ]; - - let result = spec.interpretResponse(response, request); - expect(Object.keys(result[0])).to.deep.equal(Object.keys(expectedResponse[0])); - }); - - it('handles nobid responses', () => { - var reqest = spec.buildRequests(formattedBidRequests, formattedBidRequests[0]); - let response = ''; - - let result = spec.interpretResponse(response, reqest); - expect(result.length).to.equal(0); - }); - }); -}); +import { expect } from 'chai'; +import { spec } from 'modules/freewheel-sspBidAdapter'; +import { newBidder } from 'src/adapters/bidderFactory'; + +const ENDPOINT = '//ads.stickyadstv.com/www/delivery/swfIndex.php'; + +describe('freewheel-ssp BidAdapter Test', function () { + const adapter = newBidder(spec); + + describe('inherited functions', function () { + it('exists and is a function', function () { + expect(adapter.callBids).to.exist.and.to.be.a('function'); + }); + }); + + describe('isBidRequestValid', function () { + let bid = { + 'bidder': 'freewheel-ssp', + 'params': { + 'zoneId': '277225' + }, + 'adUnitCode': 'adunit-code', + 'sizes': [[300, 250], [300, 600]], + 'bidId': '30b31c1838de1e', + 'bidderRequestId': '22edbae2733bf6', + 'auctionId': '1d1a030790a475', + }; + + it('should return true when required params found', function () { + expect(spec.isBidRequestValid(bid)).to.equal(true); + }); + + it('should return false when required params are not passed', function () { + let bid = Object.assign({}, bid); + delete bid.params; + bid.params = { + wrong: 'missing zone id' + }; + expect(spec.isBidRequestValid(bid)).to.equal(false); + }); + }); + + describe('buildRequests', function () { + let bidRequests = [ + { + 'bidder': 'freewheel-ssp', + 'params': { + 'zoneId': '277225' + }, + 'adUnitCode': 'adunit-code', + 'sizes': [[300, 250], [300, 600]], + 'bidId': '30b31c1838de1e', + 'bidderRequestId': '22edbae2733bf6', + 'auctionId': '1d1a030790a475', + 'gdprConsent': { + 'consentString': 'BOJ/P2HOJ/P2HABABMAAAAAZ+A==', + 'gdprApplies': true + } + } + ]; + + it('should add parameters to the tag', function () { + const request = spec.buildRequests(bidRequests, bidRequests[0]); + const payload = request.data; + expect(payload.reqType).to.equal('AdsSetup'); + expect(payload.protocolVersion).to.equal('2.0'); + expect(payload.zoneId).to.equal('277225'); + expect(payload.componentId).to.equal('mustang'); + expect(payload.playerSize).to.equal('300x600'); + expect(payload._fw_gdpr).to.equal(true); + expect(payload._fw_gdpr_consent).to.equal('BOJ/P2HOJ/P2HABABMAAAAAZ+A=='); + }); + + it('sends bid request to ENDPOINT via GET', function () { + const request = spec.buildRequests(bidRequests, bidRequests[0]); + expect(request.url).to.contain(ENDPOINT); + expect(request.method).to.equal('GET'); + }); + }) + + describe('interpretResponse', function () { + let bidRequests = [ + { + 'bidder': 'freewheel-ssp', + 'params': { + 'zoneId': '277225' + }, + 'adUnitCode': 'adunit-code', + 'sizes': [[300, 250], [300, 600]], + 'bidId': '30b31c1838de1e', + 'bidderRequestId': '22edbae2733bf6', + 'auctionId': '1d1a030790a475', + } + ]; + + let formattedBidRequests = [ + { + 'bidder': 'freewheel-ssp', + 'params': { + 'zoneId': '277225', + 'format': 'floorad' + }, + 'adUnitCode': 'adunit-code', + 'sizes': [[600, 250], [300, 600]], + 'bidId': '30b3other1c1838de1e', + 'bidderRequestId': '22edbae273other3bf6', + 'auctionId': '1d1a03079test0a475', + }, + { + 'bidder': 'stickyadstv', + 'params': { + 'zoneId': '277225', + 'format': 'test' + }, + 'adUnitCode': 'adunit-code', + 'sizes': [[300, 600]], + 'bidId': '2', + 'bidderRequestId': '3', + 'auctionId': '4', + } + ]; + + let response = '' + + '' + + ' ' + + ' Adswizz' + + ' ' + + ' ' + + ' ' + + ' 00:00:09' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' 0.2000' + + ' ' + + ' ' + + ' ' + + ''; + + let ad = '
'; + let formattedAd = '
'; + + it('should get correct bid response', function () { + var request = spec.buildRequests(formattedBidRequests, formattedBidRequests[0]); + + let expectedResponse = [ + { + requestId: '30b31c1838de1e', + cpm: '0.2000', + width: 300, + height: 600, + creativeId: '28517153', + currency: 'EUR', + netRevenue: true, + ttl: 360, + ad: ad + } + ]; + + let result = spec.interpretResponse(response, request); + expect(Object.keys(result[0])).to.deep.equal(Object.keys(expectedResponse[0])); + }); + + it('should get correct bid response with formated ad', function () { + var request = spec.buildRequests(formattedBidRequests, formattedBidRequests[0]); + + let expectedResponse = [ + { + requestId: '30b31c1838de1e', + cpm: '0.2000', + width: 300, + height: 600, + creativeId: '28517153', + currency: 'EUR', + netRevenue: true, + ttl: 360, + ad: formattedAd + } + ]; + + let result = spec.interpretResponse(response, request); + expect(Object.keys(result[0])).to.deep.equal(Object.keys(expectedResponse[0])); + }); + + it('handles nobid responses', function () { + var reqest = spec.buildRequests(formattedBidRequests, formattedBidRequests[0]); + let response = ''; + + let result = spec.interpretResponse(response, reqest); + expect(result.length).to.equal(0); + }); + }); +}); diff --git a/test/spec/modules/fyberBidAdapter_spec.js b/test/spec/modules/fyberBidAdapter_spec.js index c6b49916519..a16c069d2a0 100644 --- a/test/spec/modules/fyberBidAdapter_spec.js +++ b/test/spec/modules/fyberBidAdapter_spec.js @@ -72,82 +72,82 @@ const mock = { } }; -describe('FyberAdapter', () => { +describe('FyberAdapter', function () { const adapter = newBidder(spec); - describe('inherited functions', () => { - it('callBids exists and is a function', () => { + describe('inherited functions', function () { + it('callBids exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('Verifies bidder code', () => { - it('Verifies bidder code', () => { + describe('Verifies bidder code', function () { + it('Verifies bidder code', function () { expect(spec.code).to.equal('fyber'); }); }); - describe('isBidRequestValid', () => { - it('should return true when required params found', () => { + describe('isBidRequestValid', function () { + it('should return true when required params found', function () { const bid = Object.assign({}, mock.bid); expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when required params{spotType} not found', () => { + it('should return false when required params{spotType} not found', function () { const bid = Object.assign({}, mock.bid); delete bid.params.spotType; expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should return false when required{appId} params not found', () => { + it('should return false when required{appId} params not found', function () { const bid = Object.assign({}, mock.bid); delete bid.params.appId; expect(spec.isBidRequestValid(bid)).to.equal(false); }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { const bidsRequest = Object.assign([], mock.bidsRequest); const requests = spec.buildRequests(bidsRequest); - it('Verify only one build request', () => { + it('Verify only one build request', function () { expect(requests.length).to.equal(1); }); const request = requests[0]; - it('Verify build request http method', () => { + it('Verify build request http method', function () { expect(request.method).to.equal('GET'); }); - it('Verify build request bidId', () => { + it('Verify build request bidId', function () { expect(request.bidId).to.equal(bidId); }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { const request = Object.assign([], mock.bidsRequest)[0]; const validResponse = Object.assign({}, mock.validResponse); const validResult = spec.interpretResponse(validResponse, request); - it('Verify only one bid response', () => { + it('Verify only one bid response', function () { expect(validResult.length).to.equal(1); }); const bidResponse = validResult[0]; - it('Verify CPM', () => { + it('Verify CPM', function () { expect(bidResponse.cpm).to.equal(10000); }); - it('Verify requestId', () => { + it('Verify requestId', function () { expect(bidResponse.requestId).to.equal(bidId); }); const invalidResponse = Object.assign({}, mock.invalidResponse); const invalidResult = spec.interpretResponse(invalidResponse, request); - it('Verify empty bid response', () => { + it('Verify empty bid response', function () { expect(invalidResult.length).to.equal(0); }); }); diff --git a/test/spec/modules/gambidBidAdapter_spec.js b/test/spec/modules/gambidBidAdapter_spec.js index 4c15d2113f1..06118f7f7d8 100644 --- a/test/spec/modules/gambidBidAdapter_spec.js +++ b/test/spec/modules/gambidBidAdapter_spec.js @@ -4,29 +4,29 @@ import * as utils from 'src/utils'; const supplyPartnerId = '123'; -describe('GambidAdapter', () => { - describe('isBidRequestValid', () => { - it('should validate supply-partner ID', () => { +describe('GambidAdapter', function () { + describe('isBidRequestValid', function () { + it('should validate supply-partner ID', function () { expect(spec.isBidRequestValid({ params: {} })).to.equal(false); expect(spec.isBidRequestValid({ params: { supplyPartnerId: 123 } })).to.equal(false); expect(spec.isBidRequestValid({ params: { supplyPartnerId: '123' } })).to.equal(true); }); - it('should validate RTB endpoint', () => { + it('should validate RTB endpoint', function () { expect(spec.isBidRequestValid({ params: { supplyPartnerId: '123' } })).to.equal(true); // RTB endpoint has a default expect(spec.isBidRequestValid({ params: { supplyPartnerId: '123', rtbEndpoint: 123 } })).to.equal(false); expect(spec.isBidRequestValid({ params: { supplyPartnerId: '123', rtbEndpoint: 'https://some.url.com' } })).to.equal(true); }); - it('should validate bid floor', () => { + it('should validate bid floor', function () { expect(spec.isBidRequestValid({ params: { supplyPartnerId: '123' } })).to.equal(true); // bidfloor has a default expect(spec.isBidRequestValid({ params: { supplyPartnerId: '123', bidfloor: '123' } })).to.equal(false); expect(spec.isBidRequestValid({ params: { supplyPartnerId: '123', bidfloor: 0.1 } })).to.equal(true); }); - it('should validate adpos', () => { + it('should validate adpos', function () { expect(spec.isBidRequestValid({ params: { supplyPartnerId: '123' } })).to.equal(true); // adpos has a default expect(spec.isBidRequestValid({ params: { supplyPartnerId: '123', adpos: '123' } })).to.equal(false); expect(spec.isBidRequestValid({ params: { supplyPartnerId: '123', adpos: 0.1 } })).to.equal(true); }); - it('should validate instl', () => { + it('should validate instl', function () { expect(spec.isBidRequestValid({ params: { supplyPartnerId: '123' } })).to.equal(true); // adpos has a default expect(spec.isBidRequestValid({ params: { supplyPartnerId: '123', instl: '123' } })).to.equal(false); expect(spec.isBidRequestValid({ params: { supplyPartnerId: '123', instl: -1 } })).to.equal(false); @@ -35,7 +35,7 @@ describe('GambidAdapter', () => { expect(spec.isBidRequestValid({ params: { supplyPartnerId: '123', instl: 2 } })).to.equal(false); }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { const bidRequest = { 'adUnitCode': 'adunit-code', 'auctionId': '1d1a030790a475', @@ -49,7 +49,7 @@ describe('GambidAdapter', () => { 'transactionId': 'a123456789' }; - it('returns an array', () => { + it('returns an array', function () { let response; response = spec.buildRequests([]); @@ -67,7 +67,7 @@ describe('GambidAdapter', () => { expect(response.length).to.equal(2); }); - it('targets correct endpoint', () => { + it('targets correct endpoint', function () { let response; response = spec.buildRequests([ bidRequest ])[ 0 ]; @@ -81,7 +81,7 @@ describe('GambidAdapter', () => { expect(response.url).to.match(new RegExp(`^https://rtb2\\.gambid\\.io/a12/r/${supplyPartnerId}/bidr\\?rformat=open_rtb&reqformat=rtb_json&bidder=prebid$`, 'g')); }); - it('builds request correctly', () => { + it('builds request correctly', function () { let stub = sinon.stub(utils, 'getTopWindowUrl').returns('http://www.test.com/page.html'); let response; @@ -114,7 +114,7 @@ describe('GambidAdapter', () => { stub.restore(); }); - it('builds request banner object correctly', () => { + it('builds request banner object correctly', function () { let response; const bidRequestWithBanner = utils.deepClone(bidRequest); @@ -136,7 +136,7 @@ describe('GambidAdapter', () => { expect(response.data.imp[ 0 ].banner.pos).to.equal(bidRequestWithPosEquals1.params.pos); }); - it('builds request video object correctly', () => { + it('builds request video object correctly', function () { let response; const bidRequestWithVideo = utils.deepClone(bidRequest); @@ -158,7 +158,7 @@ describe('GambidAdapter', () => { expect(response.data.imp[ 0 ].video.pos).to.equal(bidRequestWithPosEquals1.params.pos); }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { const bannerBidRequest = { 'adUnitCode': 'adunit-code', 'auctionId': '1d1a030790a475', @@ -249,7 +249,7 @@ describe('GambidAdapter', () => { } ] }; - it('returns an empty array on missing response', () => { + it('returns an empty array on missing response', function () { let response; response = spec.interpretResponse(undefined, { bidRequest: bannerBidRequest }); @@ -260,7 +260,7 @@ describe('GambidAdapter', () => { expect(Array.isArray(response)).to.equal(true); expect(response.length).to.equal(0); }); - it('aggregates banner bids from all seat bids', () => { + it('aggregates banner bids from all seat bids', function () { const response = spec.interpretResponse({ body: rtbResponse }, { bidRequest: bannerBidRequest }); expect(Array.isArray(response)).to.equal(true); expect(response.length).to.equal(2); @@ -291,7 +291,7 @@ describe('GambidAdapter', () => { // expect(ad1.ad).to.be.an('undefined'); // expect(ad1.vastXml).to.equal(rtbResponse.seatbid[ 1 ].bid[ 0 ].adm); }); - it('aggregates video bids from all seat bids', () => { + it('aggregates video bids from all seat bids', function () { const response = spec.interpretResponse({ body: rtbResponse }, { bidRequest: videoBidRequest }); expect(Array.isArray(response)).to.equal(true); expect(response.length).to.equal(2); @@ -321,7 +321,7 @@ describe('GambidAdapter', () => { expect(ad1.vastXml).to.equal(rtbResponse.seatbid[ 1 ].bid[ 0 ].adm); expect(ad1.vastUrl).to.equal(rtbResponse.seatbid[ 1 ].bid[ 0 ].ext.vast_url); }); - it('aggregates user-sync pixels', () => { + it('aggregates user-sync pixels', function () { const response = spec.getUserSyncs({}, [ { body: rtbResponse } ]); expect(Array.isArray(response)).to.equal(true); expect(response.length).to.equal(4); diff --git a/test/spec/modules/gammaBidAdapter_spec.js b/test/spec/modules/gammaBidAdapter_spec.js index 5ff959cfb21..99593e6e06f 100644 --- a/test/spec/modules/gammaBidAdapter_spec.js +++ b/test/spec/modules/gammaBidAdapter_spec.js @@ -22,26 +22,26 @@ describe('gammaBidAdapter', function() { }; let bidArray = [bid]; - describe('isBidRequestValid', () => { - it('should return true when required params found', () => { + describe('isBidRequestValid', function () { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when require params are not passed', () => { + it('should return false when require params are not passed', function () { let bid = Object.assign({}, bid); bid.params = {}; expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should return false when params not passed correctly', () => { + it('should return false when params not passed correctly', function () { bid.params.siteId = ''; bid.params.zoneId = ''; expect(spec.isBidRequestValid(bid)).to.equal(false); }); }); - describe('buildRequests', () => { - it('should attempt to send bid requests to the endpoint via GET', () => { + describe('buildRequests', function () { + it('should attempt to send bid requests to the endpoint via GET', function () { const requests = spec.buildRequests(bidArray); requests.forEach(function(requestItem) { expect(requestItem.method).to.equal('GET'); @@ -50,10 +50,10 @@ describe('gammaBidAdapter', function() { }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { let serverResponse; - beforeEach(() => { + beforeEach(function () { serverResponse = { body: { 'id': '23beaa6af6cdde', @@ -77,7 +77,7 @@ describe('gammaBidAdapter', function() { }; }) - it('should get the correct bid response', () => { + it('should get the correct bid response', function () { let expectedResponse = [{ 'requestId': '23beaa6af6cdde', 'cpm': 0.45, @@ -94,7 +94,7 @@ describe('gammaBidAdapter', function() { expect(Object.keys(result)).to.deep.equal(Object.keys(expectedResponse)); }); - it('handles empty bid response', () => { + it('handles empty bid response', function () { let response = { body: {} }; diff --git a/test/spec/modules/getintentBidAdapter_spec.js b/test/spec/modules/getintentBidAdapter_spec.js index 17f9a95fec4..ebbda7e108e 100644 --- a/test/spec/modules/getintentBidAdapter_spec.js +++ b/test/spec/modules/getintentBidAdapter_spec.js @@ -1,7 +1,7 @@ import { expect } from 'chai' import { spec } from 'modules/getintentBidAdapter' -describe('GetIntent Adapter Tests:', () => { +describe('GetIntent Adapter Tests:', function () { const bidRequests = [{ bidId: 'bid12345', params: { @@ -34,7 +34,7 @@ describe('GetIntent Adapter Tests:', () => { mediaType: 'video' }; - it('Verify build request', () => { + it('Verify build request', function () { const serverRequests = spec.buildRequests(bidRequests); let serverRequest = serverRequests[0]; expect(serverRequest.url).to.equal('//px.adhigh.net/rtb/direct_banner'); @@ -48,7 +48,7 @@ describe('GetIntent Adapter Tests:', () => { expect(serverRequest.data.size).to.equal('50x50,100x100'); }); - it('Verify build video request', () => { + it('Verify build video request', function () { const serverRequests = spec.buildRequests([videoBidRequest]); let serverRequest = serverRequests[0]; expect(serverRequest.url).to.equal('//px.adhigh.net/rtb/direct_vast'); @@ -64,7 +64,7 @@ describe('GetIntent Adapter Tests:', () => { expect(serverRequest.data.skippable).to.equal(true); }); - it('Verify parse response', () => { + it('Verify parse response', function () { const serverResponse = { body: { bid_id: 'bid12345', @@ -90,7 +90,7 @@ describe('GetIntent Adapter Tests:', () => { expect(bid.ad).to.equal('Ad markup'); }); - it('Verify parse video response', () => { + it('Verify parse video response', function () { const serverResponse = { body: { bid_id: 'bid789', @@ -116,22 +116,22 @@ describe('GetIntent Adapter Tests:', () => { expect(bid.vastUrl).to.equal('//vast.xml/url'); }); - it('Verify bidder code', () => { + it('Verify bidder code', function () { expect(spec.code).to.equal('getintent'); }); - it('Verify bidder aliases', () => { + it('Verify bidder aliases', function () { expect(spec.aliases).to.have.lengthOf(1); expect(spec.aliases[0]).to.equal('getintentAdapter'); }); - it('Verify supported media types', () => { + it('Verify supported media types', function () { expect(spec.supportedMediaTypes).to.have.lengthOf(2); expect(spec.supportedMediaTypes[0]).to.equal('video'); expect(spec.supportedMediaTypes[1]).to.equal('banner'); }); - it('Verify if bid request valid', () => { + it('Verify if bid request valid', function () { expect(spec.isBidRequestValid(bidRequests[0])).to.equal(true); expect(spec.isBidRequestValid(bidRequests[1])).to.equal(true); expect(spec.isBidRequestValid({})).to.equal(false); diff --git a/test/spec/modules/giantsBidAdapter_spec.js b/test/spec/modules/giantsBidAdapter_spec.js index 69535cba13f..bab2415745d 100644 --- a/test/spec/modules/giantsBidAdapter_spec.js +++ b/test/spec/modules/giantsBidAdapter_spec.js @@ -1,301 +1,301 @@ -import { expect } from 'chai'; -import { spec } from 'modules/giantsBidAdapter'; -import { newBidder } from 'src/adapters/bidderFactory'; -import { deepClone } from 'src/utils'; -import * as utils from 'src/utils'; - -const ENDPOINT = '//d.admp.io/hb/multi?url='; - -describe('GiantsAdapter', () => { - const adapter = newBidder(spec); - - describe('inherited functions', () => { - it('exists and is a function', () => { - expect(adapter.callBids).to.exist.and.to.be.a('function'); - }); - }); - - describe('isBidRequestValid', () => { - let bid = { - 'bidder': 'giants', - 'params': { - 'zoneId': '584072408' - }, - 'adUnitCode': 'adunit-code', - 'sizes': [[300, 250], [300, 600]], - 'bidId': '30b31c1838de1e', - 'bidderRequestId': '22edbae2733bf6', - 'auctionId': '1d1a030790a475', - }; - - it('should return true when required params found', () => { - expect(spec.isBidRequestValid(bid)).to.equal(true); - }); - - it('should return false when required params are not passed', () => { - let bid = Object.assign({}, bid); - delete bid.params; - bid.params = { - 'zoneId': 0 - }; - expect(spec.isBidRequestValid(bid)).to.equal(false); - }); - }); - - describe('buildRequests', () => { - let bidRequests = [ - { - 'bidder': 'giants', - 'params': { - 'zoneId': '584072408' - }, - 'adUnitCode': 'adunit-code', - 'sizes': [[300, 250], [300, 600]], - 'bidId': '30b31c1838de1e', - 'bidderRequestId': '22edbae2733bf6', - 'auctionId': '1d1a030790a475', - } - ]; - - it('should parse out private sizes', () => { - let bidRequest = Object.assign({}, - bidRequests[0], - { - params: { - zoneId: '584072408', - privateSizes: [300, 250] - } - } - ); - - const request = spec.buildRequests([bidRequest]); - const payload = JSON.parse(request.data); - - expect(payload.tags[0].private_sizes).to.exist; - expect(payload.tags[0].private_sizes).to.deep.equal([{width: 300, height: 250}]); - }); - - it('should add source and verison to the tag', () => { - const request = spec.buildRequests(bidRequests); - const payload = JSON.parse(request.data); - expect(payload.sdk).to.exist; - expect(payload.sdk).to.deep.equal({ - source: 'pbjs', - version: '$prebid.version$' - }); - }); - - it('should populate the ad_types array on all requests', () => { - ['banner', 'video', 'native'].forEach(type => { - const bidRequest = Object.assign({}, bidRequests[0]); - bidRequest.mediaTypes = {}; - bidRequest.mediaTypes[type] = {}; - - const request = spec.buildRequests([bidRequest]); - const payload = JSON.parse(request.data); - - expect(payload.tags[0].ad_types).to.deep.equal([type]); - }); - }); - - it('should populate the ad_types array on outstream requests', () => { - const bidRequest = Object.assign({}, bidRequests[0]); - bidRequest.mediaTypes = {}; - bidRequest.mediaTypes.video = {context: 'outstream'}; - - const request = spec.buildRequests([bidRequest]); - const payload = JSON.parse(request.data); - - expect(payload.tags[0].ad_types).to.deep.equal(['video']); - }); - - it('sends bid request to ENDPOINT via POST', () => { - const request = spec.buildRequests(bidRequests); - expect(request.url).to.equal(ENDPOINT + utils.getTopWindowUrl()); - expect(request.method).to.equal('POST'); - }); - - it('should attach valid video params to the tag', () => { - let bidRequest = Object.assign({}, - bidRequests[0], - { - params: { - zoneId: '584072408', - video: { - id: 123, - minduration: 100, - foobar: 'invalid' - } - } - } - ); - - const request = spec.buildRequests([bidRequest]); - const payload = JSON.parse(request.data); - expect(payload.tags[0].video).to.deep.equal({ - id: 123, - minduration: 100 - }); - }); - - it('sets minimum native asset params when not provided on adunit', () => { - let bidRequest = Object.assign({}, - bidRequests[0], - { - mediaType: 'native', - nativeParams: { - image: {required: true}, - } - } - ); - - const request = spec.buildRequests([bidRequest]); - const payload = JSON.parse(request.data); - - expect(payload.tags[0].native.layouts[0]).to.deep.equal({ - main_image: {required: true, sizes: [{}]}, - }); - }); - - it('does not overwrite native ad unit params with mimimum params', () => { - let bidRequest = Object.assign({}, - bidRequests[0], - { - mediaType: 'native', - nativeParams: { - image: { - aspect_ratios: [{ - min_width: 100, - ratio_width: 2, - ratio_height: 3, - }] - } - } - } - ); - - const request = spec.buildRequests([bidRequest]); - const payload = JSON.parse(request.data); - - expect(payload.tags[0].native.layouts[0]).to.deep.equal({ - main_image: { - required: true, - aspect_ratios: [{ - min_width: 100, - ratio_width: 2, - ratio_height: 3, - }] - }, - }); - }); - - it('should convert keyword params to proper form and attaches to request', () => { - let bidRequest = Object.assign({}, - bidRequests[0], - { - params: { - zoneId: '584072408', - keywords: { - single: 'val', - singleArr: ['val'], - singleArrNum: [5], - multiValMixed: ['value1', 2, 'value3'], - singleValNum: 123, - badValue: {'foo': 'bar'} // should be dropped - } - } - } - ); - - const request = spec.buildRequests([bidRequest]); - const payload = JSON.parse(request.data); - - expect(payload.tags[0].keywords).to.deep.equal([{ - 'key': 'single', - 'value': ['val'] - }, { - 'key': 'singleArr', - 'value': ['val'] - }, { - 'key': 'singleArrNum', - 'value': ['5'] - }, { - 'key': 'multiValMixed', - 'value': ['value1', '2', 'value3'] - }, { - 'key': 'singleValNum', - 'value': ['123'] - }]); - }); - - it('should add payment rules to the request', () => { - let bidRequest = Object.assign({}, - bidRequests[0], - { - params: { - zoneId: '584072408', - usePaymentRule: true - } - } - ); - - const request = spec.buildRequests([bidRequest]); - const payload = JSON.parse(request.data); - - expect(payload.tags[0].use_pmt_rule).to.equal(true); - }); - }) - - describe('interpretResponse', () => { - let response = { - 'version': '3.0.0', - 'tags': [ - { - 'uuid': '3db3773286ee59', - 'creative_id': '584944065', - 'height': 600, - 'width': 300, - 'zoneId': '584072408', - 'adUrl': '//d.admp.io/pbc/v1/cache-banner/f7aca005-8171-4299-90bf-0750a864a61c', - 'cpm': 0.5 - } - ] - }; - - it('should get correct bid response', () => { - let expectedResponse = [ - { - 'requestId': '3db3773286ee59', - 'cpm': 0.5, - 'creativeId': 29681110, - 'currency': 'USD', - 'netRevenue': true, - 'ttl': 300, - 'width': 300, - 'height': 250, - 'ad': '', - 'mediaType': 'banner' - } - ]; - let bidderRequest; - let result = spec.interpretResponse({ body: response }, {bidderRequest}); - expect(Object.keys(result[0])).to.have.members(Object.keys(expectedResponse[0])); - }); - - it('handles nobid responses', () => { - let response = { - 'version': '0.0.1', - 'tags': [{ - 'uuid': '84ab500420319d', - 'tag_id': 5976557, - 'auction_id': '297492697822162468', - 'nobid': true - }] - }; - let bidderRequest; - - let result = spec.interpretResponse({ body: response }, {bidderRequest}); - expect(result.length).to.equal(0); - }); - }); -}); +import { expect } from 'chai'; +import { spec } from 'modules/giantsBidAdapter'; +import { newBidder } from 'src/adapters/bidderFactory'; +import { deepClone } from 'src/utils'; +import * as utils from 'src/utils'; + +const ENDPOINT = '//d.admp.io/hb/multi?url='; + +describe('GiantsAdapter', function () { + const adapter = newBidder(spec); + + describe('inherited functions', function () { + it('exists and is a function', function () { + expect(adapter.callBids).to.exist.and.to.be.a('function'); + }); + }); + + describe('isBidRequestValid', function () { + let bid = { + 'bidder': 'giants', + 'params': { + 'zoneId': '584072408' + }, + 'adUnitCode': 'adunit-code', + 'sizes': [[300, 250], [300, 600]], + 'bidId': '30b31c1838de1e', + 'bidderRequestId': '22edbae2733bf6', + 'auctionId': '1d1a030790a475', + }; + + it('should return true when required params found', function () { + expect(spec.isBidRequestValid(bid)).to.equal(true); + }); + + it('should return false when required params are not passed', function () { + let bid = Object.assign({}, bid); + delete bid.params; + bid.params = { + 'zoneId': 0 + }; + expect(spec.isBidRequestValid(bid)).to.equal(false); + }); + }); + + describe('buildRequests', function () { + let bidRequests = [ + { + 'bidder': 'giants', + 'params': { + 'zoneId': '584072408' + }, + 'adUnitCode': 'adunit-code', + 'sizes': [[300, 250], [300, 600]], + 'bidId': '30b31c1838de1e', + 'bidderRequestId': '22edbae2733bf6', + 'auctionId': '1d1a030790a475', + } + ]; + + it('should parse out private sizes', function () { + let bidRequest = Object.assign({}, + bidRequests[0], + { + params: { + zoneId: '584072408', + privateSizes: [300, 250] + } + } + ); + + const request = spec.buildRequests([bidRequest]); + const payload = JSON.parse(request.data); + + expect(payload.tags[0].private_sizes).to.exist; + expect(payload.tags[0].private_sizes).to.deep.equal([{width: 300, height: 250}]); + }); + + it('should add source and verison to the tag', function () { + const request = spec.buildRequests(bidRequests); + const payload = JSON.parse(request.data); + expect(payload.sdk).to.exist; + expect(payload.sdk).to.deep.equal({ + source: 'pbjs', + version: '$prebid.version$' + }); + }); + + it('should populate the ad_types array on all requests', function () { + ['banner', 'video', 'native'].forEach(type => { + const bidRequest = Object.assign({}, bidRequests[0]); + bidRequest.mediaTypes = {}; + bidRequest.mediaTypes[type] = {}; + + const request = spec.buildRequests([bidRequest]); + const payload = JSON.parse(request.data); + + expect(payload.tags[0].ad_types).to.deep.equal([type]); + }); + }); + + it('should populate the ad_types array on outstream requests', function () { + const bidRequest = Object.assign({}, bidRequests[0]); + bidRequest.mediaTypes = {}; + bidRequest.mediaTypes.video = {context: 'outstream'}; + + const request = spec.buildRequests([bidRequest]); + const payload = JSON.parse(request.data); + + expect(payload.tags[0].ad_types).to.deep.equal(['video']); + }); + + it('sends bid request to ENDPOINT via POST', function () { + const request = spec.buildRequests(bidRequests); + expect(request.url).to.equal(ENDPOINT + utils.getTopWindowUrl()); + expect(request.method).to.equal('POST'); + }); + + it('should attach valid video params to the tag', function () { + let bidRequest = Object.assign({}, + bidRequests[0], + { + params: { + zoneId: '584072408', + video: { + id: 123, + minduration: 100, + foobar: 'invalid' + } + } + } + ); + + const request = spec.buildRequests([bidRequest]); + const payload = JSON.parse(request.data); + expect(payload.tags[0].video).to.deep.equal({ + id: 123, + minduration: 100 + }); + }); + + it('sets minimum native asset params when not provided on adunit', function () { + let bidRequest = Object.assign({}, + bidRequests[0], + { + mediaType: 'native', + nativeParams: { + image: {required: true}, + } + } + ); + + const request = spec.buildRequests([bidRequest]); + const payload = JSON.parse(request.data); + + expect(payload.tags[0].native.layouts[0]).to.deep.equal({ + main_image: {required: true, sizes: [{}]}, + }); + }); + + it('does not overwrite native ad unit params with mimimum params', function () { + let bidRequest = Object.assign({}, + bidRequests[0], + { + mediaType: 'native', + nativeParams: { + image: { + aspect_ratios: [{ + min_width: 100, + ratio_width: 2, + ratio_height: 3, + }] + } + } + } + ); + + const request = spec.buildRequests([bidRequest]); + const payload = JSON.parse(request.data); + + expect(payload.tags[0].native.layouts[0]).to.deep.equal({ + main_image: { + required: true, + aspect_ratios: [{ + min_width: 100, + ratio_width: 2, + ratio_height: 3, + }] + }, + }); + }); + + it('should convert keyword params to proper form and attaches to request', function () { + let bidRequest = Object.assign({}, + bidRequests[0], + { + params: { + zoneId: '584072408', + keywords: { + single: 'val', + singleArr: ['val'], + singleArrNum: [5], + multiValMixed: ['value1', 2, 'value3'], + singleValNum: 123, + badValue: {'foo': 'bar'} // should be dropped + } + } + } + ); + + const request = spec.buildRequests([bidRequest]); + const payload = JSON.parse(request.data); + + expect(payload.tags[0].keywords).to.deep.equal([{ + 'key': 'single', + 'value': ['val'] + }, { + 'key': 'singleArr', + 'value': ['val'] + }, { + 'key': 'singleArrNum', + 'value': ['5'] + }, { + 'key': 'multiValMixed', + 'value': ['value1', '2', 'value3'] + }, { + 'key': 'singleValNum', + 'value': ['123'] + }]); + }); + + it('should add payment rules to the request', function () { + let bidRequest = Object.assign({}, + bidRequests[0], + { + params: { + zoneId: '584072408', + usePaymentRule: true + } + } + ); + + const request = spec.buildRequests([bidRequest]); + const payload = JSON.parse(request.data); + + expect(payload.tags[0].use_pmt_rule).to.equal(true); + }); + }) + + describe('interpretResponse', function () { + let response = { + 'version': '3.0.0', + 'tags': [ + { + 'uuid': '3db3773286ee59', + 'creative_id': '584944065', + 'height': 600, + 'width': 300, + 'zoneId': '584072408', + 'adUrl': '//d.admp.io/pbc/v1/cache-banner/f7aca005-8171-4299-90bf-0750a864a61c', + 'cpm': 0.5 + } + ] + }; + + it('should get correct bid response', function () { + let expectedResponse = [ + { + 'requestId': '3db3773286ee59', + 'cpm': 0.5, + 'creativeId': 29681110, + 'currency': 'USD', + 'netRevenue': true, + 'ttl': 300, + 'width': 300, + 'height': 250, + 'ad': '', + 'mediaType': 'banner' + } + ]; + let bidderRequest; + let result = spec.interpretResponse({ body: response }, {bidderRequest}); + expect(Object.keys(result[0])).to.have.members(Object.keys(expectedResponse[0])); + }); + + it('handles nobid responses', function () { + let response = { + 'version': '0.0.1', + 'tags': [{ + 'uuid': '84ab500420319d', + 'tag_id': 5976557, + 'auction_id': '297492697822162468', + 'nobid': true + }] + }; + let bidderRequest; + + let result = spec.interpretResponse({ body: response }, {bidderRequest}); + expect(result.length).to.equal(0); + }); + }); +}); diff --git a/test/spec/modules/gjirafaBidAdapter_spec.js b/test/spec/modules/gjirafaBidAdapter_spec.js index 542e8185db5..d3aaf9765b2 100644 --- a/test/spec/modules/gjirafaBidAdapter_spec.js +++ b/test/spec/modules/gjirafaBidAdapter_spec.js @@ -1,9 +1,9 @@ import { expect } from 'chai'; import { spec } from 'modules/gjirafaBidAdapter'; -describe('gjirafaAdapterTest', () => { - describe('bidRequestValidity', () => { - it('bidRequest with placementId, minCPM and minCPC params', () => { +describe('gjirafaAdapterTest', function () { + describe('bidRequestValidity', function () { + it('bidRequest with placementId, minCPM and minCPC params', function () { expect(spec.isBidRequestValid({ bidder: 'gjirafa', params: { @@ -14,7 +14,7 @@ describe('gjirafaAdapterTest', () => { })).to.equal(true); }); - it('bidRequest with only placementId param', () => { + it('bidRequest with only placementId param', function () { expect(spec.isBidRequestValid({ bidder: 'gjirafa', params: { @@ -23,7 +23,7 @@ describe('gjirafaAdapterTest', () => { })).to.equal(true); }); - it('bidRequest with minCPM and minCPC params', () => { + it('bidRequest with minCPM and minCPC params', function () { expect(spec.isBidRequestValid({ bidder: 'gjirafa', params: { @@ -33,7 +33,7 @@ describe('gjirafaAdapterTest', () => { })).to.equal(true); }); - it('bidRequest with no placementId, minCPM or minCPC params', () => { + it('bidRequest with no placementId, minCPM or minCPC params', function () { expect(spec.isBidRequestValid({ bidder: 'gjirafa', params: { @@ -42,7 +42,7 @@ describe('gjirafaAdapterTest', () => { }); }); - describe('bidRequest', () => { + describe('bidRequest', function () { const bidRequests = [{ 'bidder': 'gjirafa', 'params': { @@ -74,14 +74,14 @@ describe('gjirafaAdapterTest', () => { 'consent_required': 'true' }]; - it('bidRequest HTTP method', () => { + it('bidRequest HTTP method', function () { const requests = spec.buildRequests(bidRequests); requests.forEach(function(requestItem) { expect(requestItem.method).to.equal('GET'); }); }); - it('bidRequest url', () => { + it('bidRequest url', function () { const endpointUrl = 'https://gjc.gjirafa.com/Home/GetBid'; const requests = spec.buildRequests(bidRequests); requests.forEach(function(requestItem) { @@ -89,20 +89,20 @@ describe('gjirafaAdapterTest', () => { }); }); - it('bidRequest data', () => { + it('bidRequest data', function () { const requests = spec.buildRequests(bidRequests); requests.forEach(function(requestItem) { expect(requestItem.data).to.exists; }); }); - it('bidRequest sizes', () => { + it('bidRequest sizes', function () { const requests = spec.buildRequests(bidRequests); expect(requests[0].data.sizes).to.equal('728x90;980x200;980x150;970x90;970x250'); expect(requests[1].data.sizes).to.equal('300x250'); }); - it('should add GDPR data', () => { + it('should add GDPR data', function () { const requests = spec.buildRequests(bidRequests); expect(requests[0].data.consent_string).to.exists; expect(requests[0].data.consent_required).to.exists; @@ -111,7 +111,7 @@ describe('gjirafaAdapterTest', () => { }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { const bidRequest = { 'method': 'GET', 'url': 'https://gjc.gjirafa.com/Home/GetBid', @@ -143,7 +143,7 @@ describe('gjirafaAdapterTest', () => { headers: {} }; - it('all keys present', () => { + it('all keys present', function () { const result = spec.interpretResponse(bidResponse, bidRequest); let keys = [ diff --git a/test/spec/modules/gumgumBidAdapter_spec.js b/test/spec/modules/gumgumBidAdapter_spec.js index 23ad392ff1b..0c1431b71a5 100644 --- a/test/spec/modules/gumgumBidAdapter_spec.js +++ b/test/spec/modules/gumgumBidAdapter_spec.js @@ -4,16 +4,16 @@ import { spec } from 'modules/gumgumBidAdapter'; const ENDPOINT = 'https://g2.gumgum.com/hbid/imp'; -describe('gumgumAdapter', () => { +describe('gumgumAdapter', function () { const adapter = newBidder(spec); - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { 'bidder': 'gumgum', 'params': { @@ -26,11 +26,11 @@ describe('gumgumAdapter', () => { 'auctionId': '1d1a030790a475', }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return true when required params found', () => { + it('should return true when required params found', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -40,7 +40,7 @@ describe('gumgumAdapter', () => { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -50,7 +50,7 @@ describe('gumgumAdapter', () => { }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let bidRequests = [ { 'bidder': 'gumgum', @@ -63,20 +63,20 @@ describe('gumgumAdapter', () => { } ]; - it('sends bid request to ENDPOINT via GET', () => { + it('sends bid request to ENDPOINT via GET', function () { const request = spec.buildRequests(bidRequests)[0]; expect(request.url).to.equal(ENDPOINT); expect(request.method).to.equal('GET'); expect(request.id).to.equal('30b31c1838de1e'); }); - it('should add consent parameters if gdprConsent is present', () => { + it('should add consent parameters if gdprConsent is present', function () { const gdprConsent = { consentString: 'BOJ/P2HOJ/P2HABABMAAAAAZ+A==', gdprApplies: true }; const fakeBidRequest = { gdprConsent: gdprConsent }; const bidRequest = spec.buildRequests(bidRequests, fakeBidRequest)[0]; expect(bidRequest.data.gdprApplies).to.eq(true); expect(bidRequest.data.gdprConsent).to.eq('BOJ/P2HOJ/P2HABABMAAAAAZ+A=='); }); - it('should handle gdprConsent is present but values are undefined case', () => { + it('should handle gdprConsent is present but values are undefined case', function () { const gdprConsent = { consent_string: undefined, gdprApplies: undefined }; const fakeBidRequest = { gdprConsent: gdprConsent }; const bidRequest = spec.buildRequests(bidRequests, fakeBidRequest)[0]; @@ -84,7 +84,7 @@ describe('gumgumAdapter', () => { }); }) - describe('interpretResponse', () => { + describe('interpretResponse', function () { let serverResponse = { 'ad': { 'id': 29593, @@ -115,7 +115,7 @@ describe('gumgumAdapter', () => { pi: 3 } - it('should get correct bid response', () => { + it('should get correct bid response', function () { let expectedResponse = { 'ad': '

I am an ad

', 'cpm': 0, @@ -132,7 +132,7 @@ describe('gumgumAdapter', () => { expect(spec.interpretResponse({ body: serverResponse }, bidRequest)).to.deep.equal([expectedResponse]); }); - it('handles nobid responses', () => { + it('handles nobid responses', function () { let response = { 'ad': {}, 'pag': { @@ -147,7 +147,7 @@ describe('gumgumAdapter', () => { expect(result.length).to.equal(0); }); - it('returns 1x1 when eligible product and size available', () => { + it('returns 1x1 when eligible product and size available', function () { let inscreenBidRequest = { id: 12346, sizes: [[300, 250], [1, 1]], @@ -184,7 +184,7 @@ describe('gumgumAdapter', () => { expect(result[0].height).to.equal('1'); }) }) - describe('getUserSyncs', () => { + describe('getUserSyncs', function () { const syncOptions = { 'iframeEnabled': 'true' } diff --git a/test/spec/modules/gxoneBidAdapter_spec.js b/test/spec/modules/gxoneBidAdapter_spec.js index f34f4358490..afeb2c781f5 100644 --- a/test/spec/modules/gxoneBidAdapter_spec.js +++ b/test/spec/modules/gxoneBidAdapter_spec.js @@ -5,13 +5,13 @@ import { newBidder } from 'src/adapters/bidderFactory'; describe('GXOne Adapter', function () { const adapter = newBidder(spec); - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { 'bidder': 'gxone', 'params': { @@ -24,11 +24,11 @@ describe('GXOne Adapter', function () { 'auctionId': '1d1a030790a475', }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -38,7 +38,7 @@ describe('GXOne Adapter', function () { }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { function parseRequest(url) { const res = {}; url.split('&').forEach((it) => { @@ -83,7 +83,7 @@ describe('GXOne Adapter', function () { } ]; - it('should attach valid params to the tag', () => { + it('should attach valid params to the tag', function () { const request = spec.buildRequests([bidRequests[0]]); expect(request.data).to.be.an('string'); const payload = parseRequest(request.data); @@ -92,7 +92,7 @@ describe('GXOne Adapter', function () { expect(payload).to.have.property('auids', '5'); }); - it('auids must not be duplicated', () => { + it('auids must not be duplicated', function () { const request = spec.buildRequests(bidRequests); expect(request.data).to.be.an('string'); const payload = parseRequest(request.data); @@ -101,7 +101,7 @@ describe('GXOne Adapter', function () { expect(payload).to.have.property('auids', '5,6'); }); - it('pt parameter must be "gross" if params.priceType === "gross"', () => { + it('pt parameter must be "gross" if params.priceType === "gross"', function () { bidRequests[1].params.priceType = 'gross'; const request = spec.buildRequests(bidRequests); expect(request.data).to.be.an('string'); @@ -112,7 +112,7 @@ describe('GXOne Adapter', function () { delete bidRequests[1].params.priceType; }); - it('pt parameter must be "net" or "gross"', () => { + it('pt parameter must be "net" or "gross"', function () { bidRequests[1].params.priceType = 'some'; const request = spec.buildRequests(bidRequests); expect(request.data).to.be.an('string'); @@ -124,7 +124,7 @@ describe('GXOne Adapter', function () { }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { const responses = [ {'bid': [{'price': 1.15, 'adm': '
test content 1
', 'auid': 4, 'h': 250, 'w': 300}], 'seat': '1'}, {'bid': [{'price': 0.5, 'adm': '
test content 2
', 'auid': 5, 'h': 90, 'w': 728}], 'seat': '1'}, @@ -135,7 +135,7 @@ describe('GXOne Adapter', function () { {'seat': '1'}, ]; - it('should get correct bid response', () => { + it('should get correct bid response', function () { const bidRequests = [ { 'bidder': 'gxone', @@ -169,7 +169,7 @@ describe('GXOne Adapter', function () { expect(result).to.deep.equal(expectedResponse); }); - it('should get correct multi bid response', () => { + it('should get correct multi bid response', function () { const bidRequests = [ { 'bidder': 'gxone', @@ -249,7 +249,7 @@ describe('GXOne Adapter', function () { expect(result).to.deep.equal(expectedResponse); }); - it('handles wrong and nobid responses', () => { + it('handles wrong and nobid responses', function () { const bidRequests = [ { 'bidder': 'gxone', diff --git a/test/spec/modules/huddledmassesBidAdapter_spec.js b/test/spec/modules/huddledmassesBidAdapter_spec.js index f98bc06d0da..7823ae53c12 100644 --- a/test/spec/modules/huddledmassesBidAdapter_spec.js +++ b/test/spec/modules/huddledmassesBidAdapter_spec.js @@ -1,7 +1,7 @@ import {expect} from 'chai'; import {spec} from '../../../modules/huddledmassesBidAdapter'; -describe('HuddledmassesAdapter', () => { +describe('HuddledmassesAdapter', function () { let bid = { bidId: '2dd581a2b6281d', bidder: 'huddledmasses', @@ -15,35 +15,35 @@ describe('HuddledmassesAdapter', () => { transactionId: '3bb2f6da-87a6-4029-aeb0-bfe951372e62' }; - describe('isBidRequestValid', () => { - it('Should return true when placement_id can be cast to a number, and when at least one of the sizes passed is allowed', () => { + describe('isBidRequestValid', function () { + it('Should return true when placement_id can be cast to a number, and when at least one of the sizes passed is allowed', function () { expect(spec.isBidRequestValid(bid)).to.be.true; }); - it('Should return false when placement_id is not a number', () => { + it('Should return false when placement_id is not a number', function () { bid.params.placement_id = 'aaa'; expect(spec.isBidRequestValid(bid)).to.be.false; }); - it('Should return false when the sizes are not allowed', () => { + it('Should return false when the sizes are not allowed', function () { bid.sizes = [[1, 1]]; expect(spec.isBidRequestValid(bid)).to.be.false; }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let serverRequest = spec.buildRequests([bid]); - it('Creates a ServerRequest object with method, URL and data', () => { + it('Creates a ServerRequest object with method, URL and data', function () { expect(serverRequest).to.exist; expect(serverRequest.method).to.exist; expect(serverRequest.url).to.exist; expect(serverRequest.data).to.exist; }); - it('Returns POST method', () => { + it('Returns POST method', function () { expect(serverRequest.method).to.equal('POST'); }); - it('Returns valid URL', () => { + it('Returns valid URL', function () { expect(serverRequest.url).to.equal('//huddledmassessupply.com/?c=o&m=multi'); }); - it('Returns valid data if array of bids is valid', () => { + it('Returns valid data if array of bids is valid', function () { let data = serverRequest.data; expect(data).to.be.an('object'); expect(data).to.have.all.keys('deviceWidth', 'deviceHeight', 'language', 'secure', 'host', 'page', 'placements'); @@ -62,13 +62,13 @@ describe('HuddledmassesAdapter', () => { expect(placement.sizes).to.be.an('array'); } }); - it('Returns empty data if no valid requests are passed', () => { + it('Returns empty data if no valid requests are passed', function () { serverRequest = spec.buildRequests([]); let data = serverRequest.data; expect(data.placements).to.be.an('array').that.is.empty; }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { let resObject = { body: [ { requestId: '123', @@ -83,7 +83,7 @@ describe('HuddledmassesAdapter', () => { } ] }; let serverResponses = spec.interpretResponse(resObject); - it('Returns an array of valid server responses if response object is valid', () => { + it('Returns an array of valid server responses if response object is valid', function () { expect(serverResponses).to.be.an('array').that.is.not.empty; for (let i = 0; i < serverResponses.length; i++) { let dataItem = serverResponses[i]; @@ -99,16 +99,16 @@ describe('HuddledmassesAdapter', () => { expect(dataItem.netRevenue).to.be.a('boolean'); expect(dataItem.currency).to.be.a('string'); } - it('Returns an empty array if invalid response is passed', () => { + it('Returns an empty array if invalid response is passed', function () { serverResponses = spec.interpretResponse('invalid_response'); expect(serverResponses).to.be.an('array').that.is.empty; }); }); }); - describe('getUserSyncs', () => { + describe('getUserSyncs', function () { let userSync = spec.getUserSyncs(); - it('Returns valid URL and type', () => { + it('Returns valid URL and type', function () { expect(userSync).to.be.an('array').with.lengthOf(1); expect(userSync[0].type).to.exist; expect(userSync[0].url).to.exist; diff --git a/test/spec/modules/iasBidAdapter_spec.js b/test/spec/modules/iasBidAdapter_spec.js index 1ee38999f7f..21ef9f8e15a 100644 --- a/test/spec/modules/iasBidAdapter_spec.js +++ b/test/spec/modules/iasBidAdapter_spec.js @@ -1,15 +1,15 @@ import { expect } from 'chai'; import { spec } from 'modules/iasBidAdapter'; -describe('iasBidAdapter is an adapter that', () => { - it('has the correct bidder code', () => { +describe('iasBidAdapter is an adapter that', function () { + it('has the correct bidder code', function () { expect(spec.code).to.equal('ias'); }); - describe('has a method `isBidRequestValid` that', () => { - it('exists', () => { + describe('has a method `isBidRequestValid` that', function () { + it('exists', function () { expect(spec.isBidRequestValid).to.be.a('function'); }); - it('returns false if bid params misses `pubId`', () => { + it('returns false if bid params misses `pubId`', function () { expect(spec.isBidRequestValid( { params: { @@ -17,7 +17,7 @@ describe('iasBidAdapter is an adapter that', () => { } })).to.equal(false); }); - it('returns false if bid params misses `adUnitPath`', () => { + it('returns false if bid params misses `adUnitPath`', function () { expect(spec.isBidRequestValid( { params: { @@ -25,7 +25,7 @@ describe('iasBidAdapter is an adapter that', () => { } })).to.equal(false); }); - it('returns true otherwise', () => { + it('returns true otherwise', function () { expect(spec.isBidRequestValid( { params: { @@ -37,13 +37,13 @@ describe('iasBidAdapter is an adapter that', () => { }); }); - describe('has a method `buildRequests` that', () => { - it('exists', () => { + describe('has a method `buildRequests` that', function () { + it('exists', function () { expect(spec.buildRequests).to.be.a('function'); }); - describe('given bid requests, returns a `ServerRequest` instance that', () => { + describe('given bid requests, returns a `ServerRequest` instance that', function () { let bidRequests, IAS_HOST; - beforeEach(() => { + beforeEach(function () { IAS_HOST = '//pixel.adsafeprotected.com/services/pub'; bidRequests = [ { @@ -79,20 +79,20 @@ describe('iasBidAdapter is an adapter that', () => { } ]; }); - it('has property `method` of `GET`', () => { + it('has property `method` of `GET`', function () { expect(spec.buildRequests(bidRequests)).to.deep.include({ method: 'GET' }); }); - it('has property `url` to be the correct IAS endpoint', () => { + it('has property `url` to be the correct IAS endpoint', function () { expect(spec.buildRequests(bidRequests)).to.deep.include({ url: IAS_HOST }); }); - it('only includes the first `bidRequest` as the bidRequest variable on a multiple slot request', () => { + it('only includes the first `bidRequest` as the bidRequest variable on a multiple slot request', function () { expect(spec.buildRequests(bidRequests).bidRequest.adUnitCode).to.equal(bidRequests[0].adUnitCode); }); - describe('has property `data` that is an encode query string containing information such as', () => { + describe('has property `data` that is an encode query string containing information such as', function () { let val; const ANID_PARAM = 'anId'; const SLOT_PARAM = 'slot'; @@ -100,35 +100,37 @@ describe('iasBidAdapter is an adapter that', () => { const SLOT_SIZE_PARAM = 'ss'; const SLOT_AD_UNIT_PATH_PARAM = 'p'; - beforeEach(() => val = decodeURI(spec.buildRequests(bidRequests).data)); - it('publisher id', () => { + beforeEach(function () { + val = decodeURI(spec.buildRequests(bidRequests).data); + }); + it('publisher id', function () { expect(val).to.have.string(`${ANID_PARAM}=1234`); }); - it('ad slot`s id, size and ad unit path', () => { + it('ad slot`s id, size and ad unit path', function () { expect(val).to.have.string(`${SLOT_PARAM}={${SLOT_ID_PARAM}:one-div-id,${SLOT_SIZE_PARAM}:[10.20,300.400],${SLOT_AD_UNIT_PATH_PARAM}:/a/b/c}`); expect(val).to.have.string(`${SLOT_PARAM}={${SLOT_ID_PARAM}:two-div-id,${SLOT_SIZE_PARAM}:[50.60],${SLOT_AD_UNIT_PATH_PARAM}:/d/e/f}`); }); - it('window size', () => { + it('window size', function () { expect(val).to.match(/.*wr=[0-9]*\.[0-9]*/); }); - it('screen size', () => { + it('screen size', function () { expect(val).to.match(/.*sr=[0-9]*\.[0-9]*/); }); }); - it('has property `bidRequest` that is the first passed in bid request', () => { + it('has property `bidRequest` that is the first passed in bid request', function () { expect(spec.buildRequests(bidRequests)).to.deep.include({ bidRequest: bidRequests[0] }); }); }); }); - describe('has a method `interpretResponse` that', () => { - it('exists', () => { + describe('has a method `interpretResponse` that', function () { + it('exists', function () { expect(spec.interpretResponse).to.be.a('function'); }); - describe('returns a list of bid response that', () => { + describe('returns a list of bid response that', function () { let bidRequests, bidResponse, slots, serverResponse; - beforeEach(() => { + beforeEach(function () { bidRequests = [ { adUnitCode: 'one-div-id', @@ -194,34 +196,34 @@ describe('iasBidAdapter is an adapter that', () => { }; bidResponse = spec.interpretResponse(serverResponse, request); }); - it('has IAS keyword `adt` as property', () => { + it('has IAS keyword `adt` as property', function () { expect(bidResponse[0]).to.deep.include({ adt: 'adtVal' }); }); - it('has IAS keyword `alc` as property', () => { + it('has IAS keyword `alc` as property', function () { expect(bidResponse[0]).to.deep.include({ alc: 'alcVal' }); }); - it('has IAS keyword `dlm` as property', () => { + it('has IAS keyword `dlm` as property', function () { expect(bidResponse[0]).to.deep.include({ dlm: 'dlmVal' }); }); - it('has IAS keyword `drg` as property', () => { + it('has IAS keyword `drg` as property', function () { expect(bidResponse[0]).to.deep.include({ drg: 'drgVal' }); }); - it('has IAS keyword `hat` as property', () => { + it('has IAS keyword `hat` as property', function () { expect(bidResponse[0]).to.deep.include({ hat: 'hatVal' }); }); - it('has IAS keyword `off` as property', () => { + it('has IAS keyword `off` as property', function () { expect(bidResponse[0]).to.deep.include({ off: 'offVal' }); }); - it('has IAS keyword `vio` as property', () => { + it('has IAS keyword `vio` as property', function () { expect(bidResponse[0]).to.deep.include({ vio: 'vioVal' }); }); - it('has IAS keyword `fr` as property', () => { + it('has IAS keyword `fr` as property', function () { expect(bidResponse[0]).to.deep.include({ fr: 'false' }); }); - it('has property `slots`', () => { + it('has property `slots`', function () { expect(bidResponse[0]).to.deep.include({ slots: slots }); }); - it('response is the same for multiple slots', () => { + it('response is the same for multiple slots', function () { var adapter = spec; var requests = adapter.buildRequests(bidRequests); expect(adapter.interpretResponse(serverResponse, requests)).to.length(2); diff --git a/test/spec/modules/improvedigitalBidAdapter_spec.js b/test/spec/modules/improvedigitalBidAdapter_spec.js index b3e99b3274e..bab469b936e 100644 --- a/test/spec/modules/improvedigitalBidAdapter_spec.js +++ b/test/spec/modules/improvedigitalBidAdapter_spec.js @@ -40,22 +40,22 @@ describe('Improve Digital Adapter Tests', function () { }, }; - describe('isBidRequestValid', () => { - it('should return false when no bid', () => { + describe('isBidRequestValid', function () { + it('should return false when no bid', function () { expect(spec.isBidRequestValid()).to.equal(false); }); - it('should return false when no bid.params', () => { + it('should return false when no bid.params', function () { let bid = {}; expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should return false when both placementId and placementKey + publisherId are missing', () => { + it('should return false when both placementId and placementKey + publisherId are missing', function () { let bid = { 'params': {} }; expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should return false when only one of placementKey and publisherId is present', () => { + it('should return false when only one of placementKey and publisherId is present', function () { let bid = { params: { publisherId: 1234 @@ -70,19 +70,19 @@ describe('Improve Digital Adapter Tests', function () { expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should return true when placementId is passed', () => { + it('should return true when placementId is passed', function () { let bid = { 'params': {} }; expect(spec.isBidRequestValid(simpleBidRequest)).to.equal(true); }); - it('should return true when both placementKey and publisherId are passed', () => { + it('should return true when both placementKey and publisherId are passed', function () { let bid = { 'params': {} }; expect(spec.isBidRequestValid(simpleSmartTagBidRequest)).to.equal(true); }); }); - describe('buildRequests', () => { - it('should make a well-formed request objects', () => { + describe('buildRequests', function () { + it('should make a well-formed request objects', function () { const requests = spec.buildRequests([simpleBidRequest]); expect(requests).to.be.an('array'); expect(requests.length).to.equal(1); @@ -106,14 +106,14 @@ describe('Improve Digital Adapter Tests', function () { ]); }); - it('should set placementKey and publisherId for smart tags', () => { + it('should set placementKey and publisherId for smart tags', function () { const requests = spec.buildRequests([simpleSmartTagBidRequest]); const params = JSON.parse(requests[0].data.substring(PARAM_PREFIX.length)); expect(params.bid_request.imp[0].pubid).to.equal(1032); expect(params.bid_request.imp[0].pkey).to.equal('data_team_test_hb_smoke_test'); }); - it('should add keyValues', () => { + it('should add keyValues', function () { let bidRequest = Object.assign({}, simpleBidRequest); const keyValues = { testKey: [ @@ -126,7 +126,7 @@ describe('Improve Digital Adapter Tests', function () { expect(params.bid_request.imp[0].kvw).to.deep.equal(keyValues); }); - it('should add size', () => { + it('should add size', function () { let bidRequest = Object.assign({}, simpleBidRequest); const size = { w: 800, @@ -138,7 +138,7 @@ describe('Improve Digital Adapter Tests', function () { expect(params.bid_request.imp[0].banner).to.deep.equal(size); }); - it('should add currency', () => { + it('should add currency', function () { const bidRequest = Object.assign({}, simpleBidRequest); const getConfigStub = sinon.stub(config, 'getConfig').returns('JPY'); const request = spec.buildRequests([bidRequest])[0]; @@ -147,14 +147,14 @@ describe('Improve Digital Adapter Tests', function () { getConfigStub.restore(); }); - it('should add GDPR consent string', () => { + it('should add GDPR consent string', function () { const bidRequest = Object.assign({}, simpleBidRequest); const request = spec.buildRequests([bidRequest], bidderRequest)[0]; const params = JSON.parse(request.data.substring(PARAM_PREFIX.length)); expect(params.bid_request.gdpr).to.equal('BOJ/P2HOJ/P2HABABMAAAAAZ+A=='); }); - it('should return 2 requests', () => { + it('should return 2 requests', function () { const requests = spec.buildRequests([ simpleBidRequest, simpleSmartTagBidRequest @@ -218,7 +218,7 @@ describe('Improve Digital Adapter Tests', function () { } }; - describe('interpretResponse', () => { + describe('interpretResponse', function () { let expectedBid = [ { 'ad': '', @@ -250,17 +250,17 @@ describe('Improve Digital Adapter Tests', function () { } ]; - it('should return a well-formed bid', () => { + it('should return a well-formed bid', function () { const bids = spec.interpretResponse(serverResponse); expect(bids).to.deep.equal(expectedBid); }); - it('should return two bids', () => { + it('should return two bids', function () { const bids = spec.interpretResponse(serverResponseTwoBids); expect(bids).to.deep.equal(expectedTwoBids); }); - it('should set dealId correctly', () => { + it('should set dealId correctly', function () { let response = JSON.parse(JSON.stringify(serverResponse)); let bids; @@ -279,14 +279,14 @@ describe('Improve Digital Adapter Tests', function () { expect(bids[0].dealId).to.equal(268515); }); - it('should set currency', () => { + it('should set currency', function () { let response = JSON.parse(JSON.stringify(serverResponse)); response.body.bid[0].currency = 'eur'; const bids = spec.interpretResponse(response); expect(bids[0].currency).to.equal('EUR'); }); - it('should return empty array for bad response or no price', () => { + it('should return empty array for bad response or no price', function () { let response = JSON.parse(JSON.stringify(serverResponse)); let bids; @@ -323,7 +323,7 @@ describe('Improve Digital Adapter Tests', function () { expect(bids).to.deep.equal([]); }); - it('should set netRevenue', () => { + it('should set netRevenue', function () { let response = JSON.parse(JSON.stringify(serverResponse)); response.body.bid[0].isNet = true; const bids = spec.interpretResponse(response); @@ -331,15 +331,15 @@ describe('Improve Digital Adapter Tests', function () { }); }); - describe('getUserSyncs', () => { + describe('getUserSyncs', function () { const serverResponses = [ serverResponseTwoBids ]; - it('should return no syncs when pixel syncing is disabled', () => { + it('should return no syncs when pixel syncing is disabled', function () { const syncs = spec.getUserSyncs({ pixelEnabled: false }, serverResponses); expect(syncs).to.deep.equal([]); }); - it('should return user syncs', () => { + it('should return user syncs', function () { const syncs = spec.getUserSyncs({ pixelEnabled: true }, serverResponses); const expected = [ { type: 'image', url: 'http://link1' }, diff --git a/test/spec/modules/innityBidAdapter_spec.js b/test/spec/modules/innityBidAdapter_spec.js index 87042ca6a6d..0132f093ca1 100644 --- a/test/spec/modules/innityBidAdapter_spec.js +++ b/test/spec/modules/innityBidAdapter_spec.js @@ -1,9 +1,9 @@ import { expect } from 'chai'; import { spec } from 'modules/innityBidAdapter'; -describe('innityAdapterTest', () => { - describe('bidRequestValidity', () => { - it('bidRequest with pub ID and zone ID param', () => { +describe('innityAdapterTest', function () { + describe('bidRequestValidity', function () { + it('bidRequest with pub ID and zone ID param', function () { expect(spec.isBidRequestValid({ bidder: 'innity', params: { @@ -13,7 +13,7 @@ describe('innityAdapterTest', () => { })).to.equal(true); }); - it('bidRequest with no required params', () => { + it('bidRequest with no required params', function () { expect(spec.isBidRequestValid({ bidder: 'innity', params: { @@ -22,7 +22,7 @@ describe('innityAdapterTest', () => { }); }); - describe('bidRequest', () => { + describe('bidRequest', function () { const bidRequests = [{ 'bidder': 'innity', 'params': { @@ -37,14 +37,14 @@ describe('innityAdapterTest', () => { 'auctionId': '18fd8b8b0bd757' }]; - it('bidRequest HTTP method', () => { + it('bidRequest HTTP method', function () { const requests = spec.buildRequests(bidRequests); requests.forEach(function(requestItem) { expect(requestItem.method).to.equal('GET'); }); }); - it('bidRequest data', () => { + it('bidRequest data', function () { const requests = spec.buildRequests(bidRequests); expect(requests[0].data.pub).to.equal(267); expect(requests[0].data.zone).to.equal(62546); @@ -54,7 +54,7 @@ describe('innityAdapterTest', () => { }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { const bidRequest = { 'method': 'GET', 'url': 'https://as.innity.com/synd/?', @@ -85,7 +85,7 @@ describe('innityAdapterTest', () => { headers: {} }; - it('result is correct', () => { + it('result is correct', function () { const result = spec.interpretResponse(bidResponse, bidRequest); expect(result[0].requestId).to.equal('51ef8751f9aead'); expect(result[0].cpm).to.equal(1); diff --git a/test/spec/modules/inskinBidAdapter_spec.js b/test/spec/modules/inskinBidAdapter_spec.js index 40a84525ffa..24ae9321954 100644 --- a/test/spec/modules/inskinBidAdapter_spec.js +++ b/test/spec/modules/inskinBidAdapter_spec.js @@ -99,11 +99,11 @@ const RESPONSE = { } }; -describe('InSkin BidAdapter', () => { +describe('InSkin BidAdapter', function () { let bidRequests; let adapter = spec; - beforeEach(() => { + beforeEach(function () { bidRequests = [ { bidder: 'inskin', @@ -121,8 +121,8 @@ describe('InSkin BidAdapter', () => { ]; }); - describe('bid request validation', () => { - it('should accept valid bid requests', () => { + describe('bid request validation', function () { + it('should accept valid bid requests', function () { let bid = { bidder: 'inskin', params: { @@ -133,7 +133,7 @@ describe('InSkin BidAdapter', () => { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should accept valid bid requests with extra fields', () => { + it('should accept valid bid requests with extra fields', function () { let bid = { bidder: 'inskin', params: { @@ -145,7 +145,7 @@ describe('InSkin BidAdapter', () => { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should reject bid requests without siteId', () => { + it('should reject bid requests without siteId', function () { let bid = { bidder: 'inskin', params: { @@ -155,7 +155,7 @@ describe('InSkin BidAdapter', () => { expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should reject bid requests without networkId', () => { + it('should reject bid requests without networkId', function () { let bid = { bidder: 'inskin', params: { @@ -166,31 +166,31 @@ describe('InSkin BidAdapter', () => { }); }); - describe('buildRequests validation', () => { - it('creates request data', () => { + describe('buildRequests validation', function () { + it('creates request data', function () { let request = spec.buildRequests(bidRequests); expect(request).to.exist.and.to.be.a('object'); }); - it('request to inskin should contain a url', () => { + it('request to inskin should contain a url', function () { let request = spec.buildRequests(bidRequests); expect(request.url).to.have.string('inskinad.com'); }); - it('requires valid bids to make request', () => { + it('requires valid bids to make request', function () { let request = spec.buildRequests([]); expect(request.bidRequest).to.be.empty; }); - it('sends bid request to ENDPOINT via POST', () => { + it('sends bid request to ENDPOINT via POST', function () { let request = spec.buildRequests(bidRequests); expect(request.method).to.have.string('POST'); }); - it('should add gdpr consent information to the request', () => { + it('should add gdpr consent information to the request', function () { let consentString = 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A=='; let bidderRequest = { 'bidderCode': 'inskin', @@ -210,21 +210,21 @@ describe('InSkin BidAdapter', () => { expect(payload.consent.gdprConsentRequired).to.exist.and.to.be.true; }); }); - describe('interpretResponse validation', () => { - it('response should have valid bidderCode', () => { + describe('interpretResponse validation', function () { + it('response should have valid bidderCode', function () { let bidRequest = spec.buildRequests(REQUEST.bidRequest); let bid = bidFactory.createBid(1, bidRequest.bidRequest[0]); expect(bid.bidderCode).to.equal('inskin'); }); - it('response should include objects for all bids', () => { + it('response should include objects for all bids', function () { let bids = spec.interpretResponse(RESPONSE, REQUEST); expect(bids.length).to.equal(2); }); - it('registers bids', () => { + it('registers bids', function () { let bids = spec.interpretResponse(RESPONSE, REQUEST); bids.forEach(b => { expect(b).to.have.property('cpm'); @@ -242,34 +242,34 @@ describe('InSkin BidAdapter', () => { }); }); - it('handles nobid responses', () => { + it('handles nobid responses', function () { let EMPTY_RESP = Object.assign({}, RESPONSE, {'body': {'decisions': null}}) let bids = spec.interpretResponse(EMPTY_RESP, REQUEST); expect(bids).to.be.empty; }); - it('handles no server response', () => { + it('handles no server response', function () { let bids = spec.interpretResponse(null, REQUEST); expect(bids).to.be.empty; }); }); - describe('getUserSyncs', () => { - it('handles empty sync options', () => { + describe('getUserSyncs', function () { + it('handles empty sync options', function () { let opts = spec.getUserSyncs({}); expect(opts).to.be.empty; }); - it('should return two sync urls if pixel syncs are enabled', () => { + it('should return two sync urls if pixel syncs are enabled', function () { let syncOptions = {'pixelEnabled': true}; let opts = spec.getUserSyncs(syncOptions); expect(opts.length).to.equal(2); }); - it('should return three sync urls if pixel and iframe syncs are enabled', () => { + it('should return three sync urls if pixel and iframe syncs are enabled', function () { let syncOptions = {'iframeEnabled': true, 'pixelEnabled': true}; let opts = spec.getUserSyncs(syncOptions); diff --git a/test/spec/modules/interactiveOffersBidAdapter_spec.js b/test/spec/modules/interactiveOffersBidAdapter_spec.js index 6cf09cf6149..8921a302738 100644 --- a/test/spec/modules/interactiveOffersBidAdapter_spec.js +++ b/test/spec/modules/interactiveOffersBidAdapter_spec.js @@ -1,10 +1,10 @@ import {expect} from 'chai'; import {spec} from 'modules/interactiveOffersBidAdapter'; -describe('interactiveOffers adapter', () => { - describe('implementation', () => { - describe('for requests', () => { - it('should accept valid bid', () => { +describe('interactiveOffers adapter', function () { + describe('implementation', function () { + describe('for requests', function () { + it('should accept valid bid', function () { let validBid = { bidder: 'interactiveOffers', params: { @@ -16,7 +16,7 @@ describe('interactiveOffers adapter', () => { expect(isValid).to.equal(true); }); - it('should reject invalid bid', () => { + it('should reject invalid bid', function () { let invalidBid = { bidder: 'interactiveOffers' }, @@ -25,8 +25,8 @@ describe('interactiveOffers adapter', () => { expect(isValid).to.equal(false); }); }); - describe('for requests', () => { - it('should accept valid bid with optional params', () => { + describe('for requests', function () { + it('should accept valid bid with optional params', function () { let validBid = { bidder: 'interactiveOffers', params: { @@ -44,7 +44,7 @@ describe('interactiveOffers adapter', () => { expect(requestUrlCustomParams).have.property('tmax', 1500); }); - it('should accept valid bid without optional params', () => { + it('should accept valid bid without optional params', function () { let validBid = { bidder: 'interactiveOffers', params: { @@ -60,7 +60,7 @@ describe('interactiveOffers adapter', () => { expect(requestUrlCustomParams).have.property('tmax'); }); - it('should reject invalid bid without pubId', () => { + it('should reject invalid bid without pubId', function () { let invalidBid = { bidder: 'interactiveOffers', params: {} @@ -70,8 +70,8 @@ describe('interactiveOffers adapter', () => { expect(isValid).to.equal(false); }); }); - describe('bid responses', () => { - it('should return complete bid response', () => { + describe('bid responses', function () { + it('should return complete bid response', function () { let serverResponse = { body: { 'success': 'true', @@ -104,7 +104,7 @@ describe('interactiveOffers adapter', () => { expect(bids[0].ad).to.have.length.above(1); }); - it('should return empty bid response', () => { + it('should return empty bid response', function () { let bidRequests = [ { bidder: 'interactiveOffers', @@ -128,7 +128,7 @@ describe('interactiveOffers adapter', () => { expect(bids).to.be.lengthOf(0); }); - it('should return empty bid response with error', () => { + it('should return empty bid response with error', function () { let bidRequests = [ { bidder: 'interactiveOffers', @@ -143,7 +143,7 @@ describe('interactiveOffers adapter', () => { expect(bids).to.be.lengthOf(0); }); - it('should return empty bid response without payload', () => { + it('should return empty bid response without payload', function () { let bidRequests = [ { bidder: 'interactiveOffers', @@ -158,7 +158,7 @@ describe('interactiveOffers adapter', () => { expect(bids).to.be.lengthOf(0); }); - it('should return empty bid response on empty body', () => { + it('should return empty bid response on empty body', function () { let bidRequests = [ { bidder: 'interactiveOffers', diff --git a/test/spec/modules/invibesBidAdapter_spec.js b/test/spec/modules/invibesBidAdapter_spec.js index f6f601e0efc..d0fa627929e 100644 --- a/test/spec/modules/invibesBidAdapter_spec.js +++ b/test/spec/modules/invibesBidAdapter_spec.js @@ -86,19 +86,19 @@ describe('invibesBidAdapter:', function () { }); }); - describe('buildRequests', () => { - it('sends bid request to ENDPOINT via GET', () => { + describe('buildRequests', function () { + it('sends bid request to ENDPOINT via GET', function () { const request = spec.buildRequests(bidRequests); expect(request.url).to.equal(ENDPOINT); expect(request.method).to.equal('GET'); }); - it('sends cookies with the bid request', () => { + it('sends cookies with the bid request', function () { const request = spec.buildRequests(bidRequests); expect(request.options.withCredentials).to.equal(true); }); - it('has location, html id, placement and width/height', () => { + it('has location, html id, placement and width/height', function () { const request = spec.buildRequests(bidRequests, { auctionStart: Date.now() }); const parsedData = request.data; expect(parsedData.location).to.exist; @@ -108,53 +108,53 @@ describe('invibesBidAdapter:', function () { expect(parsedData.height).to.exist; }); - it('sends all Placement Ids', () => { + it('sends all Placement Ids', function () { const request = spec.buildRequests(bidRequests); expect(JSON.parse(request.data.bidParamsJson).placementIds).to.contain(bidRequests[0].params.placementId); expect(JSON.parse(request.data.bidParamsJson).placementIds).to.contain(bidRequests[1].params.placementId); }); - it('uses cookies', () => { + it('uses cookies', function () { global.document.cookie = 'ivNoCookie=1'; let request = spec.buildRequests(bidRequests); expect(request.data.lId).to.be.undefined; }); - it('doesnt send the domain id if not graduated', () => { + it('doesnt send the domain id if not graduated', function () { global.document.cookie = 'ivbsdid={"id":"dvdjkams6nkq","cr":1522929537626,"hc":1}'; let request = spec.buildRequests(bidRequests); expect(request.data.lId).to.not.exist; }); - it('graduate and send the domain id', () => { + it('graduate and send the domain id', function () { top.window.invibes.optIn = 1; global.document.cookie = 'ivbsdid={"id":"dvdjkams6nkq","cr":1521818537626,"hc":7}'; let request = spec.buildRequests(bidRequests); expect(request.data.lId).to.exist; }); - it('send the domain id if already graduated', () => { + it('send the domain id if already graduated', function () { top.window.invibes.optIn = 1; global.document.cookie = 'ivbsdid={"id":"f8zoh044p9oi"}'; let request = spec.buildRequests(bidRequests); expect(request.data.lId).to.exist; }); - it('send the domain id after replacing it with new format', () => { + it('send the domain id after replacing it with new format', function () { top.window.invibes.optIn = 1; global.document.cookie = 'ivbsdid={"id":"f8zoh044p9oi.8537626"}'; let request = spec.buildRequests(bidRequests); expect(request.data.lId).to.exist; }); - it('try to graduate but not enough count - doesnt send the domain id', () => { + it('try to graduate but not enough count - doesnt send the domain id', function () { top.window.invibes.optIn = 1; global.document.cookie = 'ivbsdid={"id":"dvdjkams6nkq","cr":1521818537626,"hc":5}'; let request = spec.buildRequests(bidRequests); expect(request.data.lId).to.not.exist; }); - it('try to graduate but not old enough - doesnt send the domain id', () => { + it('try to graduate but not old enough - doesnt send the domain id', function () { top.window.invibes.optIn = 1; global.document.cookie = 'ivbsdid={"id":"dvdjkams6nkq","cr":' + Date.now() + ',"hc":5}'; let request = spec.buildRequests(bidRequests); @@ -194,55 +194,55 @@ describe('invibesBidAdapter:', function () { }]; context('when the response is not valid', function () { - it('handles response with no bids requested', () => { + it('handles response with no bids requested', function () { let emptyResult = spec.interpretResponse({ body: response }); expect(emptyResult).to.be.empty; }); - it('handles empty response', () => { + it('handles empty response', function () { let emptyResult = spec.interpretResponse(null, { bidRequests }); expect(emptyResult).to.be.empty; }); - it('handles response with bidding is not configured', () => { + it('handles response with bidding is not configured', function () { let emptyResult = spec.interpretResponse({ body: { Ads: [{ BidPrice: 1 }] } }, { bidRequests }); expect(emptyResult).to.be.empty; }); - it('handles response with no ads are received', () => { + it('handles response with no ads are received', function () { let emptyResult = spec.interpretResponse({ body: { BidModel: { PlacementId: '12345' }, AdReason: 'No ads' } }, { bidRequests }); expect(emptyResult).to.be.empty; }); - it('handles response with no ads are received - no ad reason', () => { + it('handles response with no ads are received - no ad reason', function () { let emptyResult = spec.interpretResponse({ body: { BidModel: { PlacementId: '12345' } } }, { bidRequests }); expect(emptyResult).to.be.empty; }); - it('handles response when no placement Id matches', () => { + it('handles response when no placement Id matches', function () { let emptyResult = spec.interpretResponse({ body: { BidModel: { PlacementId: '123456' }, Ads: [{ BidPrice: 1 }] } }, { bidRequests }); expect(emptyResult).to.be.empty; }); - it('handles response when placement Id is not present', () => { + it('handles response when placement Id is not present', function () { let emptyResult = spec.interpretResponse({ BidModel: { }, Ads: [{ BidPrice: 1 }] }, { bidRequests }); expect(emptyResult).to.be.empty; }); }); context('when the response is valid', function () { - it('responds with a valid bid', () => { + it('responds with a valid bid', function () { let result = spec.interpretResponse({ body: response }, { bidRequests }); expect(Object.keys(result[0])).to.have.members(Object.keys(expectedResponse[0])); }); - it('responds with a valid bid and uses logger', () => { + it('responds with a valid bid and uses logger', function () { localStorage.InvibesDEBUG = true; let result = spec.interpretResponse({ body: response }, { bidRequests }); expect(Object.keys(result[0])).to.have.members(Object.keys(expectedResponse[0])); }); - it('does not make multiple bids', () => { + it('does not make multiple bids', function () { localStorage.InvibesDEBUG = false; let result = spec.interpretResponse({ body: response }, { bidRequests }); let secondResult = spec.interpretResponse({ body: response }, { bidRequests }); @@ -252,13 +252,13 @@ describe('invibesBidAdapter:', function () { }); describe('getUserSyncs', function () { - it('returns an iframe if enabled', () => { + it('returns an iframe if enabled', function () { let response = spec.getUserSyncs({iframeEnabled: true}); expect(response.type).to.equal('iframe'); expect(response.url).to.include(SYNC_ENDPOINT); }); - it('returns an iframe with params if enabled', () => { + it('returns an iframe with params if enabled', function () { top.window.invibes.optIn = 1; global.document.cookie = 'ivvbks=17639.0,1,2'; let response = spec.getUserSyncs({ iframeEnabled: true }); @@ -269,7 +269,7 @@ describe('invibesBidAdapter:', function () { expect(response.url).to.include('ivbsdid'); }); - it('returns undefined if iframe not enabled ', () => { + it('returns undefined if iframe not enabled ', function () { let response = spec.getUserSyncs({ iframeEnabled: false }); expect(response).to.equal(undefined); }); diff --git a/test/spec/modules/iqmBidAdapter_spec.js b/test/spec/modules/iqmBidAdapter_spec.js index 8958a4dfc45..5535c52af9b 100644 --- a/test/spec/modules/iqmBidAdapter_spec.js +++ b/test/spec/modules/iqmBidAdapter_spec.js @@ -2,7 +2,7 @@ import {expect} from 'chai'; import {spec} from 'modules/iqmBidAdapter' import * as utils from 'src/utils'; -describe('iqmBidAdapter', () => { +describe('iqmBidAdapter', function () { const ENDPOINT_URL = 'https://pbd.bids.iqm.com'; const bidRequests = [{ bidder: 'iqm', @@ -80,15 +80,15 @@ describe('iqmBidAdapter', () => { headers: {} }; - describe('Request verification', () => { - it('basic property verification', () => { + describe('Request verification', function () { + it('basic property verification', function () { expect(spec.code).to.equal('iqm'); expect(spec.aliases).to.be.an('array'); // expect(spec.aliases).to.be.ofSize(1); expect(spec.aliases).to.have.lengthOf(1); }); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { 'bidder': 'iqm', 'params': { @@ -103,17 +103,17 @@ describe('iqmBidAdapter', () => { 'auctionId': '1d1a030790a475' }; - it('should return false for empty object', () => { + it('should return false for empty object', function () { expect(spec.isBidRequestValid({})).to.equal(false); }); - it('should return false for request without param', () => { + it('should return false for request without param', function () { let bid = Object.assign({}, bid); delete bid.params; expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should return false for invalid params', () => { + it('should return false for invalid params', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -122,13 +122,13 @@ describe('iqmBidAdapter', () => { expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should return true for proper request', () => { + it('should return true for proper request', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); }); }); - describe('buildRequests', () => { - it('sends every bid request to ENDPOINT_URL via POST method', () => { + describe('buildRequests', function () { + it('sends every bid request to ENDPOINT_URL via POST method', function () { const requests = spec.buildRequests(bidRequests); expect(requests[0].method).to.equal('POST'); expect(requests[0].url).to.equal(ENDPOINT_URL); @@ -136,7 +136,7 @@ describe('iqmBidAdapter', () => { // expect(requests[1].url).to.equal(ENDPOINT_URL); }); - it('should send request data with every request', () => { + it('should send request data with every request', function () { const requests = spec.buildRequests(bidRequests); const data = requests[0].data; expect(data.id).to.equal(bidRequests[0].requestId); @@ -175,31 +175,31 @@ describe('iqmBidAdapter', () => { }); }); - describe('interpretResponse', () => { - it('should handle no bid response', () => { + describe('interpretResponse', function () { + it('should handle no bid response', function () { const response = spec.interpretResponse({ body: null }, { bidRequests }); expect(response.length).to.equal(0); }); - it('should have at least one Seat Object', () => { + it('should have at least one Seat Object', function () { const request = spec.buildRequests(bidRequests); const response = spec.interpretResponse(bidResponseEmptySeat, request); expect(response.length).to.equal(0); }); - it('should have at least one Bid Object', () => { + it('should have at least one Bid Object', function () { const request = spec.buildRequests(bidRequests); const response = spec.interpretResponse(bidResponseEmptyBid, request); expect(response.length).to.equal(0); }); - it('should have impId in Bid Object', () => { + it('should have impId in Bid Object', function () { const request = spec.buildRequests(bidRequests); const response = spec.interpretResponse(bidResponseNoImpId, request); expect(response.length).to.equal(0); }); - it('should handle valid response', () => { + it('should handle valid response', function () { const request = spec.buildRequests(bidRequests); const response = spec.interpretResponse(bidResponses, request); expect(response).to.be.an('array').to.have.lengthOf(1); diff --git a/test/spec/modules/ixBidAdapter_spec.js b/test/spec/modules/ixBidAdapter_spec.js index 3bf0fb27280..8e0df9959ef 100644 --- a/test/spec/modules/ixBidAdapter_spec.js +++ b/test/spec/modules/ixBidAdapter_spec.js @@ -4,7 +4,7 @@ import { expect } from 'chai'; import { newBidder } from 'src/adapters/bidderFactory'; import { spec } from 'modules/ixBidAdapter'; -describe('IndexexchangeAdapter', () => { +describe('IndexexchangeAdapter', function () { const IX_ENDPOINT = 'http://as.casalemedia.com/cygnus'; const BIDDER_VERSION = 7.2; @@ -58,44 +58,44 @@ describe('IndexexchangeAdapter', () => { ] }; - describe('inherited functions', () => { - it('should exists and is a function', () => { + describe('inherited functions', function () { + it('should exists and is a function', function () { const adapter = newBidder(spec); expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { - it('should return true when required params found for a banner ad', () => { + describe('isBidRequestValid', function () { + it('should return true when required params found for a banner ad', function () { expect(spec.isBidRequestValid(DEFAULT_BANNER_VALID_BID[0])).to.equal(true); }); - it('should return true when optional params found for a banner ad', () => { + it('should return true when optional params found for a banner ad', function () { const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]); bid.params.bidFloor = 50; bid.params.bidFloorCur = 'USD'; expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return true when siteID is number', () => { + it('should return true when siteID is number', function () { const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]); bid.params.siteId = 123; expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when siteID is missing', () => { + it('should return false when siteID is missing', function () { const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]); delete bid.params.siteId; expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should return false when size is missing', () => { + it('should return false when size is missing', function () { const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]); delete bid.params.size; expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should return false when size array is wrong length', () => { + it('should return false when size array is wrong length', function () { const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]); bid.params.size = [ 300, @@ -105,13 +105,13 @@ describe('IndexexchangeAdapter', () => { expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should return false when size array is array of strings', () => { + it('should return false when size array is array of strings', function () { const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]); bid.params.size = ['300', '250']; expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should return false when mediaTypes is not banner', () => { + it('should return false when mediaTypes is not banner', function () { const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]); bid.mediaTypes = { video: { @@ -121,7 +121,7 @@ describe('IndexexchangeAdapter', () => { expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should return false when mediaTypes.banner does not have sizes', () => { + it('should return false when mediaTypes.banner does not have sizes', function () { const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]); bid.mediaTypes = { banner: { @@ -131,7 +131,7 @@ describe('IndexexchangeAdapter', () => { expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should return false when mediaType is not banner', () => { + it('should return false when mediaType is not banner', function () { const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]); delete bid.params.mediaTypes; bid.mediaType = 'banne'; @@ -139,7 +139,7 @@ describe('IndexexchangeAdapter', () => { expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should return false when mediaType is video', () => { + it('should return false when mediaType is video', function () { const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]); delete bid.params.mediaTypes; bid.mediaType = 'video'; @@ -147,7 +147,7 @@ describe('IndexexchangeAdapter', () => { expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should return false when mediaType is native', () => { + it('should return false when mediaType is native', function () { const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]); delete bid.params.mediaTypes; bid.mediaType = 'native'; @@ -155,14 +155,14 @@ describe('IndexexchangeAdapter', () => { expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should return true when mediaType is missing and has sizes', () => { + it('should return true when mediaType is missing and has sizes', function () { const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]); delete bid.mediaTypes; bid.sizes = [[300, 250]]; expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return true when mediaType is banner', () => { + it('should return true when mediaType is banner', function () { const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]); delete bid.mediaTypes; bid.mediaType = 'banner'; @@ -170,26 +170,26 @@ describe('IndexexchangeAdapter', () => { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when there is only bidFloor', () => { + it('should return false when there is only bidFloor', function () { const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]); bid.params.bidFloor = 50; expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should return false when there is only bidFloorCur', () => { + it('should return false when there is only bidFloorCur', function () { const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]); bid.params.bidFloorCur = 'USD'; expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should return false when bidFloor is string', () => { + it('should return false when bidFloor is string', function () { const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]); bid.params.bidFloor = '50'; bid.params.bidFloorCur = 'USD'; expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should return false when bidFloorCur is number', () => { + it('should return false when bidFloorCur is number', function () { const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]); bid.params.bidFloor = 50; bid.params.bidFloorCur = 70; @@ -197,7 +197,7 @@ describe('IndexexchangeAdapter', () => { }); }); - describe('buildRequestsBanner', () => { + describe('buildRequestsBanner', function () { const request = spec.buildRequests(DEFAULT_BANNER_VALID_BID); const requestUrl = request.url; const requestMethod = request.method; @@ -209,12 +209,12 @@ describe('IndexexchangeAdapter', () => { const requestWithoutMediaType = spec.buildRequests(bidWithoutMediaType); const queryWithoutMediaType = requestWithoutMediaType.data; - it('request should be made to IX endpoint with GET method', () => { + it('request should be made to IX endpoint with GET method', function () { expect(requestMethod).to.equal('GET'); expect(requestUrl).to.equal(IX_ENDPOINT); }); - it('query object (version, siteID and request) should be correct', () => { + it('query object (version, siteID and request) should be correct', function () { expect(query.v).to.equal(BIDDER_VERSION); expect(query.s).to.equal(DEFAULT_BANNER_VALID_BID[0].params.siteId); expect(query.r).to.exist; @@ -222,7 +222,7 @@ describe('IndexexchangeAdapter', () => { expect(query.sd).to.equal(1); }); - it('payload should have correct format and value', () => { + it('payload should have correct format and value', function () { const payload = JSON.parse(query.r); expect(payload.id).to.equal(DEFAULT_BANNER_VALID_BID[0].bidderRequestId); @@ -238,7 +238,7 @@ describe('IndexexchangeAdapter', () => { expect(payload.imp).to.have.lengthOf(1); }); - it('impression should have correct format and value', () => { + it('impression should have correct format and value', function () { const impression = JSON.parse(query.r).imp[0]; const sidValue = `${DEFAULT_BANNER_VALID_BID[0].params.size[0].toString()}x${DEFAULT_BANNER_VALID_BID[0].params.size[1].toString()}`; @@ -253,7 +253,7 @@ describe('IndexexchangeAdapter', () => { expect(impression.ext.sid).to.equal(sidValue); }); - it('impression should have bidFloor and bidFloorCur if configured', () => { + it('impression should have bidFloor and bidFloorCur if configured', function () { const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]); bid.params.bidFloor = 50; bid.params.bidFloorCur = 'USD'; @@ -264,7 +264,7 @@ describe('IndexexchangeAdapter', () => { expect(impression.bidfloorcur).to.equal(bid.params.bidFloorCur); }); - it('payload without mediaType should have correct format and value', () => { + it('payload without mediaType should have correct format and value', function () { const payload = JSON.parse(queryWithoutMediaType.r); expect(payload.id).to.equal(DEFAULT_BANNER_VALID_BID[0].bidderRequestId); @@ -280,7 +280,7 @@ describe('IndexexchangeAdapter', () => { expect(payload.imp).to.have.lengthOf(1); }); - it('impression without mediaType should have correct format and value', () => { + it('impression without mediaType should have correct format and value', function () { const impression = JSON.parse(queryWithoutMediaType.r).imp[0]; const sidValue = `${DEFAULT_BANNER_VALID_BID[0].params.size[0].toString()}x${DEFAULT_BANNER_VALID_BID[0].params.size[1].toString()}`; @@ -295,7 +295,7 @@ describe('IndexexchangeAdapter', () => { expect(impression.ext.sid).to.equal(sidValue); }); - it('impression should have sid if id is configured as number', () => { + it('impression should have sid if id is configured as number', function () { const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]); bid.params.id = 50; const requestBidFloor = spec.buildRequests([bid]); @@ -312,7 +312,7 @@ describe('IndexexchangeAdapter', () => { expect(impression.ext.sid).to.equal('50'); }); - it('impression should have sid if id is configured as string', () => { + it('impression should have sid if id is configured as string', function () { const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]); bid.params.id = 'abc'; const requestBidFloor = spec.buildRequests([bid]); @@ -328,7 +328,7 @@ describe('IndexexchangeAdapter', () => { expect(impression.ext.sid).to.equal('abc'); }); - it('should add first party data to page url in bid request if it exists in config', () => { + it('should add first party data to page url in bid request if it exists in config', function () { config.setConfig({ ix: { firstPartyData: { @@ -347,7 +347,7 @@ describe('IndexexchangeAdapter', () => { expect(pageUrl).to.equal(expectedPageUrl); }); - it('should not set first party data if it is not an object', () => { + it('should not set first party data if it is not an object', function () { config.setConfig({ ix: { firstPartyData: 500 @@ -360,7 +360,7 @@ describe('IndexexchangeAdapter', () => { expect(pageUrl).to.equal(utils.getTopWindowUrl()); }); - it('should not set first party or timeout if it is not present', () => { + it('should not set first party or timeout if it is not present', function () { config.setConfig({ ix: {} }); @@ -372,7 +372,7 @@ describe('IndexexchangeAdapter', () => { expect(requestWithoutConfig.data.t).to.be.undefined; }); - it('should not set first party or timeout if it is setConfig is not called', () => { + it('should not set first party or timeout if it is setConfig is not called', function () { const requestWithoutConfig = spec.buildRequests(DEFAULT_BANNER_VALID_BID); const pageUrl = JSON.parse(requestWithoutConfig.data.r).site.page; @@ -380,7 +380,7 @@ describe('IndexexchangeAdapter', () => { expect(requestWithoutConfig.data.t).to.be.undefined; }); - it('should set timeout if publisher set it through setConfig', () => { + it('should set timeout if publisher set it through setConfig', function () { config.setConfig({ ix: { timeout: 500 @@ -391,7 +391,7 @@ describe('IndexexchangeAdapter', () => { expect(requestWithTimeout.data.t).to.equal(500); }); - it('should set timeout if timeout is a string', () => { + it('should set timeout if timeout is a string', function () { config.setConfig({ ix: { timeout: '500' @@ -403,8 +403,8 @@ describe('IndexexchangeAdapter', () => { }); }); - describe('interpretResponseBanner', () => { - it('should get correct bid response', () => { + describe('interpretResponseBanner', function () { + it('should get correct bid response', function () { const expectedParse = [ { requestId: '1a2b3c4d', @@ -423,7 +423,7 @@ describe('IndexexchangeAdapter', () => { expect(result[0]).to.deep.equal(expectedParse[0]); }); - it('should set creativeId to default value if not provided', () => { + it('should set creativeId to default value if not provided', function () { const bidResponse = utils.deepClone(DEFAULT_BANNER_BID_RESPONSE); delete bidResponse.seatbid[0].bid[0].crid; const expectedParse = [ @@ -444,7 +444,7 @@ describe('IndexexchangeAdapter', () => { expect(result[0]).to.deep.equal(expectedParse[0]); }); - it('should set Japanese price correctly', () => { + it('should set Japanese price correctly', function () { const bidResponse = utils.deepClone(DEFAULT_BANNER_BID_RESPONSE); bidResponse.cur = 'JPY'; const expectedParse = [ @@ -465,7 +465,7 @@ describe('IndexexchangeAdapter', () => { expect(result[0]).to.deep.equal(expectedParse[0]); }); - it('should set dealId correctly', () => { + it('should set dealId correctly', function () { const bidResponse = utils.deepClone(DEFAULT_BANNER_BID_RESPONSE); bidResponse.seatbid[0].bid[0].ext.dealid = 'deal'; const expectedParse = [ @@ -486,7 +486,7 @@ describe('IndexexchangeAdapter', () => { expect(result[0]).to.deep.equal(expectedParse[0]); }); - it('bidrequest should have consent info if gdprApplies and consentString exist', () => { + it('bidrequest should have consent info if gdprApplies and consentString exist', function () { const options = { gdprConsent: { gdprApplies: true, @@ -501,7 +501,7 @@ describe('IndexexchangeAdapter', () => { expect(requestWithConsent.user.ext.consent).to.equal('3huaa11=qu3198ae'); }); - it('bidrequest should not have consent field if consentString is undefined', () => { + it('bidrequest should not have consent field if consentString is undefined', function () { const options = { gdprConsent: { gdprApplies: true, @@ -515,7 +515,7 @@ describe('IndexexchangeAdapter', () => { expect(requestWithConsent.user).to.be.undefined; }); - it('bidrequest should not have gdpr field if gdprApplies is undefined', () => { + it('bidrequest should not have gdpr field if gdprApplies is undefined', function () { const options = { gdprConsent: { consentString: '3huaa11=qu3198ae', @@ -529,7 +529,7 @@ describe('IndexexchangeAdapter', () => { expect(requestWithConsent.user.ext.consent).to.equal('3huaa11=qu3198ae'); }); - it('bidrequest should not have consent info if options.gdprConsent is undefined', () => { + it('bidrequest should not have consent info if options.gdprConsent is undefined', function () { const options = {}; const validBidWithConsent = spec.buildRequests(DEFAULT_BANNER_VALID_BID, options); const requestWithConsent = JSON.parse(validBidWithConsent.data.r); diff --git a/test/spec/modules/jcmBidAdapter_spec.js b/test/spec/modules/jcmBidAdapter_spec.js index 27784def4f9..0b467e1ecfb 100644 --- a/test/spec/modules/jcmBidAdapter_spec.js +++ b/test/spec/modules/jcmBidAdapter_spec.js @@ -4,16 +4,16 @@ import { newBidder } from 'src/adapters/bidderFactory'; const ENDPOINT = '//media.adfrontiers.com/'; -describe('jcmAdapter', () => { +describe('jcmAdapter', function () { const adapter = newBidder(spec); - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { 'bidder': 'jcm', 'params': { @@ -26,18 +26,18 @@ describe('jcmAdapter', () => { 'auctionId': '1d1a030790a475', }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let bid = Object.assign({}, bid); delete bid.params; expect(spec.isBidRequestValid(bid)).to.equal(false); }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let bidRequests = [ { 'bidder': 'jcm', @@ -55,11 +55,11 @@ describe('jcmAdapter', () => { const request = spec.buildRequests(bidRequests); - it('sends bid request to ENDPOINT via GET', () => { + it('sends bid request to ENDPOINT via GET', function () { expect(request.method).to.equal('GET'); }); - it('sends correct bid parameters', () => { + it('sends correct bid parameters', function () { const payloadArr = request.data.split('&'); expect(request.method).to.equal('GET'); expect(payloadArr.length).to.equal(4); @@ -75,8 +75,8 @@ describe('jcmAdapter', () => { }); }); - describe('interpretResponse', () => { - it('should get correct bid response', () => { + describe('interpretResponse', function () { + it('should get correct bid response', function () { let serverResponse = {'bids': [{'width': 300, 'height': 250, 'creativeId': '29681110', 'ad': '', 'cpm': 0.5, 'callbackId': '30b31c1838de1e'}]}; let expectedResponse = [ @@ -109,15 +109,15 @@ describe('jcmAdapter', () => { expect(Object.keys(result[0]).ad).to.equal(Object.keys(expectedResponse[0]).ad); }); - it('handles nobid responses', () => { + it('handles nobid responses', function () { let serverResponse = {'bids': []}; let result = spec.interpretResponse({ body: serverResponse }); expect(result.length).to.equal(0); }); }); - describe('getUserSyncs', () => { - it('Verifies sync iframe option', () => { + describe('getUserSyncs', function () { + it('Verifies sync iframe option', function () { expect(spec.getUserSyncs({})).to.be.undefined; expect(spec.getUserSyncs({ iframeEnabled: false })).to.be.undefined; const options = spec.getUserSyncs({ iframeEnabled: true }); @@ -127,7 +127,7 @@ describe('jcmAdapter', () => { expect(options[0].url).to.equal('//media.adfrontiers.com/hb/jcm_usersync.html'); }); - it('Verifies sync image option', () => { + it('Verifies sync image option', function () { expect(spec.getUserSyncs({ image: false })).to.be.undefined; const options = spec.getUserSyncs({ image: true }); expect(options).to.not.be.undefined; diff --git a/test/spec/modules/justpremiumBidAdapter_spec.js b/test/spec/modules/justpremiumBidAdapter_spec.js index eb6d17d7a32..da0e147bd29 100644 --- a/test/spec/modules/justpremiumBidAdapter_spec.js +++ b/test/spec/modules/justpremiumBidAdapter_spec.js @@ -1,7 +1,7 @@ import { expect } from 'chai' import { spec } from 'modules/justpremiumBidAdapter' -describe('justpremium adapter', () => { +describe('justpremium adapter', function () { let adUnits = [ { adUnitCode: 'div-gpt-ad-1471513102552-1', @@ -21,12 +21,12 @@ describe('justpremium adapter', () => { }, ] - describe('isBidRequestValid', () => { - it('Verifies bidder code', () => { + describe('isBidRequestValid', function () { + it('Verifies bidder code', function () { expect(spec.code).to.equal('justpremium') }) - it('Verify build request', () => { + it('Verify build request', function () { expect(spec.isBidRequestValid({bidder: 'justpremium', params: {}})).to.equal(false) expect(spec.isBidRequestValid({})).to.equal(false) expect(spec.isBidRequestValid(adUnits[0])).to.equal(true) @@ -34,8 +34,8 @@ describe('justpremium adapter', () => { }) }) - describe('buildRequests', () => { - it('Verify build request and parameters', () => { + describe('buildRequests', function () { + it('Verify build request and parameters', function () { const request = spec.buildRequests(adUnits) expect(request.method).to.equal('POST') expect(request.url).to.match(/pre.ads.justpremium.com\/v\/2.0\/t\/xhr/) @@ -57,9 +57,9 @@ describe('justpremium adapter', () => { }) }) - describe('interpretResponse', () => { + describe('interpretResponse', function () { const request = spec.buildRequests(adUnits) - it('Verify server response', () => { + it('Verify server response', function () { let response = { 'bid': { '28313': [{ @@ -107,7 +107,7 @@ describe('justpremium adapter', () => { expect(result[0].format).to.equal('lb') }) - it('Verify wrong server response', () => { + it('Verify wrong server response', function () { let response = { 'bid': { '28313': [] @@ -122,8 +122,8 @@ describe('justpremium adapter', () => { }) }) - describe('getUserSyncs', () => { - it('Verifies sync options', () => { + describe('getUserSyncs', function () { + it('Verifies sync options', function () { const options = spec.getUserSyncs({iframeEnabled: true}) expect(options).to.not.be.undefined expect(options[0].type).to.equal('iframe') @@ -131,7 +131,7 @@ describe('justpremium adapter', () => { }) }) - describe('onTimeout', () => { + describe('onTimeout', function () { it('onTimeout', (done) => { spec.onTimeout([{ 'bidId': '25cd3ec3fd6ed7', diff --git a/test/spec/modules/kargoBidAdapter_spec.js b/test/spec/modules/kargoBidAdapter_spec.js index 432ae086511..eafb5a9c0f3 100644 --- a/test/spec/modules/kargoBidAdapter_spec.js +++ b/test/spec/modules/kargoBidAdapter_spec.js @@ -6,12 +6,12 @@ import {config} from 'src/config'; describe('kargo adapter tests', function () { var sandbox, clock, frozenNow = new Date(); - beforeEach(() => { + beforeEach(function () { sandbox = sinon.sandbox.create(); clock = sinon.useFakeTimers(frozenNow.getTime()); }); - afterEach(() => { + afterEach(function () { sandbox.restore(); clock.restore(); }); @@ -37,7 +37,7 @@ describe('kargo adapter tests', function () { describe('build request', function() { var bids, cookies = [], localStorageItems = []; - beforeEach(() => { + beforeEach(function () { sandbox.stub(config, 'getConfig').callsFake(function(key) { if (key === 'currency') { return 'USD'; @@ -67,7 +67,7 @@ describe('kargo adapter tests', function () { ]; }); - afterEach(() => { + afterEach(function () { for (let key in cookies) { let cookie = cookies[key]; removeCookie(cookie); diff --git a/test/spec/modules/komoonaBidAdapter_spec.js b/test/spec/modules/komoonaBidAdapter_spec.js index f7038505db3..b6d17c7b20c 100644 --- a/test/spec/modules/komoonaBidAdapter_spec.js +++ b/test/spec/modules/komoonaBidAdapter_spec.js @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { spec } from 'modules/komoonaBidAdapter'; -describe('Komoona.com Adapter Tests', () => { +describe('Komoona.com Adapter Tests', function () { const bidsRequest = [ { bidder: 'komoona', @@ -54,11 +54,11 @@ describe('Komoona.com Adapter Tests', () => { } }; - it('Verifies komoonaAdapter bidder code', () => { + it('Verifies komoonaAdapter bidder code', function () { expect(spec.code).to.equal('komoona'); }); - it('Verifies komoonaAdapter bid request validation', () => { + it('Verifies komoonaAdapter bid request validation', function () { expect(spec.isBidRequestValid(bidsRequest[0])).to.equal(true); expect(spec.isBidRequestValid(bidsRequest[1])).to.equal(true); expect(spec.isBidRequestValid({})).to.equal(false); @@ -69,7 +69,7 @@ describe('Komoona.com Adapter Tests', () => { expect(spec.isBidRequestValid({ params: { hbid: 12345, placementId: 67890, floorPrice: 0.8 } })).to.equal(true); }); - it('Verify komoonaAdapter build request', () => { + it('Verify komoonaAdapter build request', function () { var startTime = new Date().getTime(); const request = spec.buildRequests(bidsRequest); @@ -127,7 +127,7 @@ describe('Komoona.com Adapter Tests', () => { expect(kbConf.hb_placements[1]).to.equal(bids[1].placementid); }); - it('Verify komoonaAdapter build response', () => { + it('Verify komoonaAdapter build response', function () { const request = spec.buildRequests(bidsRequest); const bids = spec.interpretResponse(bidsResponse, request); @@ -150,7 +150,7 @@ describe('Komoona.com Adapter Tests', () => { expect(bid.creativeId).to.equal(responseBids[0].creativeId); }); - it('Verifies komoonaAdapter sync options', () => { + it('Verifies komoonaAdapter sync options', function () { // user sync disabled expect(spec.getUserSyncs({})).to.be.undefined; expect(spec.getUserSyncs({ iframeEnabled: false })).to.be.undefined; diff --git a/test/spec/modules/kummaBidAdapter_spec.js b/test/spec/modules/kummaBidAdapter_spec.js index 84efa032cec..82076717dcc 100644 --- a/test/spec/modules/kummaBidAdapter_spec.js +++ b/test/spec/modules/kummaBidAdapter_spec.js @@ -3,7 +3,7 @@ import {spec} from 'modules/kummaBidAdapter'; import {getTopWindowLocation} from 'src/utils'; import {newBidder} from 'src/adapters/bidderFactory'; -describe('Kumma Adapter Tests', () => { +describe('Kumma Adapter Tests', function () { const slotConfigs = [{ placementCode: '/DfpAccount1/slot1', sizes: [[300, 250]], @@ -77,7 +77,7 @@ describe('Kumma Adapter Tests', () => { } }]; - it('Verify build request', () => { + it('Verify build request', function () { const request = spec.buildRequests(slotConfigs); expect(request.url).to.equal('//hb.kumma.com/'); expect(request.method).to.equal('POST'); @@ -109,7 +109,7 @@ describe('Kumma Adapter Tests', () => { expect(ortbRequest.imp[1].bidfloor).to.equal('0.000001'); }); - it('Verify parse response', () => { + it('Verify parse response', function () { const request = spec.buildRequests(slotConfigs); const ortbRequest = JSON.parse(request.data); const ortbResponse = { @@ -137,13 +137,13 @@ describe('Kumma Adapter Tests', () => { expect(bid.ttl).to.equal(360); }); - it('Verify full passback', () => { + it('Verify full passback', function () { const request = spec.buildRequests(slotConfigs); const bids = spec.interpretResponse({ body: null }, request) expect(bids).to.have.lengthOf(0); }); - it('Verify Native request', () => { + it('Verify Native request', function () { const request = spec.buildRequests(nativeSlotConfig); expect(request.url).to.equal('//hb.kumma.com/'); expect(request.method).to.equal('POST'); @@ -181,7 +181,7 @@ describe('Kumma Adapter Tests', () => { expect(nativeRequest.assets[4].img.type).to.equal(3); }); - it('Verify Native response', () => { + it('Verify Native response', function () { const request = spec.buildRequests(nativeSlotConfig); expect(request.url).to.equal('//hb.kumma.com/'); expect(request.method).to.equal('POST'); @@ -231,7 +231,7 @@ describe('Kumma Adapter Tests', () => { expect(nativeBid.impressionTrackers[0]).to.equal('http://rtb.adx1.com/log'); }); - it('Verify Video request', () => { + it('Verify Video request', function () { const request = spec.buildRequests(videoSlotConfig); expect(request.url).to.equal('//hb.kumma.com/'); expect(request.method).to.equal('POST'); @@ -253,7 +253,7 @@ describe('Kumma Adapter Tests', () => { expect(videoRequest.imp[0].native).to.equal(null); }); - it('Verify parse video response', () => { + it('Verify parse video response', function () { const request = spec.buildRequests(videoSlotConfig); const videoRequest = JSON.parse(request.data); const videoResponse = { @@ -282,25 +282,25 @@ describe('Kumma Adapter Tests', () => { expect(bid.ttl).to.equal(360); }); - it('Verifies bidder code', () => { + it('Verifies bidder code', function () { expect(spec.code).to.equal('kumma'); }); - it('Verifies supported media types', () => { + it('Verifies supported media types', function () { expect(spec.supportedMediaTypes).to.have.lengthOf(3); expect(spec.supportedMediaTypes[0]).to.equal('banner'); expect(spec.supportedMediaTypes[1]).to.equal('native'); expect(spec.supportedMediaTypes[2]).to.equal('video'); }); - it('Verifies if bid request valid', () => { + it('Verifies if bid request valid', function () { expect(spec.isBidRequestValid(slotConfigs[0])).to.equal(true); expect(spec.isBidRequestValid(slotConfigs[1])).to.equal(true); expect(spec.isBidRequestValid(nativeSlotConfig[0])).to.equal(true); expect(spec.isBidRequestValid(videoSlotConfig[0])).to.equal(true); }); - it('Verify app requests', () => { + it('Verify app requests', function () { const request = spec.buildRequests(appSlotConfig); const ortbRequest = JSON.parse(request.data); expect(ortbRequest.site).to.equal(null); @@ -314,7 +314,7 @@ describe('Kumma Adapter Tests', () => { expect(ortbRequest.app.domain).to.equal('kumma.com'); }); - it('Verify GDPR', () => { + it('Verify GDPR', function () { const bidderRequest = { gdprConsent: { gdprApplies: true, diff --git a/test/spec/modules/lifestreetBidAdapter_spec.js b/test/spec/modules/lifestreetBidAdapter_spec.js index 2c48a0f1892..6c9c6eeba31 100644 --- a/test/spec/modules/lifestreetBidAdapter_spec.js +++ b/test/spec/modules/lifestreetBidAdapter_spec.js @@ -56,45 +56,45 @@ let getDefaultBidResponse = (isBanner, noBid = 0) => { }; }; -describe('LifestreetAdapter', () => { +describe('LifestreetAdapter', function () { const LIFESTREET_URL = '//ads.lfstmedia.com/gate/'; const ADAPTER_VERSION = 'prebidJS-2.0'; - describe('buildRequests()', () => { - it('method exists and is a function', () => { + describe('buildRequests()', function () { + it('method exists and is a function', function () { expect(spec.buildRequests).to.exist.and.to.be.a('function'); }); - it('should not return request when no bids are present', () => { + it('should not return request when no bids are present', function () { let [request] = spec.buildRequests([]); expect(request).to.be.empty; }); let bidRequest = getDefaultBidRequest(); let [request] = spec.buildRequests(bidRequest.bids); - it('should return request for Lifestreet endpoint', () => { + it('should return request for Lifestreet endpoint', function () { expect(request.url).to.contain(LIFESTREET_URL); }); - it('should use json adapter', () => { + it('should use json adapter', function () { expect(request.url).to.contain('/prebid/'); }); - it('should contain slot', () => { + it('should contain slot', function () { expect(request.url).to.contain('slot166704'); }); - it('should contain adkey', () => { + it('should contain adkey', function () { expect(request.url).to.contain('adkey=78c'); }); - it('should contain ad_size', () => { + it('should contain ad_size', function () { expect(request.url).to.contain('ad_size=160x600'); }); - it('should contain location and rferrer paramters', () => { + it('should contain location and rferrer paramters', function () { expect(request.url).to.contain('__location='); expect(request.url).to.contain('__referrer='); }); - it('should contain info parameters', () => { + it('should contain info parameters', function () { expect(request.url).to.contain('__wn='); expect(request.url).to.contain('__sf='); expect(request.url).to.contain('__fif='); @@ -103,24 +103,24 @@ describe('LifestreetAdapter', () => { expect(request.url).to.contain('__pp='); }); - it('should contain HB enabled', () => { + it('should contain HB enabled', function () { expect(request.url).to.contain('__hb=1'); }); - it('should include gzip', () => { + it('should include gzip', function () { expect(request.url).to.contain('__gz=1'); }); - it('should not contain __gdpr parameter', () => { + it('should not contain __gdpr parameter', function () { expect(request.url).to.not.contain('__gdpr'); }); - it('should not contain __concent parameter', () => { + it('should not contain __concent parameter', function () { expect(request.url).to.not.contain('__consent'); }); - it('should contain the right version of adapter', () => { + it('should contain the right version of adapter', function () { expect(request.url).to.contain('__hbver=' + ADAPTER_VERSION); }); - it('should contain __gdpr and __consent parameters', () => { + it('should contain __gdpr and __consent parameters', function () { const options = { gdprConsent: { gdprApplies: true, @@ -132,7 +132,7 @@ describe('LifestreetAdapter', () => { expect(request.url).to.contain('__gdpr=1'); expect(request.url).to.contain('__consent=test'); }); - it('should contain __gdpr parameters', () => { + it('should contain __gdpr parameters', function () { const options = { gdprConsent: { gdprApplies: true, @@ -143,7 +143,7 @@ describe('LifestreetAdapter', () => { expect(request.url).to.contain('__gdpr=1'); expect(request.url).to.not.contain('__consent'); }); - it('should contain __consent parameters', () => { + it('should contain __consent parameters', function () { const options = { gdprConsent: { consentString: 'test', @@ -155,8 +155,8 @@ describe('LifestreetAdapter', () => { expect(request.url).to.contain('__consent=test'); }); }); - describe('interpretResponse()', () => { - it('should return formatted bid response with required properties', () => { + describe('interpretResponse()', function () { + it('should return formatted bid response with required properties', function () { let bidRequest = getDefaultBidRequest().bids[0]; let bidResponse = { body: getDefaultBidResponse(true) }; let formattedBidResponse = spec.interpretResponse(bidResponse, bidRequest); @@ -174,7 +174,7 @@ describe('LifestreetAdapter', () => { mediaType: 'banner' }]); }); - it('should return formatted VAST bid response with required properties', () => { + it('should return formatted VAST bid response with required properties', function () { let bidRequest = getDefaultBidRequest().bids[0]; let bidResponse = { body: getDefaultBidResponse(false) }; let formattedBidResponse = spec.interpretResponse(bidResponse, bidRequest); @@ -192,7 +192,7 @@ describe('LifestreetAdapter', () => { mediaType: 'video' }]); }); - it('should return formatted VAST bid response with vastUrl', () => { + it('should return formatted VAST bid response with vastUrl', function () { let bidRequest = getDefaultBidRequest().bids[0]; let bidResponse = { body: getDefaultBidResponse(false) }; bidResponse.body.vastUrl = 'http://lifestreet.com'; // set vastUrl @@ -212,7 +212,7 @@ describe('LifestreetAdapter', () => { }]); }); - it('should return no-bid', () => { + it('should return no-bid', function () { let bidRequest = getDefaultBidRequest().bids[0]; let bidResponse = { body: getDefaultBidResponse(true, true) }; let formattedBidResponse = spec.interpretResponse(bidResponse, bidRequest); diff --git a/test/spec/modules/lkqdBidAdapter_spec.js b/test/spec/modules/lkqdBidAdapter_spec.js index a5e75086229..0cebb2651a9 100644 --- a/test/spec/modules/lkqdBidAdapter_spec.js +++ b/test/spec/modules/lkqdBidAdapter_spec.js @@ -2,16 +2,16 @@ import { spec } from 'modules/lkqdBidAdapter'; import { newBidder } from 'src/adapters/bidderFactory'; const { expect } = require('chai'); -describe('LKQD Bid Adapter Test', () => { +describe('LKQD Bid Adapter Test', function () { const adapter = newBidder(spec); - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { 'bidder': 'lkqd', 'params': { @@ -26,11 +26,11 @@ describe('LKQD Bid Adapter Test', () => { 'transactionId': 'd6f6b392-54a9-454c-85fb-a2fd882c4a2d', }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -40,7 +40,7 @@ describe('LKQD Bid Adapter Test', () => { }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { const ENDPOINT = 'https://v.lkqd.net/ad'; let bidRequests = [ { @@ -73,7 +73,7 @@ describe('LKQD Bid Adapter Test', () => { } ]; - it('should populate available parameters', () => { + it('should populate available parameters', function () { const requests = spec.buildRequests(bidRequests); expect(requests.length).to.equal(2); const r1 = requests[0].data; @@ -96,7 +96,7 @@ describe('LKQD Bid Adapter Test', () => { expect(r2.height).to.equal(480); }); - it('should not populate unspecified parameters', () => { + it('should not populate unspecified parameters', function () { const requests = spec.buildRequests(bidRequests); expect(requests.length).to.equal(2); const r1 = requests[0].data; @@ -115,7 +115,7 @@ describe('LKQD Bid Adapter Test', () => { expect(r2).to.not.have.property('contenturl'); }); - it('should handle single size request', () => { + it('should handle single size request', function () { const requests = spec.buildRequests(bidRequest); expect(requests.length).to.equal(1); const r1 = requests[0].data; @@ -129,7 +129,7 @@ describe('LKQD Bid Adapter Test', () => { expect(r1.height).to.equal(480); }); - it('sends bid request to ENDPOINT via GET', () => { + it('sends bid request to ENDPOINT via GET', function () { const requests = spec.buildRequests(bidRequests); expect(requests.length).to.equal(2); const r1 = requests[0]; @@ -141,7 +141,7 @@ describe('LKQD Bid Adapter Test', () => { }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { let bidRequest = { 'url': 'https://ssp.lkqd.net/ad?pid=263&sid=662921&output=vast&execution=any&placement=&playinit=auto&volume=100&timeout=&width=300%E2%80%8C&height=250&pbt=[PREBID_TOKEN]%E2%80%8C&dnt=[DO_NOT_TRACK]%E2%80%8C&pageurl=[PAGEURL]%E2%80%8C&contentid=[CONTENT_ID]%E2%80%8C&contenttitle=[CONTENT_TITLE]%E2%80%8C&contentlength=[CONTENT_LENGTH]%E2%80%8C&contenturl=[CONTENT_URL]&prebid=true%E2%80%8C&rnd=874313435?bidId=253dcb69fb2577&bidWidth=300&bidHeight=250&', 'data': { @@ -322,7 +322,7 @@ https://creative.lkqd.net/internal/lkqd_300x250.mp4 `; - it('should correctly parse valid bid response', () => { + it('should correctly parse valid bid response', function () { const BIDDER_CODE = 'lkqd'; let bidResponses = spec.interpretResponse(serverResponse, bidRequest); expect(bidResponses.length).to.equal(1); @@ -340,7 +340,7 @@ https://creative.lkqd.net/internal/lkqd_300x250.mp4 expect(bidResponse.mediaType).to.equal('video'); }); - it('safely handles XML parsing failure from invalid bid response', () => { + it('safely handles XML parsing failure from invalid bid response', function () { let invalidServerResponse = {}; invalidServerResponse.body = ''; @@ -348,7 +348,7 @@ https://creative.lkqd.net/internal/lkqd_300x250.mp4 expect(result.length).to.equal(0); }); - it('handles nobid responses', () => { + it('handles nobid responses', function () { let nobidResponse = {}; nobidResponse.body = ''; diff --git a/test/spec/modules/lockerdomeBidAdapter_spec.js b/test/spec/modules/lockerdomeBidAdapter_spec.js index 19884065597..1cd6778b01f 100644 --- a/test/spec/modules/lockerdomeBidAdapter_spec.js +++ b/test/spec/modules/lockerdomeBidAdapter_spec.js @@ -2,7 +2,7 @@ import { expect } from 'chai'; import { spec } from '../../../modules/lockerdomeBidAdapter'; import * as utils from 'src/utils'; -describe('LockerDomeAdapter', () => { +describe('LockerDomeAdapter', function () { const bidRequests = [{ bidder: 'lockerdome', params: { @@ -37,20 +37,20 @@ describe('LockerDomeAdapter', () => { auctionId: 'd4c83108-615d-4c2c-9384-dac9ffd4fd72' }]; - describe('isBidRequestValid', () => { - it('should return true if the adUnitId parameter is present', () => { + describe('isBidRequestValid', function () { + it('should return true if the adUnitId parameter is present', function () { expect(spec.isBidRequestValid(bidRequests[0])).to.be.true; expect(spec.isBidRequestValid(bidRequests[1])).to.be.true; }); - it('should return false if the adUnitId parameter is not present', () => { + it('should return false if the adUnitId parameter is not present', function () { let bidRequest = utils.deepClone(bidRequests[0]); delete bidRequest.params.adUnitId; expect(spec.isBidRequestValid(bidRequest)).to.be.false; }); }); - describe('buildRequests', () => { - it('should generate a valid single POST request for multiple bid requests', () => { + describe('buildRequests', function () { + it('should generate a valid single POST request for multiple bid requests', function () { const request = spec.buildRequests(bidRequests); expect(request.method).to.equal('POST'); expect(request.url).to.equal('https://lockerdome.com/ladbid/prebid'); @@ -79,7 +79,7 @@ describe('LockerDomeAdapter', () => { expect(bids[1].sizes[0][1]).to.equal(600); }); - it('should add GDPR data to request if available', () => { + it('should add GDPR data to request if available', function () { const bidderRequest = { gdprConsent: { consentString: 'AAABBB', @@ -95,13 +95,13 @@ describe('LockerDomeAdapter', () => { }); }); - describe('interpretResponse', () => { - it('should return an empty array if an invalid response is passed', () => { + describe('interpretResponse', function () { + it('should return an empty array if an invalid response is passed', function () { const interpretedResponse = spec.interpretResponse({ body: {} }); expect(interpretedResponse).to.be.an('array').that.is.empty; }); - it('should return valid response when passed valid server response', () => { + it('should return valid response when passed valid server response', function () { const serverResponse = { body: { bids: [{ diff --git a/test/spec/modules/madvertiseBidAdapter_spec.js b/test/spec/modules/madvertiseBidAdapter_spec.js index c391ca1d39f..b2a08410532 100644 --- a/test/spec/modules/madvertiseBidAdapter_spec.js +++ b/test/spec/modules/madvertiseBidAdapter_spec.js @@ -3,9 +3,9 @@ import {config} from 'src/config'; import * as utils from 'src/utils'; import {spec} from 'modules/madvertiseBidAdapter'; -describe('madvertise adapater', () => { - describe('Test validate req', () => { - it('should accept minimum valid bid', () => { +describe('madvertise adapater', function () { + describe('Test validate req', function () { + it('should accept minimum valid bid', function () { let bid = { bidder: 'madvertise', sizes: [[728, 90]], @@ -17,7 +17,7 @@ describe('madvertise adapater', () => { expect(isValid).to.equal(true); }); - it('should reject no sizes', () => { + it('should reject no sizes', function () { let bid = { bidder: 'madvertise', params: { @@ -28,7 +28,7 @@ describe('madvertise adapater', () => { expect(isValid).to.equal(false); }); - it('should reject empty sizes', () => { + it('should reject empty sizes', function () { let bid = { bidder: 'madvertise', sizes: [], @@ -40,7 +40,7 @@ describe('madvertise adapater', () => { expect(isValid).to.equal(false); }); - it('should reject wrong format sizes', () => { + it('should reject wrong format sizes', function () { let bid = { bidder: 'madvertise', sizes: [['728x90']], @@ -51,7 +51,7 @@ describe('madvertise adapater', () => { const isValid = spec.isBidRequestValid(bid); expect(isValid).to.equal(false); }); - it('should reject no params', () => { + it('should reject no params', function () { let bid = { bidder: 'madvertise', sizes: [[728, 90]] @@ -60,7 +60,7 @@ describe('madvertise adapater', () => { expect(isValid).to.equal(false); }); - it('should reject missing s', () => { + it('should reject missing s', function () { let bid = { bidder: 'madvertise', params: {} @@ -71,7 +71,7 @@ describe('madvertise adapater', () => { }); }); - describe('Test build request', () => { + describe('Test build request', function () { beforeEach(function () { let mockConfig = { consentManagement: { @@ -100,7 +100,7 @@ describe('madvertise adapater', () => { s: 'test', } }]; - it('minimum request with gdpr consent', () => { + it('minimum request with gdpr consent', function () { let bidderRequest = { gdprConsent: { consentString: 'BOJ/P2HOJ/P2HABABMAAAAAZ+A==', @@ -122,7 +122,7 @@ describe('madvertise adapater', () => { expect(req[0].url).to.contain(`&consent[0][value]=BOJ/P2HOJ/P2HABABMAAAAAZ+A==`) }); - it('minimum request without gdpr consent', () => { + it('minimum request without gdpr consent', function () { let bidderRequest = {}; const req = spec.buildRequests(bid, bidderRequest); @@ -139,8 +139,8 @@ describe('madvertise adapater', () => { }); }); - describe('Test interpret response', () => { - it('General banner response', () => { + describe('Test interpret response', function () { + it('General banner response', function () { let bid = { bidder: 'madvertise', sizes: [[728, 90]], @@ -180,7 +180,7 @@ describe('madvertise adapater', () => { expect(resp[0]).to.have.property('currency', 'EUR'); expect(resp[0]).to.have.property('dealId', 'DEAL_ID'); }); - it('No response', () => { + it('No response', function () { let bid = { bidder: 'madvertise', sizes: [[728, 90]], diff --git a/test/spec/modules/mantisBidAdapter_spec.js b/test/spec/modules/mantisBidAdapter_spec.js index 46cb413597e..464cea2aab3 100644 --- a/test/spec/modules/mantisBidAdapter_spec.js +++ b/test/spec/modules/mantisBidAdapter_spec.js @@ -2,10 +2,10 @@ import {expect} from 'chai'; import {spec} from 'modules/mantisBidAdapter'; import {newBidder} from 'src/adapters/bidderFactory'; -describe('MantisAdapter', () => { +describe('MantisAdapter', function () { const adapter = newBidder(spec); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { 'bidder': 'mantis', 'params': { @@ -19,11 +19,11 @@ describe('MantisAdapter', () => { 'auctionId': '1d1a030790a475', }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = {}; @@ -31,7 +31,7 @@ describe('MantisAdapter', () => { }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let bidRequests = [ { 'bidder': 'mantis', @@ -47,7 +47,7 @@ describe('MantisAdapter', () => { } ]; - it('domain override', () => { + it('domain override', function () { window.mantis_domain = 'http://foo'; const request = spec.buildRequests(bidRequests); @@ -56,7 +56,7 @@ describe('MantisAdapter', () => { delete window.mantis_domain; }); - it('standard request', () => { + it('standard request', function () { const request = spec.buildRequests(bidRequests); expect(request.url).to.include('property=10433394'); @@ -68,7 +68,7 @@ describe('MantisAdapter', () => { expect(request.url).to.include('bids[0][sizes][1][height]=600'); }); - it('use window uuid', () => { + it('use window uuid', function () { window.mantis_uuid = 'foo'; const request = spec.buildRequests(bidRequests); @@ -78,7 +78,7 @@ describe('MantisAdapter', () => { delete window.mantis_uuid; }); - it('use storage uuid', () => { + it('use storage uuid', function () { window.localStorage.setItem('mantis:uuid', 'bar'); const request = spec.buildRequests(bidRequests); @@ -88,7 +88,7 @@ describe('MantisAdapter', () => { window.localStorage.removeItem('mantis:uuid'); }); - it('detect amp', () => { + it('detect amp', function () { var oldContext = window.context; window.context = {}; @@ -107,8 +107,8 @@ describe('MantisAdapter', () => { }); }); - describe('getUserSyncs', () => { - it('iframe', () => { + describe('getUserSyncs', function () { + it('iframe', function () { let result = spec.getUserSyncs({ iframeEnabled: true }); @@ -117,7 +117,7 @@ describe('MantisAdapter', () => { expect(result[0].url).to.include('https://mantodea.mantisadnetwork.com/prebid/iframe'); }); - it('pixel', () => { + it('pixel', function () { let result = spec.getUserSyncs({ pixelEnabled: true }); @@ -127,8 +127,8 @@ describe('MantisAdapter', () => { }); }); - describe('interpretResponse', () => { - it('display ads returned', () => { + describe('interpretResponse', function () { + it('display ads returned', function () { let response = { body: { uuid: 'uuid', @@ -166,7 +166,7 @@ describe('MantisAdapter', () => { expect(window.localStorage.getItem('mantis:uuid')).to.equal(response.body.uuid); }); - it('no ads returned', () => { + it('no ads returned', function () { let response = { body: { ads: [] diff --git a/test/spec/modules/medianetBidAdapter_spec.js b/test/spec/modules/medianetBidAdapter_spec.js index 027b23f54bb..bb55ed99e02 100644 --- a/test/spec/modules/medianetBidAdapter_spec.js +++ b/test/spec/modules/medianetBidAdapter_spec.js @@ -488,40 +488,40 @@ let VALID_BID_REQUEST = [{ 'tmax': 3000, }; -describe('Media.net bid adapter', () => { +describe('Media.net bid adapter', function () { let sandbox; - beforeEach(() => { + beforeEach(function () { sandbox = sinon.sandbox.create(); }); - afterEach(() => { + afterEach(function () { sandbox.restore(); }); - describe('isBidRequestValid', () => { - it('should accept valid bid params', () => { + describe('isBidRequestValid', function () { + it('should accept valid bid params', function () { let isValid = spec.isBidRequestValid(VALID_PARAMS); expect(isValid).to.equal(true); }); - it('should reject bid if cid is not present', () => { + it('should reject bid if cid is not present', function () { let isValid = spec.isBidRequestValid(PARAMS_WITHOUT_CID); expect(isValid).to.equal(false); }); - it('should reject bid if cid is not a string', () => { + it('should reject bid if cid is not a string', function () { let isValid = spec.isBidRequestValid(PARAMS_WITH_INTEGER_CID); expect(isValid).to.equal(false); }); - it('should reject bid if cid is a empty string', () => { + it('should reject bid if cid is a empty string', function () { let isValid = spec.isBidRequestValid(PARAMS_WITH_EMPTY_CID); expect(isValid).to.equal(false); }); }); - describe('buildRequests', () => { - beforeEach(() => { + describe('buildRequests', function () { + beforeEach(function () { let documentStub = sandbox.stub(document, 'getElementById'); let boundingRect = { top: 50, @@ -542,28 +542,28 @@ describe('Media.net bid adapter', () => { }); }); - it('should build valid payload on bid', () => { + it('should build valid payload on bid', function () { let requestObj = spec.buildRequests(VALID_BID_REQUEST, VALID_AUCTIONDATA); expect(JSON.parse(requestObj.data)).to.deep.equal(VALID_PAYLOAD); }); - it('should accept size as a one dimensional array', () => { + it('should accept size as a one dimensional array', function () { let bidReq = spec.buildRequests(BID_REQUEST_SIZE_AS_1DARRAY, VALID_AUCTIONDATA); expect(JSON.parse(bidReq.data)).to.deep.equal(VALID_PAYLOAD); }); - it('should ignore bidfloor if not a valid number', () => { + it('should ignore bidfloor if not a valid number', function () { let bidReq = spec.buildRequests(VALID_BID_REQUEST_INVALID_BIDFLOOR, VALID_AUCTIONDATA); expect(JSON.parse(bidReq.data)).to.deep.equal(VALID_PAYLOAD_INVALID_BIDFLOOR); }); - it('should add gdpr to response ext', () => { + it('should add gdpr to response ext', function () { let bidReq = spec.buildRequests(VALID_BID_REQUEST, VALID_BIDDER_REQUEST_WITH_GDPR); expect(JSON.parse(bidReq.data)).to.deep.equal(VALID_PAYLOAD_FOR_GDPR); }); - describe('build requests: when page meta-data is available', () => { - it('should pass canonical, twitter and fb paramters if available', () => { + describe('build requests: when page meta-data is available', function () { + it('should pass canonical, twitter and fb paramters if available', function () { let documentStub = sandbox.stub(window.top.document, 'querySelector'); documentStub.withArgs('link[rel="canonical"]').returns({ href: 'http://localhost:9999/canonical-test' @@ -580,9 +580,9 @@ describe('Media.net bid adapter', () => { }); }); - describe('slot visibility', () => { + describe('slot visibility', function () { let documentStub; - beforeEach(() => { + beforeEach(function () { let windowSizeStub = sandbox.stub(spec, 'getWindowSize'); windowSizeStub.returns({ w: 1000, @@ -590,7 +590,7 @@ describe('Media.net bid adapter', () => { }); documentStub = sandbox.stub(document, 'getElementById'); }); - it('slot visibility should be 2 and ratio 0 when ad unit is BTF', () => { + it('slot visibility should be 2 and ratio 0 when ad unit is BTF', function () { let boundingRect = { top: 1010, left: 1010, @@ -609,7 +609,7 @@ describe('Media.net bid adapter', () => { expect(data.imp[0].ext.visibility).to.equal(2); expect(data.imp[0].ext.viewability).to.equal(0); }); - it('slot visibility should be 2 and ratio < 0.5 when ad unit is partially inside viewport', () => { + it('slot visibility should be 2 and ratio < 0.5 when ad unit is partially inside viewport', function () { let boundingRect = { top: 990, left: 990, @@ -627,7 +627,7 @@ describe('Media.net bid adapter', () => { expect(data.imp[0].ext.visibility).to.equal(2); expect(data.imp[0].ext.viewability).to.equal(100 / 75000); }); - it('slot visibility should be 1 and ratio > 0.5 when ad unit mostly in viewport', () => { + it('slot visibility should be 1 and ratio > 0.5 when ad unit mostly in viewport', function () { let boundingRect = { top: 800, left: 800, @@ -645,7 +645,7 @@ describe('Media.net bid adapter', () => { expect(data.imp[0].ext.visibility).to.equal(1); expect(data.imp[0].ext.viewability).to.equal(40000 / 75000); }); - it('co-ordinates should not be sent and slot visibility should be 0 when ad unit is not present', () => { + it('co-ordinates should not be sent and slot visibility should be 0 when ad unit is not present', function () { let bidReq = spec.buildRequests(VALID_BID_REQUEST, VALID_AUCTIONDATA); let data = JSON.parse(bidReq.data); expect(data.imp[1].ext).to.not.have.ownPropertyDescriptor('viewability'); @@ -653,37 +653,37 @@ describe('Media.net bid adapter', () => { }); }); - describe('getUserSyncs', () => { - it('should exclude iframe syncs if iframe is disabled', () => { + describe('getUserSyncs', function () { + it('should exclude iframe syncs if iframe is disabled', function () { let userSyncs = spec.getUserSyncs(SYNC_OPTIONS_PIXEL_ENABLED, SERVER_CSYNC_RESPONSE); expect(userSyncs).to.deep.equal(ENABLED_SYNC_PIXEL); }); - it('should exclude pixel syncs if pixel is disabled', () => { + it('should exclude pixel syncs if pixel is disabled', function () { let userSyncs = spec.getUserSyncs(SYNC_OPTIONS_IFRAME_ENABLED, SERVER_CSYNC_RESPONSE); expect(userSyncs).to.deep.equal(ENABLED_SYNC_IFRAME); }); - it('should choose iframe sync urls if both sync options are enabled', () => { + it('should choose iframe sync urls if both sync options are enabled', function () { let userSyncs = spec.getUserSyncs(SYNC_OPTIONS_BOTH_ENABLED, SERVER_CSYNC_RESPONSE); expect(userSyncs).to.deep.equal(ENABLED_SYNC_IFRAME); }); }); - describe('interpretResponse', () => { - it('should not push bid response if cpm missing', () => { + describe('interpretResponse', function () { + it('should not push bid response if cpm missing', function () { let validBids = []; let bids = spec.interpretResponse(SERVER_RESPONSE_CPM_MISSING, []); expect(bids).to.deep.equal(validBids); }); - it('should not push bid response if cpm 0', () => { + it('should not push bid response if cpm 0', function () { let validBids = []; let bids = spec.interpretResponse(SERVER_RESPONSE_CPM_ZERO, []); expect(bids).to.deep.equal(validBids); }); - it('should not push response if no-bid', () => { + it('should not push response if no-bid', function () { let validBids = []; let bids = spec.interpretResponse(SERVER_RESPONSE_NOBID, []); expect(bids).to.deep.equal(validBids); diff --git a/test/spec/modules/mobfoxBidAdapter_spec.js b/test/spec/modules/mobfoxBidAdapter_spec.js index 54a057991e3..90125f3e0d0 100644 --- a/test/spec/modules/mobfoxBidAdapter_spec.js +++ b/test/spec/modules/mobfoxBidAdapter_spec.js @@ -1,4 +1,4 @@ -describe('mobfox adapter tests', () => { +describe('mobfox adapter tests', function () { const expect = require('chai').expect; const utils = require('src/utils'); const adapter = require('modules/mobfoxBidAdapter'); @@ -18,7 +18,7 @@ describe('mobfox adapter tests', () => { transactionId: '31f42cba-5920-4e47-adad-69c79d0d4fb4' }]; - describe('validRequests', () => { + describe('validRequests', function () { let bidRequestInvalid1 = [{ code: 'div-gpt-ad-1460505748561-0', sizes: [[320, 480], [300, 250], [300, 600]], @@ -33,19 +33,19 @@ describe('mobfox adapter tests', () => { transactionId: '31f42cba-5920-4e47-adad-69c79d0d4fb4' }]; - it('test valid MF request success', () => { + it('test valid MF request success', function () { let isValid = adapter.spec.isBidRequestValid(bidRequest[0]); expect(isValid).to.equal(true); }); - it('test valid MF request failed1', () => { + it('test valid MF request failed1', function () { let isValid = adapter.spec.isBidRequestValid(bidRequestInvalid1[0]); expect(isValid).to.equal(false); }); }) - describe('buildRequests', () => { - it('test build MF request', () => { + describe('buildRequests', function () { + it('test build MF request', function () { let request = adapter.spec.buildRequests(bidRequest); let payload = request.data.split('&'); expect(payload[0]).to.equal('rt=api-fetchip'); @@ -57,7 +57,7 @@ describe('mobfox adapter tests', () => { expect(payload[7]).to.equal('imp_instl=1'); }); - it('test build MF request', () => { + it('test build MF request', function () { let request = adapter.spec.buildRequests(bidRequest); let payload = request.data.split('&'); expect(payload[0]).to.equal('rt=api-fetchip'); @@ -70,7 +70,7 @@ describe('mobfox adapter tests', () => { }); }) - describe('interceptResponse', () => { + describe('interceptResponse', function () { let mockServerResponse = { body: { request: { @@ -93,7 +93,7 @@ describe('mobfox adapter tests', () => { } } }; - it('test intercept response', () => { + it('test intercept response', function () { let request = adapter.spec.buildRequests(bidRequest); let bidResponses = adapter.spec.interpretResponse(mockServerResponse, request); expect(bidResponses.length).to.equal(1); @@ -109,7 +109,7 @@ describe('mobfox adapter tests', () => { expect(bidResponses[0].width).to.equal('320'); }); - it('test intercept response with empty server response', () => { + it('test intercept response with empty server response', function () { let request = adapter.spec.buildRequests(bidRequest); let serverResponse = { request: { diff --git a/test/spec/modules/my6senseBidAdapter_spec.js b/test/spec/modules/my6senseBidAdapter_spec.js index ec8389acbb3..80671305aca 100644 --- a/test/spec/modules/my6senseBidAdapter_spec.js +++ b/test/spec/modules/my6senseBidAdapter_spec.js @@ -1,9 +1,9 @@ import { expect } from 'chai'; import spec from 'modules/my6senseBidAdapter'; -describe('My6sense Bid adapter test', () => { +describe('My6sense Bid adapter test', function () { let bidRequests, serverResponses; - beforeEach(() => { + beforeEach(function () { bidRequests = [ { // valid 1 @@ -99,29 +99,29 @@ describe('My6sense Bid adapter test', () => { ] }); - describe('test if requestIsValid function', () => { - it('with valid data 1', () => { + describe('test if requestIsValid function', function () { + it('with valid data 1', function () { expect(spec.isBidRequestValid(bidRequests[0])).to.equal(true); }); - it('with invalid data 2', () => { + it('with invalid data 2', function () { expect(spec.isBidRequestValid(bidRequests[1])).to.equal(false); }); - it('with invalid data 3', () => { + it('with invalid data 3', function () { expect(spec.isBidRequestValid(bidRequests[2])).to.equal(false); }); - it('with invalid data 3', () => { + it('with invalid data 3', function () { expect(spec.isBidRequestValid(bidRequests[3])).to.equal(false); }); }); - describe('test if buildRequests function', () => { - it('normal', () => { + describe('test if buildRequests function', function () { + it('normal', function () { var requests = spec.buildRequests([bidRequests[0]]); expect(requests).to.be.lengthOf(1); }); }); - describe('test bid responses', () => { - it('success 1', () => { + describe('test bid responses', function () { + it('success 1', function () { var bids = spec.interpretResponse(serverResponses[0], {'bidRequest': bidRequests[0]}); expect(bids).to.be.lengthOf(1); expect(bids[0].cpm).to.equal(1.5); @@ -129,7 +129,7 @@ describe('My6sense Bid adapter test', () => { expect(bids[0].height).to.equal(250); expect(bids[0].adm).to.have.length.above(1); }); - it('success 2', () => { + it('success 2', function () { var bids = spec.interpretResponse(serverResponses[3]); expect(bids).to.be.lengthOf(1); expect(bids[0].cpm).to.equal(5); @@ -139,11 +139,11 @@ describe('My6sense Bid adapter test', () => { expect(bids[0].ttl).to.equal(360); expect(bids[0].currency).to.equal('USD'); }); - it('fail 1 (cpm=0)', () => { + it('fail 1 (cpm=0)', function () { var bids = spec.interpretResponse(serverResponses[1]); expect(bids).to.be.lengthOf(1); }); - it('fail 2 (no response)', () => { + it('fail 2 (no response)', function () { var bids = spec.interpretResponse([]); expect(bids).to.be.lengthOf(0); }); diff --git a/test/spec/modules/nanointeractiveBidAdapter_spec.js b/test/spec/modules/nanointeractiveBidAdapter_spec.js index 1aecb8ab06b..3731535b88a 100644 --- a/test/spec/modules/nanointeractiveBidAdapter_spec.js +++ b/test/spec/modules/nanointeractiveBidAdapter_spec.js @@ -64,10 +64,10 @@ describe('nanointeractive adapter tests', function () { }; } - describe('NanoAdapter', () => { + describe('NanoAdapter', function () { let nanoBidAdapter = spec; - describe('Methods', () => { + describe('Methods', function () { it('Test isBidRequestValid() with valid param(s): pid', function () { expect(nanoBidAdapter.isBidRequestValid(getBidRequest({ [DATA_PARTNER_PIXEL_ID]: DATA_PARTNER_PIXEL_ID_VALUE, diff --git a/test/spec/modules/nasmediaAdmixerBidAdapter_spec.js b/test/spec/modules/nasmediaAdmixerBidAdapter_spec.js index 7ed65718657..dd6ed4686d1 100644 --- a/test/spec/modules/nasmediaAdmixerBidAdapter_spec.js +++ b/test/spec/modules/nasmediaAdmixerBidAdapter_spec.js @@ -2,16 +2,16 @@ import {expect} from 'chai'; import {spec} from 'modules/nasmediaAdmixerBidAdapter'; import {newBidder} from 'src/adapters/bidderFactory'; -describe('nasmediaAdmixerBidAdapter', () => { +describe('nasmediaAdmixerBidAdapter', function () { const adapter = newBidder(spec); - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { const bid = { 'bidder': 'nasmediaAdmixer', 'params': { @@ -24,11 +24,11 @@ describe('nasmediaAdmixerBidAdapter', () => { 'auctionId': '124cb070528662', }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { const bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -38,7 +38,7 @@ describe('nasmediaAdmixerBidAdapter', () => { }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { const bidRequests = [ { 'bidder': 'nasmediaAdmixer', @@ -53,14 +53,14 @@ describe('nasmediaAdmixerBidAdapter', () => { } ]; - it('sends bid request to url via GET', () => { + it('sends bid request to url via GET', function () { const request = spec.buildRequests(bidRequests)[0]; expect(request.method).to.equal('GET'); expect(request.url).to.match(new RegExp(`https://adn.admixer.co.kr`)); }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { const response = { 'body': { 'bidder': 'nasmedia_admixer', @@ -94,7 +94,7 @@ describe('nasmediaAdmixerBidAdapter', () => { 'auctionId': '169827a33f03cc', }; - it('should get correct bid response', () => { + it('should get correct bid response', function () { const expectedResponse = [ { 'requestId': '861a8e7952c82c', @@ -122,7 +122,7 @@ describe('nasmediaAdmixerBidAdapter', () => { }); }); - it('handles nobid responses', () => { + it('handles nobid responses', function () { response.body = { 'bidder': 'nasmedia_admixer', 'req_id': '861a8e7952c82c', diff --git a/test/spec/modules/oneVideoBidAdapter_spec.js b/test/spec/modules/oneVideoBidAdapter_spec.js index 278b39fd079..f67105751df 100644 --- a/test/spec/modules/oneVideoBidAdapter_spec.js +++ b/test/spec/modules/oneVideoBidAdapter_spec.js @@ -3,12 +3,12 @@ import { spec } from 'modules/oneVideoBidAdapter'; import * as utils from 'src/utils'; import {config} from 'src/config'; -describe('OneVideoBidAdapter', () => { +describe('OneVideoBidAdapter', function () { let bidRequest; let bidderRequest; let mockConfig; - beforeEach(() => { + beforeEach(function () { bidRequest = { bidder: 'oneVideo', sizes: [640, 480], @@ -33,19 +33,19 @@ describe('OneVideoBidAdapter', () => { }; }); - describe('spec.isBidRequestValid', () => { - it('should return true when the required params are passed', () => { + describe('spec.isBidRequestValid', function () { + it('should return true when the required params are passed', function () { expect(spec.isBidRequestValid(bidRequest)).to.equal(true); }); - it('should return false when the "video" param is missing', () => { + it('should return false when the "video" param is missing', function () { bidRequest.params = { pubId: 'brxd' }; expect(spec.isBidRequestValid(bidRequest)).to.equal(false); }); - it('should return false when the "pubId" param is missing', () => { + it('should return false when the "pubId" param is missing', function () { bidRequest.params = { video: { playerWidth: 480, @@ -60,25 +60,25 @@ describe('OneVideoBidAdapter', () => { expect(spec.isBidRequestValid(bidRequest)).to.equal(false); }); - it('should return false when no bid params are passed', () => { + it('should return false when no bid params are passed', function () { bidRequest.params = {}; expect(spec.isBidRequestValid(bidRequest)).to.equal(false); }); }); - describe('spec.buildRequests', () => { - it('should create a POST request for every bid', () => { + describe('spec.buildRequests', function () { + it('should create a POST request for every bid', function () { const requests = spec.buildRequests([ bidRequest ]); expect(requests[0].method).to.equal('POST'); expect(requests[0].url).to.equal(location.protocol + spec.ENDPOINT + bidRequest.params.pubId); }); - it('should attach the bid request object', () => { + it('should attach the bid request object', function () { const requests = spec.buildRequests([ bidRequest ]); expect(requests[0].bidRequest).to.equal(bidRequest); }); - it('should attach request data', () => { + it('should attach request data', function () { const requests = spec.buildRequests([ bidRequest ]); const data = requests[0].data; const [ width, height ] = bidRequest.sizes; @@ -87,7 +87,7 @@ describe('OneVideoBidAdapter', () => { expect(data.imp[0].bidfloor).to.equal(bidRequest.params.bidfloor); }); - it('must parse bid size from a nested array', () => { + it('must parse bid size from a nested array', function () { const width = 640; const height = 480; bidRequest.sizes = [[ width, height ]]; @@ -98,25 +98,25 @@ describe('OneVideoBidAdapter', () => { }); }); - describe('spec.interpretResponse', () => { - it('should return no bids if the response is not valid', () => { + describe('spec.interpretResponse', function () { + it('should return no bids if the response is not valid', function () { const bidResponse = spec.interpretResponse({ body: null }, { bidRequest }); expect(bidResponse.length).to.equal(0); }); - it('should return no bids if the response "nurl" and "adm" are missing', () => { + it('should return no bids if the response "nurl" and "adm" are missing', function () { const serverResponse = {seatbid: [{bid: [{price: 6.01}]}]}; const bidResponse = spec.interpretResponse({ body: serverResponse }, { bidRequest }); expect(bidResponse.length).to.equal(0); }); - it('should return no bids if the response "price" is missing', () => { + it('should return no bids if the response "price" is missing', function () { const serverResponse = {seatbid: [{bid: [{adm: ''}]}]}; const bidResponse = spec.interpretResponse({ body: serverResponse }, { bidRequest }); expect(bidResponse.length).to.equal(0); }); - it('should return a valid bid response with just "adm"', () => { + it('should return a valid bid response with just "adm"', function () { const serverResponse = {seatbid: [{bid: [{id: 1, price: 6.01, adm: ''}]}], cur: 'USD'}; const bidResponse = spec.interpretResponse({ body: serverResponse }, { bidRequest }); let o = { diff --git a/test/spec/modules/oneplanetonlyBidAdapter_spec.js b/test/spec/modules/oneplanetonlyBidAdapter_spec.js index 4a42b471b6f..fbcec66ef51 100644 --- a/test/spec/modules/oneplanetonlyBidAdapter_spec.js +++ b/test/spec/modules/oneplanetonlyBidAdapter_spec.js @@ -1,7 +1,7 @@ import {expect} from 'chai'; import {spec} from '../../../modules/oneplanetonlyBidAdapter'; -describe('OnePlanetOnlyAdapter', () => { +describe('OnePlanetOnlyAdapter', function () { let bid = { bidId: '51ef8751f9aead', bidder: 'oneplanetonly', @@ -16,31 +16,31 @@ describe('OnePlanetOnlyAdapter', () => { auctionId: '18fd8b8b0bd757' }; - describe('isBidRequestValid', () => { - it('Should return true if there are params.siteId and params.adUnitId parameters present', () => { + describe('isBidRequestValid', function () { + it('Should return true if there are params.siteId and params.adUnitId parameters present', function () { expect(spec.isBidRequestValid(bid)).to.be.true; }); - it('Should return false if at least one of parameters is not present', () => { + it('Should return false if at least one of parameters is not present', function () { delete bid.params.adUnitId; expect(spec.isBidRequestValid(bid)).to.be.false; }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let serverRequest = spec.buildRequests([bid]); - it('Creates a ServerRequest object with method, URL and data', () => { + it('Creates a ServerRequest object with method, URL and data', function () { expect(serverRequest).to.exist; expect(serverRequest.method).to.exist; expect(serverRequest.url).to.exist; expect(serverRequest.data).to.exist; }); - it('Returns POST method', () => { + it('Returns POST method', function () { expect(serverRequest.method).to.equal('POST'); }); - it('Returns valid URL', () => { + it('Returns valid URL', function () { expect(serverRequest.url).to.equal('//show.oneplanetonly.com/prebid?siteId=5'); }); - it('Returns valid data if array of bids is valid', () => { + it('Returns valid data if array of bids is valid', function () { let data = serverRequest.data; expect(data).to.be.an('object'); expect(data).to.have.all.keys('id', 'ver', 'prebidVer', 'transactionId', 'currency', 'timeout', 'siteId', @@ -52,14 +52,14 @@ describe('OnePlanetOnlyAdapter', () => { expect(adUnit.bidId).to.equal('51ef8751f9aead'); expect(adUnit.sizes).to.have.members(['300x250', '300x600']); }); - it('Returns empty data if no valid requests are passed', () => { + it('Returns empty data if no valid requests are passed', function () { serverRequest = spec.buildRequests([]); let data = serverRequest.data; expect(data.adUnits).to.be.an('array').that.is.empty; }); }); - describe('interpretResponse', () => { - it('Should interpret banner response', () => { + describe('interpretResponse', function () { + it('Should interpret banner response', function () { const serverResponse = { body: { bids: [{ @@ -89,7 +89,7 @@ describe('OnePlanetOnlyAdapter', () => { expect(bidObject.netRevenue).to.be.true; expect(bidObject.currency).to.equal('USD'); }); - it('Should return an empty array if invalid response is passed', () => { + it('Should return an empty array if invalid response is passed', function () { const invalid = { body: {} }; diff --git a/test/spec/modules/onetagBidAdapter_spec.js b/test/spec/modules/onetagBidAdapter_spec.js index 85597a0c6c6..d56ad9e6dc5 100644 --- a/test/spec/modules/onetagBidAdapter_spec.js +++ b/test/spec/modules/onetagBidAdapter_spec.js @@ -1,7 +1,7 @@ import { spec } from 'modules/onetagBidAdapter'; import { expect } from 'chai'; -describe('onetag', () => { +describe('onetag', function () { let bid = { 'bidder': 'onetag', 'params': { @@ -15,43 +15,43 @@ describe('onetag', () => { 'transactionId': 'qwerty123' }; - describe('isBidRequestValid', () => { - it('Should return true when required params are found', () => { + describe('isBidRequestValid', function () { + it('Should return true when required params are found', function () { expect(spec.isBidRequestValid(bid)).to.be.true; }); - it('Should return false when pubId is not a string', () => { + it('Should return false when pubId is not a string', function () { bid.params.pubId = 30; expect(spec.isBidRequestValid(bid)).to.be.false; }); - it('Should return false when pubId is undefined', () => { + it('Should return false when pubId is undefined', function () { bid.params.pubId = undefined; expect(spec.isBidRequestValid(bid)).to.be.false; }); - it('Should return false when the sizes array is empty', () => { + it('Should return false when the sizes array is empty', function () { bid.sizes = []; expect(spec.isBidRequestValid(bid)).to.be.false; }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let serverRequest = spec.buildRequests([bid]); - it('Creates a ServerRequest object with method, URL and data', () => { + it('Creates a ServerRequest object with method, URL and data', function () { expect(serverRequest).to.exist; expect(serverRequest.method).to.exist; expect(serverRequest.url).to.exist; expect(serverRequest.data).to.exist; }); - it('Returns POST method', () => { + it('Returns POST method', function () { expect(serverRequest.method).to.equal('POST'); }); - it('Returns valid URL', () => { + it('Returns valid URL', function () { expect(serverRequest.url).to.equal('https://onetag-sys.com/prebid-request'); }); const d = serverRequest.data; try { const data = JSON.parse(d); - it('Should contains all keys', () => { + it('Should contains all keys', function () { expect(data).to.be.an('object'); expect(data).to.have.all.keys('location', 'masked', 'referrer', 'sHeight', 'sWidth', 'timeOffset', 'date', 'wHeight', 'wWidth', 'bids'); expect(data.location).to.be.a('string'); @@ -76,7 +76,7 @@ describe('onetag', () => { } catch (e) { console.log('Error while parsing'); } - it('Returns empty data if no valid requests are passed', () => { + it('Returns empty data if no valid requests are passed', function () { serverRequest = spec.buildRequests([]); let dataString = serverRequest.data; try { @@ -86,7 +86,7 @@ describe('onetag', () => { console.log('Error while parsing'); } }); - it('should send GDPR consent data', () => { + it('should send GDPR consent data', function () { let consentString = 'consentString'; let bidderRequest = { 'bidderCode': 'onetag', @@ -107,7 +107,7 @@ describe('onetag', () => { expect(payload.gdprConsent.consentRequired).to.exist.and.to.be.true; }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { const resObject = { body: { nobid: false, @@ -123,7 +123,7 @@ describe('onetag', () => { }] } }; - it('Returns an array of valid server responses if response object is valid', () => { + it('Returns an array of valid server responses if response object is valid', function () { const serverResponses = spec.interpretResponse(resObject); expect(serverResponses).to.be.an('array').that.is.not.empty; @@ -140,7 +140,7 @@ describe('onetag', () => { expect(dataItem.netRevenue).to.be.a('boolean'); expect(dataItem.currency).to.be.a('string'); } - it('Returns an empty array if invalid response is passed', () => { + it('Returns an empty array if invalid response is passed', function () { const serverResponses = spec.interpretResponse('invalid_response'); expect(serverResponses).to.be.an('array').that.is.empty; }); diff --git a/test/spec/modules/openxBidAdapter_spec.js b/test/spec/modules/openxBidAdapter_spec.js index 324f9d80ae4..bce6b2e4acf 100644 --- a/test/spec/modules/openxBidAdapter_spec.js +++ b/test/spec/modules/openxBidAdapter_spec.js @@ -8,7 +8,7 @@ import * as utils from 'src/utils'; const URLBASE = '/w/1.0/arj'; const URLBASEVIDEO = '/v/1.0/avjp'; -describe('OpenxAdapter', () => { +describe('OpenxAdapter', function () { const adapter = newBidder(spec); /** @@ -121,16 +121,16 @@ describe('OpenxAdapter', () => { } }; - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { - describe('when request is for a banner ad', () => { + describe('isBidRequestValid', function () { + describe('when request is for a banner ad', function () { let bannerBid; - beforeEach(() => { + beforeEach(function () { bannerBid = { bidder: 'openx', params: {}, @@ -143,35 +143,35 @@ describe('OpenxAdapter', () => { }; }); - it('should return false when there is no delivery domain', () => { + it('should return false when there is no delivery domain', function () { bannerBid.params = {'unit': '12345678'}; expect(spec.isBidRequestValid(bannerBid)).to.equal(false); }); - describe('when there is a delivery domain', () => { + describe('when there is a delivery domain', function () { beforeEach(function () { bannerBid.params = {delDomain: 'test-delivery-domain'} }); - it('should return false when there is no ad unit id and size', () => { + it('should return false when there is no ad unit id and size', function () { expect(spec.isBidRequestValid(bannerBid)).to.equal(false); }); - it('should return true if there is an adunit id ', () => { + it('should return true if there is an adunit id ', function () { bannerBid.params.unit = '12345678'; expect(spec.isBidRequestValid(bannerBid)).to.equal(true); }); - it('should return true if there is no adunit id and sizes are defined', () => { + it('should return true if there is no adunit id and sizes are defined', function () { bannerBid.mediaTypes.banner.sizes = [720, 90]; expect(spec.isBidRequestValid(bannerBid)).to.equal(true); }); - it('should return false if no sizes are defined ', () => { + it('should return false if no sizes are defined ', function () { expect(spec.isBidRequestValid(bannerBid)).to.equal(false); }); - it('should return false if sizes empty ', () => { + it('should return false if sizes empty ', function () { bannerBid.mediaTypes.banner.sizes = []; expect(spec.isBidRequestValid(bannerBid)).to.equal(false); }); @@ -211,21 +211,21 @@ describe('OpenxAdapter', () => { 'auctionId': '1d1a030790a475', 'transactionId': '4008d88a-8137-410b-aa35-fbfdabcb478e' }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(videoBidWithMediaTypes)).to.equal(true); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let videoBidWithMediaTypes = Object.assign({}, videoBidWithMediaTypes); videoBidWithMediaTypes.params = {}; expect(spec.isBidRequestValid(videoBidWithMediaTypes)).to.equal(false); }); - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(videoBidWithMediaType)).to.equal(true); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let videoBidWithMediaType = Object.assign({}, videoBidWithMediaType); delete videoBidWithMediaType.params; videoBidWithMediaType.params = {}; @@ -234,7 +234,7 @@ describe('OpenxAdapter', () => { }); }); - describe('buildRequests for banner ads', () => { + describe('buildRequests for banner ads', function () { const bidRequestsWithMediaType = [{ 'bidder': 'openx', 'params': { @@ -280,24 +280,24 @@ describe('OpenxAdapter', () => { 'auctionId': 'test-auction-2' }]; - it('should send bid request to openx url via GET, with mediaType specified as banner', () => { + it('should send bid request to openx url via GET, with mediaType specified as banner', function () { const request = spec.buildRequests(bidRequestsWithMediaType); expect(request[0].url).to.equal('//' + bidRequestsWithMediaType[0].params.delDomain + URLBASE); expect(request[0].method).to.equal('GET'); }); - it('should send bid request to openx url via GET, with mediaTypes specified with banner type', () => { + it('should send bid request to openx url via GET, with mediaTypes specified with banner type', function () { const request = spec.buildRequests(bidRequestsWithMediaTypes); expect(request[0].url).to.equal('//' + bidRequestsWithMediaTypes[0].params.delDomain + URLBASE); expect(request[0].method).to.equal('GET'); }); - it('should send the adunit codes', () => { + it('should send the adunit codes', function () { const request = spec.buildRequests(bidRequestsWithMediaTypes); expect(request[0].data.divIds).to.equal(`${encodeURIComponent(bidRequestsWithMediaTypes[0].adUnitCode)},${encodeURIComponent(bidRequestsWithMediaTypes[1].adUnitCode)}`); }); - it('should send ad unit ids when any are defined', () => { + it('should send ad unit ids when any are defined', function () { const bidRequestsWithUnitIds = [{ 'bidder': 'openx', 'params': { @@ -332,7 +332,7 @@ describe('OpenxAdapter', () => { expect(request[0].data.auid).to.equal(`,${bidRequestsWithUnitIds[1].params.unit}`); }); - it('should not send any ad unit ids when none are defined', () => { + it('should not send any ad unit ids when none are defined', function () { const bidRequestsWithoutUnitIds = [{ 'bidder': 'openx', 'params': { @@ -386,7 +386,7 @@ describe('OpenxAdapter', () => { requestData = spec.buildRequests(deprecatedBidRequestsFormatWithNoMediaType)[0].data; }); - it('should have an ad unit id', () => { + it('should have an ad unit id', function () { expect(requestData.auid).to.equal('12345678'); }); @@ -395,7 +395,7 @@ describe('OpenxAdapter', () => { }); }); - it('should send out custom params on bids that have customParams specified', () => { + it('should send out custom params on bids that have customParams specified', function () { const bidRequest = Object.assign({}, bidRequestsWithMediaTypes[0], { @@ -414,7 +414,7 @@ describe('OpenxAdapter', () => { expect(dataParams.tps).to.equal(btoa('test1=testval1.&test2=testval2_,testval3')); }); - it('should send out custom floors on bids that have customFloors specified', () => { + it('should send out custom floors on bids that have customFloors specified', function () { const bidRequest = Object.assign({}, bidRequestsWithMediaTypes[0], { @@ -433,7 +433,7 @@ describe('OpenxAdapter', () => { expect(dataParams.aumfs).to.equal('1500'); }); - it('should send out custom bc parameter, if override is present', () => { + it('should send out custom bc parameter, if override is present', function () { const bidRequest = Object.assign({}, bidRequestsWithMediaTypes[0], { @@ -459,13 +459,13 @@ describe('OpenxAdapter', () => { expect(request[0].data.x_gdpr_f).to.equal(undefined); }); - describe('when there is a consent management framework', () => { + describe('when there is a consent management framework', function () { let bidRequests; let mockConfig; let bidderRequest; const IAB_CONSENT_FRAMEWORK_CODE = 1; - beforeEach(() => { + beforeEach(function () { bidRequests = [{ bidder: 'openx', params: { @@ -632,7 +632,7 @@ describe('OpenxAdapter', () => { }); }); - it('should not send a coppa query param when there are no coppa param settings in the bid requests', () => { + it('should not send a coppa query param when there are no coppa param settings in the bid requests', function () { const bidRequestsWithoutCoppa = [{ bidder: 'openx', params: { @@ -669,7 +669,7 @@ describe('OpenxAdapter', () => { expect(request[0].data).to.not.have.any.keys('tfcd'); }); - it('should send a coppa flag there is when there is coppa param settings in the bid requests', () => { + it('should send a coppa flag there is when there is coppa param settings in the bid requests', function () { const bidRequestsWithCoppa = [{ bidder: 'openx', params: { @@ -707,7 +707,7 @@ describe('OpenxAdapter', () => { expect(request[0].data.tfcd).to.equal(1); }); - it('should not send a "no segmentation" flag there no DoNotTrack setting that is set to true', () => { + it('should not send a "no segmentation" flag there no DoNotTrack setting that is set to true', function () { const bidRequestsWithoutDnt = [{ bidder: 'openx', params: { @@ -744,7 +744,7 @@ describe('OpenxAdapter', () => { expect(request[0].data).to.not.have.any.keys('ns'); }); - it('should send a "no segmentation" flag there is any DoNotTrack setting that is set to true', () => { + it('should send a "no segmentation" flag there is any DoNotTrack setting that is set to true', function () { const bidRequestsWithDnt = [{ bidder: 'openx', params: { @@ -783,7 +783,7 @@ describe('OpenxAdapter', () => { }); }); - describe('buildRequests for video', () => { + describe('buildRequests for video', function () { const bidRequestsWithMediaTypes = [{ 'bidder': 'openx', 'mediaTypes': { @@ -818,19 +818,19 @@ describe('OpenxAdapter', () => { 'transactionId': '4008d88a-8137-410b-aa35-fbfdabcb478e' }]; - it('should send bid request to openx url via GET, with mediaType as video', () => { + it('should send bid request to openx url via GET, with mediaType as video', function () { const request = spec.buildRequests(bidRequestsWithMediaType); expect(request[0].url).to.equal('//' + bidRequestsWithMediaType[0].params.delDomain + URLBASEVIDEO); expect(request[0].method).to.equal('GET'); }); - it('should send bid request to openx url via GET, with mediaTypes having video parameter', () => { + it('should send bid request to openx url via GET, with mediaTypes having video parameter', function () { const request = spec.buildRequests(bidRequestsWithMediaTypes); expect(request[0].url).to.equal('//' + bidRequestsWithMediaTypes[0].params.delDomain + URLBASEVIDEO); expect(request[0].method).to.equal('GET'); }); - it('should have the correct parameters', () => { + it('should have the correct parameters', function () { const request = spec.buildRequests(bidRequestsWithMediaTypes); const dataParams = request[0].data; @@ -839,7 +839,7 @@ describe('OpenxAdapter', () => { expect(dataParams.vwd).to.equal(640); }); - it('should send a bc parameter', () => { + it('should send a bc parameter', function () { const request = spec.buildRequests(bidRequestsWithMediaTypes); const dataParams = request[0].data; @@ -933,8 +933,8 @@ describe('OpenxAdapter', () => { }); }); - describe('interpretResponse for banner ads', () => { - beforeEach(() => { + describe('interpretResponse for banner ads', function () { + beforeEach(function () { sinon.spy(userSync, 'registerSync'); }); @@ -1030,7 +1030,7 @@ describe('OpenxAdapter', () => { expect(bid.ts).to.equal(adUnitOverride.ts); }); - it('should register a beacon', () => { + it('should register a beacon', function () { resetBoPixel(); spec.interpretResponse({body: bidResponse}, bidRequest); sinon.assert.calledWith(userSync.registerSync, 'image', 'openx', sinon.match(new RegExp(`\/\/openx-d\.openx\.net.*\/bo\?.*ts=${adUnitOverride.ts}`))); @@ -1107,7 +1107,7 @@ describe('OpenxAdapter', () => { }; }); - it('handles nobid responses', () => { + it('handles nobid responses', function () { const bidResponse = { 'ads': { @@ -1215,8 +1215,8 @@ describe('OpenxAdapter', () => { }); }); - describe('interpretResponse for video ads', () => { - beforeEach(() => { + describe('interpretResponse for video ads', function () { + beforeEach(function () { sinon.spy(userSync, 'registerSync'); }); @@ -1273,7 +1273,7 @@ describe('OpenxAdapter', () => { 'pixels': 'http://testpixels.net' }; - it('should return correct bid response with MediaTypes', () => { + it('should return correct bid response with MediaTypes', function () { const expectedResponse = [ { 'requestId': '30b31c1838de1e', @@ -1294,7 +1294,7 @@ describe('OpenxAdapter', () => { expect(JSON.stringify(Object.keys(result[0]).sort())).to.eql(JSON.stringify(Object.keys(expectedResponse[0]).sort())); }); - it('should return correct bid response with MediaType', () => { + it('should return correct bid response with MediaType', function () { const expectedResponse = [ { 'requestId': '30b31c1838de1e', @@ -1315,19 +1315,19 @@ describe('OpenxAdapter', () => { expect(JSON.stringify(Object.keys(result[0]).sort())).to.eql(JSON.stringify(Object.keys(expectedResponse[0]).sort())); }); - it('should handle nobid responses for bidRequests with MediaTypes', () => { + it('should handle nobid responses for bidRequests with MediaTypes', function () { const bidResponse = {'vastUrl': '', 'pub_rev': '', 'width': '', 'height': '', 'adid': '', 'pixels': ''}; const result = spec.interpretResponse({body: bidResponse}, bidRequestsWithMediaTypes); expect(result.length).to.equal(0); }); - it('should handle nobid responses for bidRequests with MediaType', () => { + it('should handle nobid responses for bidRequests with MediaType', function () { const bidResponse = {'vastUrl': '', 'pub_rev': '', 'width': '', 'height': '', 'adid': '', 'pixels': ''}; const result = spec.interpretResponse({body: bidResponse}, bidRequestsWithMediaType); expect(result.length).to.equal(0); }); - it('should register a beacon', () => { + it('should register a beacon', function () { resetBoPixel(); spec.interpretResponse({body: bidResponse}, bidRequestsWithMediaTypes); sinon.assert.calledWith(userSync.registerSync, 'image', 'openx', sinon.match(/^\/\/test-colo\.com/)) @@ -1336,10 +1336,10 @@ describe('OpenxAdapter', () => { }); }); - describe('user sync', () => { + describe('user sync', function () { const syncUrl = 'http://testpixels.net'; - it('should register the pixel iframe from banner ad response', () => { + it('should register the pixel iframe from banner ad response', function () { let syncs = spec.getUserSyncs( {iframeEnabled: true}, [{body: {ads: {pixels: syncUrl}}}] @@ -1347,7 +1347,7 @@ describe('OpenxAdapter', () => { expect(syncs).to.deep.equal([{type: 'iframe', url: syncUrl}]); }); - it('should register the pixel iframe from video ad response', () => { + it('should register the pixel iframe from video ad response', function () { let syncs = spec.getUserSyncs( {iframeEnabled: true}, [{body: {pixels: syncUrl}}] @@ -1355,7 +1355,7 @@ describe('OpenxAdapter', () => { expect(syncs).to.deep.equal([{type: 'iframe', url: syncUrl}]); }); - it('should register the default iframe if no pixels available', () => { + it('should register the default iframe if no pixels available', function () { let syncs = spec.getUserSyncs( {iframeEnabled: true}, [] diff --git a/test/spec/modules/optimaticBidAdapter_spec.js b/test/spec/modules/optimaticBidAdapter_spec.js index d701d981f37..3dd7ca79cc7 100644 --- a/test/spec/modules/optimaticBidAdapter_spec.js +++ b/test/spec/modules/optimaticBidAdapter_spec.js @@ -2,10 +2,10 @@ import { expect } from 'chai'; import { spec, ENDPOINT } from 'modules/optimaticBidAdapter'; import * as utils from 'src/utils'; -describe('OptimaticBidAdapter', () => { +describe('OptimaticBidAdapter', function () { let bidRequest; - beforeEach(() => { + beforeEach(function () { bidRequest = { bidder: 'optimatic', params: { @@ -20,49 +20,49 @@ describe('OptimaticBidAdapter', () => { }; }); - describe('spec.isBidRequestValid', () => { - it('should return true when the required params are passed', () => { + describe('spec.isBidRequestValid', function () { + it('should return true when the required params are passed', function () { expect(spec.isBidRequestValid(bidRequest)).to.equal(true); }); - it('should return false when the "bidfloor" param is missing', () => { + it('should return false when the "bidfloor" param is missing', function () { bidRequest.params = { placement: '2chy7Gc2eSQL' }; expect(spec.isBidRequestValid(bidRequest)).to.equal(false); }); - it('should return false when the "placement" param is missing', () => { + it('should return false when the "placement" param is missing', function () { bidRequest.params = { bidfloor: 5.00 }; expect(spec.isBidRequestValid(bidRequest)).to.equal(false); }); - it('should return false when no bid params are passed', () => { + it('should return false when no bid params are passed', function () { bidRequest.params = {}; expect(spec.isBidRequestValid(bidRequest)).to.equal(false); }); - it('should return false when a bid request is not passed', () => { + it('should return false when a bid request is not passed', function () { expect(spec.isBidRequestValid()).to.equal(false); expect(spec.isBidRequestValid({})).to.equal(false); }); }); - describe('spec.buildRequests', () => { - it('should create a POST request for every bid', () => { + describe('spec.buildRequests', function () { + it('should create a POST request for every bid', function () { const requests = spec.buildRequests([ bidRequest ]); expect(requests[0].method).to.equal('POST'); expect(requests[0].url).to.equal(ENDPOINT + bidRequest.params.placement); }); - it('should attach the bid request object', () => { + it('should attach the bid request object', function () { const requests = spec.buildRequests([ bidRequest ]); expect(requests[0].bidRequest).to.equal(bidRequest); }); - it('should attach request data', () => { + it('should attach request data', function () { const requests = spec.buildRequests([ bidRequest ]); const data = requests[0].data; const [ width, height ] = bidRequest.sizes; @@ -71,7 +71,7 @@ describe('OptimaticBidAdapter', () => { expect(data.imp[0].bidfloor).to.equal(bidRequest.params.bidfloor); }); - it('must parse bid size from a nested array', () => { + it('must parse bid size from a nested array', function () { const width = 640; const height = 480; bidRequest.sizes = [[ width, height ]]; @@ -81,7 +81,7 @@ describe('OptimaticBidAdapter', () => { expect(data.imp[0].video.h).to.equal(height); }); - it('must parse bid size from a string', () => { + it('must parse bid size from a string', function () { const width = 640; const height = 480; bidRequest.sizes = `${width}x${height}`; @@ -91,7 +91,7 @@ describe('OptimaticBidAdapter', () => { expect(data.imp[0].video.h).to.equal(height); }); - it('must handle an empty bid size', () => { + it('must handle an empty bid size', function () { bidRequest.sizes = []; const requests = spec.buildRequests([ bidRequest ]); const data = requests[0].data; @@ -100,25 +100,25 @@ describe('OptimaticBidAdapter', () => { }); }); - describe('spec.interpretResponse', () => { - it('should return no bids if the response is not valid', () => { + describe('spec.interpretResponse', function () { + it('should return no bids if the response is not valid', function () { const bidResponse = spec.interpretResponse({ body: null }, { bidRequest }); expect(bidResponse.length).to.equal(0); }); - it('should return no bids if the response "nurl" and "adm" are missing', () => { + it('should return no bids if the response "nurl" and "adm" are missing', function () { const serverResponse = {seatbid: [{bid: [{price: 5.01}]}]}; const bidResponse = spec.interpretResponse({ body: serverResponse }, { bidRequest }); expect(bidResponse.length).to.equal(0); }); - it('should return no bids if the response "price" is missing', () => { + it('should return no bids if the response "price" is missing', function () { const serverResponse = {seatbid: [{bid: [{adm: ''}]}]}; const bidResponse = spec.interpretResponse({ body: serverResponse }, { bidRequest }); expect(bidResponse.length).to.equal(0); }); - it('should return a valid bid response with just "adm"', () => { + it('should return a valid bid response with just "adm"', function () { const serverResponse = {seatbid: [{bid: [{id: 1, price: 5.01, adm: ''}]}], cur: 'USD'}; const bidResponse = spec.interpretResponse({ body: serverResponse }, { bidRequest }); let o = { @@ -137,7 +137,7 @@ describe('OptimaticBidAdapter', () => { expect(bidResponse).to.deep.equal(o); }); - it('should return a valid bid response with just "nurl"', () => { + it('should return a valid bid response with just "nurl"', function () { const serverResponse = {seatbid: [{bid: [{id: 1, price: 5.01, nurl: 'https://mg-bid-win.optimatic.com/win/134eb262-948a-463e-ad93-bc8b622d399c?wp=${AUCTION_PRICE}'}]}], cur: 'USD'}; const bidResponse = spec.interpretResponse({ body: serverResponse }, { bidRequest }); let o = { @@ -156,7 +156,7 @@ describe('OptimaticBidAdapter', () => { expect(bidResponse).to.deep.equal(o); }); - it('should return a valid bid response with "nurl" when both nurl and adm exist', () => { + it('should return a valid bid response with "nurl" when both nurl and adm exist', function () { const serverResponse = {seatbid: [{bid: [{id: 1, price: 5.01, adm: '', nurl: 'https://mg-bid-win.optimatic.com/win/134eb262-948a-463e-ad93-bc8b622d399c?wp=${AUCTION_PRICE}'}]}], cur: 'USD'}; const bidResponse = spec.interpretResponse({ body: serverResponse }, { bidRequest }); let o = { diff --git a/test/spec/modules/optimeraBidAdapter_spec.js b/test/spec/modules/optimeraBidAdapter_spec.js index 413a52d2d7f..ff5793b5040 100644 --- a/test/spec/modules/optimeraBidAdapter_spec.js +++ b/test/spec/modules/optimeraBidAdapter_spec.js @@ -2,16 +2,16 @@ import { expect } from 'chai'; import { spec } from 'modules/optimeraBidAdapter'; import { newBidder } from 'src/adapters/bidderFactory'; -describe('OptimeraAdapter', () => { +describe('OptimeraAdapter', function () { const adapter = newBidder(spec); - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }) - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { 'bidder': 'optimera', 'params': { @@ -24,12 +24,12 @@ describe('OptimeraAdapter', () => { 'auctionId': '1d1a030790a475', }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); }); }) - describe('buildRequests', () => { + describe('buildRequests', function () { let bid = [ { 'adUnitCode': 'div-0', @@ -42,7 +42,7 @@ describe('OptimeraAdapter', () => { } } ]; - it('buildRequests fires', () => { + it('buildRequests fires', function () { let request = spec.buildRequests(bid); expect(request).to.exist; expect(request.method).to.equal('GET'); @@ -51,7 +51,7 @@ describe('OptimeraAdapter', () => { }); }) - describe('interpretResponse', () => { + describe('interpretResponse', function () { let serverResponse = {}; serverResponse.body = JSON.parse('{"div-0":["RB_K","728x90K"], "timestamp":["RB_K","1507565666"]}'); var bidRequest = { @@ -67,7 +67,7 @@ describe('OptimeraAdapter', () => { } ] } - it('interpresResponse fires', () => { + it('interpresResponse fires', function () { let bidResponses = spec.interpretResponse(serverResponse, bidRequest); expect(bidResponses[0].dealId[0]).to.equal('RB_K'); expect(bidResponses[0].dealId[1]).to.equal('728x90K'); diff --git a/test/spec/modules/orbitsoftBidAdapter_spec.js b/test/spec/modules/orbitsoftBidAdapter_spec.js index 50145a1e72e..18ba9a6e8f3 100644 --- a/test/spec/modules/orbitsoftBidAdapter_spec.js +++ b/test/spec/modules/orbitsoftBidAdapter_spec.js @@ -2,10 +2,10 @@ import {expect} from 'chai'; import {spec} from 'modules/orbitsoftBidAdapter'; const ENDPOINT_URL = 'https://orbitsoft.com/php/ads/hb.phps'; -describe('Orbitsoft adapter', () => { - describe('implementation', () => { - describe('for requests', () => { - it('should accept valid bid', () => { +describe('Orbitsoft adapter', function () { + describe('implementation', function () { + describe('for requests', function () { + it('should accept valid bid', function () { let validBid = { bidder: 'orbitsoft', params: { @@ -18,7 +18,7 @@ describe('Orbitsoft adapter', () => { expect(isValid).to.equal(true); }); - it('should reject invalid bid', () => { + it('should reject invalid bid', function () { let invalidBid = { bidder: 'orbitsoft' }, @@ -27,8 +27,8 @@ describe('Orbitsoft adapter', () => { expect(isValid).to.equal(false); }); }); - describe('for requests', () => { - it('should accept valid bid with styles', () => { + describe('for requests', function () { + it('should accept valid bid with styles', function () { let validBid = { bidder: 'orbitsoft', params: { @@ -91,7 +91,7 @@ describe('Orbitsoft adapter', () => { expect(requestUrlParams).have.property('c6', '5B99FE'); }); - it('should accept valid bid with custom params', () => { + it('should accept valid bid with custom params', function () { let validBid = { bidder: 'orbitsoft', params: { @@ -112,7 +112,7 @@ describe('Orbitsoft adapter', () => { expect(requestUrlCustomParams).have.property('c.clickUrl', 'http://testclickurl.com'); }); - it('should reject invalid bid without requestUrl', () => { + it('should reject invalid bid without requestUrl', function () { let invalidBid = { bidder: 'orbitsoft', params: { @@ -124,7 +124,7 @@ describe('Orbitsoft adapter', () => { expect(isValid).to.equal(false); }); - it('should reject invalid bid without placementId', () => { + it('should reject invalid bid without placementId', function () { let invalidBid = { bidder: 'orbitsoft', params: { @@ -136,8 +136,8 @@ describe('Orbitsoft adapter', () => { expect(isValid).to.equal(false); }); }); - describe('bid responses', () => { - it('should return complete bid response', () => { + describe('bid responses', function () { + it('should return complete bid response', function () { let serverResponse = { body: { callback_uid: '265b29b70cc106', @@ -168,7 +168,7 @@ describe('Orbitsoft adapter', () => { expect(bids[0].adUrl).to.have.string('https://orbitsoft.com/php/ads/hb.html'); }); - it('should return empty bid response', () => { + it('should return empty bid response', function () { let bidRequests = [ { bidder: 'orbitsoft', @@ -189,7 +189,7 @@ describe('Orbitsoft adapter', () => { expect(bids).to.be.lengthOf(0); }); - it('should return empty bid response on incorrect size', () => { + it('should return empty bid response on incorrect size', function () { let bidRequests = [ { bidder: 'orbitsoft', @@ -212,7 +212,7 @@ describe('Orbitsoft adapter', () => { expect(bids).to.be.lengthOf(0); }); - it('should return empty bid response with error', () => { + it('should return empty bid response with error', function () { let bidRequests = [ { bidder: 'orbitsoft', @@ -228,7 +228,7 @@ describe('Orbitsoft adapter', () => { expect(bids).to.be.lengthOf(0); }); - it('should return empty bid response on empty body', () => { + it('should return empty bid response on empty body', function () { let bidRequests = [ { bidder: 'orbitsoft', diff --git a/test/spec/modules/papyrusBidAdapter_spec.js b/test/spec/modules/papyrusBidAdapter_spec.js index a61a1c55269..289da56379a 100644 --- a/test/spec/modules/papyrusBidAdapter_spec.js +++ b/test/spec/modules/papyrusBidAdapter_spec.js @@ -4,8 +4,8 @@ import { spec } from 'modules/papyrusBidAdapter'; const ENDPOINT = '//prebid.papyrus.global'; const BIDDER_CODE = 'papyrus'; -describe('papyrus Adapter', () => { - describe('isBidRequestValid', () => { +describe('papyrus Adapter', function () { + describe('isBidRequestValid', function () { let validBidReq = { bidder: BIDDER_CODE, params: { @@ -14,7 +14,7 @@ describe('papyrus Adapter', () => { } }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(validBidReq)).to.equal(true); }); @@ -25,12 +25,12 @@ describe('papyrus Adapter', () => { } }; - it('should not validate incorrect bid request', () => { + it('should not validate incorrect bid request', function () { expect(spec.isBidRequestValid(invalidBidReq)).to.equal(false); }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let bidRequests = [ { bidder: BIDDER_CODE, @@ -46,29 +46,29 @@ describe('papyrus Adapter', () => { } ]; - it('sends bid request to ENDPOINT via POST', () => { + it('sends bid request to ENDPOINT via POST', function () { const request = spec.buildRequests(bidRequests); expect(request.url).to.equal(ENDPOINT); expect(request.method).to.equal('POST'); }); - it('sends valid bids count', () => { + it('sends valid bids count', function () { const request = spec.buildRequests(bidRequests); expect(request.data.length).to.equal(1); }); - it('sends all bid parameters', () => { + it('sends all bid parameters', function () { const request = spec.buildRequests(bidRequests); expect(request.data[0]).to.have.all.keys(['address', 'placementId', 'sizes', 'bidId', 'transactionId']); }); - it('sedns valid sizes parameter', () => { + it('sedns valid sizes parameter', function () { const request = spec.buildRequests(bidRequests); expect(request.data[0].sizes[0]).to.equal('300x250'); }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { let bidRequests = [ { bidder: BIDDER_CODE, @@ -96,13 +96,13 @@ describe('papyrus Adapter', () => { ] }; - it('should build bid array', () => { + it('should build bid array', function () { const request = spec.buildRequests(bidRequests); const result = spec.interpretResponse({body: bidResponse}, request[0]); expect(result.length).to.equal(1); }); - it('should have all relevant fields', () => { + it('should have all relevant fields', function () { const request = spec.buildRequests(bidRequests); const result = spec.interpretResponse({body: bidResponse}, request[0]); const bid = result[0]; diff --git a/test/spec/modules/peak226BidAdapter_spec.js b/test/spec/modules/peak226BidAdapter_spec.js index f85e46c4289..8b8157225bb 100644 --- a/test/spec/modules/peak226BidAdapter_spec.js +++ b/test/spec/modules/peak226BidAdapter_spec.js @@ -4,11 +4,11 @@ import { newBidder } from 'src/adapters/bidderFactory'; const URL = 'a.ad216.com/header_bid'; -describe('PeakAdapter', () => { +describe('PeakAdapter', function () { const adapter = newBidder(spec); - describe('isBidRequestValid', () => { - it('should return true when required params found', () => { + describe('isBidRequestValid', function () { + it('should return true when required params found', function () { const bid = { params: { uid: 123 @@ -18,7 +18,7 @@ describe('PeakAdapter', () => { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { const bid = { params: {} }; @@ -27,7 +27,7 @@ describe('PeakAdapter', () => { }); }); - // xdescribe('buildRequests', () => { + // xdescribe('buildRequests', function () { // const bidRequests = [ // { // params: { @@ -36,7 +36,7 @@ describe('PeakAdapter', () => { // } // ]; - // it('sends bid request to URL via GET', () => { + // it('sends bid request to URL via GET', function () { // const request = spec.buildRequests(bidRequests); // expect(request.url).to.equal(`${URL}?uids=1234`); @@ -44,8 +44,8 @@ describe('PeakAdapter', () => { // }); // }); - describe('interpretResponse', () => { - it('should handle empty response', () => { + describe('interpretResponse', function () { + it('should handle empty response', function () { let bids = spec.interpretResponse( {}, { @@ -56,7 +56,7 @@ describe('PeakAdapter', () => { expect(bids).to.be.lengthOf(0); }); - it('should handle no seatbid returned', () => { + it('should handle no seatbid returned', function () { let response = {}; let bids = spec.interpretResponse( @@ -69,7 +69,7 @@ describe('PeakAdapter', () => { expect(bids).to.be.lengthOf(0); }); - it('should handle empty seatbid returned', () => { + it('should handle empty seatbid returned', function () { let response = { seatbid: [] }; let bids = spec.interpretResponse( @@ -82,7 +82,7 @@ describe('PeakAdapter', () => { expect(bids).to.be.lengthOf(0); }); - it('should handle seatbid returned bids', () => { + it('should handle seatbid returned bids', function () { const bidsMap = { 1: [{ bidId: 11 }] }; const bid = { price: 0.2, diff --git a/test/spec/modules/platformioBidAdapter_spec.js b/test/spec/modules/platformioBidAdapter_spec.js index 39ada3cc01c..f3754654cf1 100644 --- a/test/spec/modules/platformioBidAdapter_spec.js +++ b/test/spec/modules/platformioBidAdapter_spec.js @@ -1,335 +1,335 @@ -import {expect} from 'chai'; -import {spec} from 'modules/platformioBidAdapter'; -import {getTopWindowLocation} from 'src/utils'; -import {newBidder} from 'src/adapters/bidderFactory'; - -describe('Platform.io Adapter Tests', () => { - const slotConfigs = [{ - placementCode: '/DfpAccount1/slot1', - bidId: 'bid12345', - mediaType: 'banner', - params: { - pubId: '29521', - siteId: '26047', - placementId: '123', - size: '300x250', - bidFloor: '0.001', - ifa: 'IFA', - latitude: '40.712775', - longitude: '-74.005973' - } - }, { - placementCode: '/DfpAccount2/slot2', - bidId: 'bid23456', - mediaType: 'banner', - params: { - pubId: '29521', - siteId: '26047', - placementId: '1234', - size: '728x90', - bidFloor: '0.000001', - } - }]; - const nativeSlotConfig = [{ - placementCode: '/DfpAccount1/slot3', - bidId: 'bid12345', - mediaType: 'native', - nativeParams: { - title: { required: true, len: 200 }, - body: {}, - image: { wmin: 100 }, - sponsoredBy: { }, - icon: { } - }, - params: { - pubId: '29521', - placementId: '123', - siteId: '26047' - } - }]; - const videoSlotConfig = [{ - placementCode: '/DfpAccount1/slot4', - bidId: 'bid12345678', - mediaType: 'video', - video: { - skippable: true - }, - params: { - pubId: '29521', - placementId: '1234567', - siteId: '26047', - size: '640x480' - } - }]; - const appSlotConfig = [{ - placementCode: '/DfpAccount1/slot5', - bidId: 'bid12345', - params: { - pubId: '29521', - placementId: '1234', - app: { - id: '1111', - name: 'app name', - bundle: 'io.platform.apps', - storeUrl: 'http://platform.io/apps', - domain: 'platform.io' - } - } - }]; - - it('Verify build request', () => { - const request = spec.buildRequests(slotConfigs); - expect(request.url).to.equal('//piohbdisp.hb.adx1.com/'); - expect(request.method).to.equal('POST'); - const ortbRequest = JSON.parse(request.data); - // site object - expect(ortbRequest.site).to.not.equal(null); - expect(ortbRequest.site.publisher).to.not.equal(null); - expect(ortbRequest.site.publisher.id).to.equal('29521'); - expect(ortbRequest.site.ref).to.equal(window.top.document.referrer); - expect(ortbRequest.site.page).to.equal(getTopWindowLocation().href); - expect(ortbRequest.imp).to.have.lengthOf(2); - // device object - expect(ortbRequest.device).to.not.equal(null); - expect(ortbRequest.device.ua).to.equal(navigator.userAgent); - expect(ortbRequest.device.ifa).to.equal('IFA'); - expect(ortbRequest.device.geo.lat).to.equal('40.712775'); - expect(ortbRequest.device.geo.lon).to.equal('-74.005973'); - // slot 1 - expect(ortbRequest.imp[0].tagid).to.equal('123'); - expect(ortbRequest.imp[0].banner).to.not.equal(null); - expect(ortbRequest.imp[0].banner.w).to.equal(300); - expect(ortbRequest.imp[0].banner.h).to.equal(250); - expect(ortbRequest.imp[0].bidfloor).to.equal('0.001'); - // slot 2 - expect(ortbRequest.imp[1].tagid).to.equal('1234'); - expect(ortbRequest.imp[1].banner).to.not.equal(null); - expect(ortbRequest.imp[1].banner.w).to.equal(728); - expect(ortbRequest.imp[1].banner.h).to.equal(90); - expect(ortbRequest.imp[1].bidfloor).to.equal('0.000001'); - }); - - it('Verify parse response', () => { - const request = spec.buildRequests(slotConfigs); - const ortbRequest = JSON.parse(request.data); - const ortbResponse = { - seatbid: [{ - bid: [{ - impid: ortbRequest.imp[0].id, - price: 1.25, - adm: 'This is an Ad' - }] - }], - cur: 'USD' - }; - const bids = spec.interpretResponse({ body: ortbResponse }, request); - expect(bids).to.have.lengthOf(1); - // verify first bid - const bid = bids[0]; - expect(bid.cpm).to.equal(1.25); - expect(bid.ad).to.equal('This is an Ad'); - expect(bid.width).to.equal(300); - expect(bid.height).to.equal(250); - expect(bid.adId).to.equal('bid12345'); - expect(bid.creativeId).to.equal('bid12345'); - expect(bid.netRevenue).to.equal(true); - expect(bid.currency).to.equal('USD'); - expect(bid.ttl).to.equal(360); - }); - - it('Verify full passback', () => { - const request = spec.buildRequests(slotConfigs); - const bids = spec.interpretResponse({ body: null }, request) - expect(bids).to.have.lengthOf(0); - }); - - it('Verify Native request', () => { - const request = spec.buildRequests(nativeSlotConfig); - expect(request.url).to.equal('//piohbdisp.hb.adx1.com/'); - expect(request.method).to.equal('POST'); - const ortbRequest = JSON.parse(request.data); - // native impression - expect(ortbRequest.imp[0].tagid).to.equal('123'); - const nativePart = ortbRequest.imp[0]['native']; - expect(nativePart).to.not.equal(null); - expect(nativePart.ver).to.equal('1.1'); - expect(nativePart.request).to.not.equal(null); - // native request assets - const nativeRequest = JSON.parse(ortbRequest.imp[0]['native'].request); - expect(nativeRequest).to.not.equal(null); - expect(nativeRequest.assets).to.have.lengthOf(5); - expect(nativeRequest.assets[0].id).to.equal(1); - expect(nativeRequest.assets[1].id).to.equal(2); - expect(nativeRequest.assets[2].id).to.equal(3); - expect(nativeRequest.assets[3].id).to.equal(4); - expect(nativeRequest.assets[4].id).to.equal(5); - expect(nativeRequest.assets[0].required).to.equal(1); - expect(nativeRequest.assets[0].title).to.not.equal(null); - expect(nativeRequest.assets[0].title.len).to.equal(200); - expect(nativeRequest.assets[1].title).to.be.undefined; - expect(nativeRequest.assets[1].data).to.not.equal(null); - expect(nativeRequest.assets[1].data.type).to.equal(2); - expect(nativeRequest.assets[1].data.len).to.equal(200); - expect(nativeRequest.assets[2].required).to.equal(0); - expect(nativeRequest.assets[3].img).to.not.equal(null); - expect(nativeRequest.assets[3].img.wmin).to.equal(50); - expect(nativeRequest.assets[3].img.hmin).to.equal(50); - expect(nativeRequest.assets[3].img.type).to.equal(1); - expect(nativeRequest.assets[4].img).to.not.equal(null); - expect(nativeRequest.assets[4].img.wmin).to.equal(100); - expect(nativeRequest.assets[4].img.hmin).to.equal(150); - expect(nativeRequest.assets[4].img.type).to.equal(3); - }); - - it('Verify Native response', () => { - const request = spec.buildRequests(nativeSlotConfig); - expect(request.url).to.equal('//piohbdisp.hb.adx1.com/'); - expect(request.method).to.equal('POST'); - const ortbRequest = JSON.parse(request.data); - const nativeResponse = { - 'native': { - assets: [ - { id: 1, title: { text: 'Ad Title' } }, - { id: 2, data: { value: 'Test description' } }, - { id: 3, data: { value: 'Brand' } }, - { id: 4, img: { url: 'https://s3.amazonaws.com/adx1public/creatives_icon.png', w: 100, h: 100 } }, - { id: 5, img: { url: 'https://s3.amazonaws.com/adx1public/creatives_image.png', w: 300, h: 300 } } - ], - link: { url: 'http://brand.com/' } - } - }; - const ortbResponse = { - seatbid: [{ - bid: [{ - impid: ortbRequest.imp[0].id, - price: 1.25, - nurl: 'http://rtb.adx1.com/log', - adm: JSON.stringify(nativeResponse) - }] - }], - cur: 'USD', - }; - const bids = spec.interpretResponse({ body: ortbResponse }, request); - // verify bid - const bid = bids[0]; - expect(bid.cpm).to.equal(1.25); - expect(bid.adId).to.equal('bid12345'); - expect(bid.ad).to.be.undefined; - expect(bid.mediaType).to.equal('native'); - const nativeBid = bid['native']; - expect(nativeBid).to.not.equal(null); - expect(nativeBid.title).to.equal('Ad Title'); - expect(nativeBid.sponsoredBy).to.equal('Brand'); - expect(nativeBid.icon.url).to.equal('https://s3.amazonaws.com/adx1public/creatives_icon.png'); - expect(nativeBid.image.url).to.equal('https://s3.amazonaws.com/adx1public/creatives_image.png'); - expect(nativeBid.image.width).to.equal(300); - expect(nativeBid.image.height).to.equal(300); - expect(nativeBid.icon.width).to.equal(100); - expect(nativeBid.icon.height).to.equal(100); - expect(nativeBid.clickUrl).to.equal(encodeURIComponent('http://brand.com/')); - expect(nativeBid.impressionTrackers).to.have.lengthOf(1); - expect(nativeBid.impressionTrackers[0]).to.equal('http://rtb.adx1.com/log'); - }); - - it('Verify Video request', () => { - const request = spec.buildRequests(videoSlotConfig); - expect(request.url).to.equal('//piohbdisp.hb.adx1.com/'); - expect(request.method).to.equal('POST'); - const videoRequest = JSON.parse(request.data); - // site object - expect(videoRequest.site).to.not.equal(null); - expect(videoRequest.site.publisher.id).to.equal('29521'); - expect(videoRequest.site.ref).to.equal(window.top.document.referrer); - expect(videoRequest.site.page).to.equal(getTopWindowLocation().href); - // device object - expect(videoRequest.device).to.not.equal(null); - expect(videoRequest.device.ua).to.equal(navigator.userAgent); - // slot 1 - expect(videoRequest.imp[0].tagid).to.equal('1234567'); - expect(videoRequest.imp[0].video).to.not.equal(null); - expect(videoRequest.imp[0].video.w).to.equal(640); - expect(videoRequest.imp[0].video.h).to.equal(480); - expect(videoRequest.imp[0].banner).to.equal(null); - expect(videoRequest.imp[0].native).to.equal(null); - }); - - it('Verify parse video response', () => { - const request = spec.buildRequests(videoSlotConfig); - const videoRequest = JSON.parse(request.data); - const videoResponse = { - seatbid: [{ - bid: [{ - impid: videoRequest.imp[0].id, - price: 1.90, - adm: 'http://vid.example.com/9876', - crid: '510511_754567308' - }] - }], - cur: 'USD' - }; - const bids = spec.interpretResponse({ body: videoResponse }, request); - expect(bids).to.have.lengthOf(1); - // verify first bid - const bid = bids[0]; - expect(bid.cpm).to.equal(1.90); - expect(bid.vastUrl).to.equal('http://vid.example.com/9876'); - expect(bid.crid).to.equal('510511_754567308'); - expect(bid.width).to.equal(640); - expect(bid.height).to.equal(480); - expect(bid.adId).to.equal('bid12345678'); - expect(bid.netRevenue).to.equal(true); - expect(bid.currency).to.equal('USD'); - expect(bid.ttl).to.equal(360); - }); - - it('Verifies bidder code', () => { - expect(spec.code).to.equal('platformio'); - }); - - it('Verifies supported media types', () => { - expect(spec.supportedMediaTypes).to.have.lengthOf(3); - expect(spec.supportedMediaTypes[0]).to.equal('banner'); - expect(spec.supportedMediaTypes[1]).to.equal('native'); - expect(spec.supportedMediaTypes[2]).to.equal('video'); - }); - - it('Verifies if bid request valid', () => { - expect(spec.isBidRequestValid(slotConfigs[0])).to.equal(true); - expect(spec.isBidRequestValid(slotConfigs[1])).to.equal(true); - expect(spec.isBidRequestValid(nativeSlotConfig[0])).to.equal(true); - expect(spec.isBidRequestValid(videoSlotConfig[0])).to.equal(true); - }); - - it('Verify app requests', () => { - const request = spec.buildRequests(appSlotConfig); - const ortbRequest = JSON.parse(request.data); - expect(ortbRequest.site).to.equal(null); - expect(ortbRequest.app).to.not.be.null; - expect(ortbRequest.app.publisher).to.not.equal(null); - expect(ortbRequest.app.publisher.id).to.equal('29521'); - expect(ortbRequest.app.id).to.equal('1111'); - expect(ortbRequest.app.name).to.equal('app name'); - expect(ortbRequest.app.bundle).to.equal('io.platform.apps'); - expect(ortbRequest.app.storeurl).to.equal('http://platform.io/apps'); - expect(ortbRequest.app.domain).to.equal('platform.io'); - }); - - it('Verify GDPR', () => { - const bidderRequest = { - gdprConsent: { - gdprApplies: true, - consentString: 'serialized_gpdr_data' - } - }; - const request = spec.buildRequests(slotConfigs, bidderRequest); - expect(request.url).to.equal('//piohbdisp.hb.adx1.com/'); - expect(request.method).to.equal('POST'); - const ortbRequest = JSON.parse(request.data); - expect(ortbRequest.user).to.not.equal(null); - expect(ortbRequest.user.ext).to.not.equal(null); - expect(ortbRequest.user.ext.consent).to.equal('serialized_gpdr_data'); - expect(ortbRequest.regs).to.not.equal(null); - expect(ortbRequest.regs.ext).to.not.equal(null); - expect(ortbRequest.regs.ext.gdpr).to.equal(1); - }); -}); +import {expect} from 'chai'; +import {spec} from 'modules/platformioBidAdapter'; +import {getTopWindowLocation} from 'src/utils'; +import {newBidder} from 'src/adapters/bidderFactory'; + +describe('Platform.io Adapter Tests', function () { + const slotConfigs = [{ + placementCode: '/DfpAccount1/slot1', + bidId: 'bid12345', + mediaType: 'banner', + params: { + pubId: '29521', + siteId: '26047', + placementId: '123', + size: '300x250', + bidFloor: '0.001', + ifa: 'IFA', + latitude: '40.712775', + longitude: '-74.005973' + } + }, { + placementCode: '/DfpAccount2/slot2', + bidId: 'bid23456', + mediaType: 'banner', + params: { + pubId: '29521', + siteId: '26047', + placementId: '1234', + size: '728x90', + bidFloor: '0.000001', + } + }]; + const nativeSlotConfig = [{ + placementCode: '/DfpAccount1/slot3', + bidId: 'bid12345', + mediaType: 'native', + nativeParams: { + title: { required: true, len: 200 }, + body: {}, + image: { wmin: 100 }, + sponsoredBy: { }, + icon: { } + }, + params: { + pubId: '29521', + placementId: '123', + siteId: '26047' + } + }]; + const videoSlotConfig = [{ + placementCode: '/DfpAccount1/slot4', + bidId: 'bid12345678', + mediaType: 'video', + video: { + skippable: true + }, + params: { + pubId: '29521', + placementId: '1234567', + siteId: '26047', + size: '640x480' + } + }]; + const appSlotConfig = [{ + placementCode: '/DfpAccount1/slot5', + bidId: 'bid12345', + params: { + pubId: '29521', + placementId: '1234', + app: { + id: '1111', + name: 'app name', + bundle: 'io.platform.apps', + storeUrl: 'http://platform.io/apps', + domain: 'platform.io' + } + } + }]; + + it('Verify build request', function () { + const request = spec.buildRequests(slotConfigs); + expect(request.url).to.equal('//piohbdisp.hb.adx1.com/'); + expect(request.method).to.equal('POST'); + const ortbRequest = JSON.parse(request.data); + // site object + expect(ortbRequest.site).to.not.equal(null); + expect(ortbRequest.site.publisher).to.not.equal(null); + expect(ortbRequest.site.publisher.id).to.equal('29521'); + expect(ortbRequest.site.ref).to.equal(window.top.document.referrer); + expect(ortbRequest.site.page).to.equal(getTopWindowLocation().href); + expect(ortbRequest.imp).to.have.lengthOf(2); + // device object + expect(ortbRequest.device).to.not.equal(null); + expect(ortbRequest.device.ua).to.equal(navigator.userAgent); + expect(ortbRequest.device.ifa).to.equal('IFA'); + expect(ortbRequest.device.geo.lat).to.equal('40.712775'); + expect(ortbRequest.device.geo.lon).to.equal('-74.005973'); + // slot 1 + expect(ortbRequest.imp[0].tagid).to.equal('123'); + expect(ortbRequest.imp[0].banner).to.not.equal(null); + expect(ortbRequest.imp[0].banner.w).to.equal(300); + expect(ortbRequest.imp[0].banner.h).to.equal(250); + expect(ortbRequest.imp[0].bidfloor).to.equal('0.001'); + // slot 2 + expect(ortbRequest.imp[1].tagid).to.equal('1234'); + expect(ortbRequest.imp[1].banner).to.not.equal(null); + expect(ortbRequest.imp[1].banner.w).to.equal(728); + expect(ortbRequest.imp[1].banner.h).to.equal(90); + expect(ortbRequest.imp[1].bidfloor).to.equal('0.000001'); + }); + + it('Verify parse response', function () { + const request = spec.buildRequests(slotConfigs); + const ortbRequest = JSON.parse(request.data); + const ortbResponse = { + seatbid: [{ + bid: [{ + impid: ortbRequest.imp[0].id, + price: 1.25, + adm: 'This is an Ad' + }] + }], + cur: 'USD' + }; + const bids = spec.interpretResponse({ body: ortbResponse }, request); + expect(bids).to.have.lengthOf(1); + // verify first bid + const bid = bids[0]; + expect(bid.cpm).to.equal(1.25); + expect(bid.ad).to.equal('This is an Ad'); + expect(bid.width).to.equal(300); + expect(bid.height).to.equal(250); + expect(bid.adId).to.equal('bid12345'); + expect(bid.creativeId).to.equal('bid12345'); + expect(bid.netRevenue).to.equal(true); + expect(bid.currency).to.equal('USD'); + expect(bid.ttl).to.equal(360); + }); + + it('Verify full passback', function () { + const request = spec.buildRequests(slotConfigs); + const bids = spec.interpretResponse({ body: null }, request) + expect(bids).to.have.lengthOf(0); + }); + + it('Verify Native request', function () { + const request = spec.buildRequests(nativeSlotConfig); + expect(request.url).to.equal('//piohbdisp.hb.adx1.com/'); + expect(request.method).to.equal('POST'); + const ortbRequest = JSON.parse(request.data); + // native impression + expect(ortbRequest.imp[0].tagid).to.equal('123'); + const nativePart = ortbRequest.imp[0]['native']; + expect(nativePart).to.not.equal(null); + expect(nativePart.ver).to.equal('1.1'); + expect(nativePart.request).to.not.equal(null); + // native request assets + const nativeRequest = JSON.parse(ortbRequest.imp[0]['native'].request); + expect(nativeRequest).to.not.equal(null); + expect(nativeRequest.assets).to.have.lengthOf(5); + expect(nativeRequest.assets[0].id).to.equal(1); + expect(nativeRequest.assets[1].id).to.equal(2); + expect(nativeRequest.assets[2].id).to.equal(3); + expect(nativeRequest.assets[3].id).to.equal(4); + expect(nativeRequest.assets[4].id).to.equal(5); + expect(nativeRequest.assets[0].required).to.equal(1); + expect(nativeRequest.assets[0].title).to.not.equal(null); + expect(nativeRequest.assets[0].title.len).to.equal(200); + expect(nativeRequest.assets[1].title).to.be.undefined; + expect(nativeRequest.assets[1].data).to.not.equal(null); + expect(nativeRequest.assets[1].data.type).to.equal(2); + expect(nativeRequest.assets[1].data.len).to.equal(200); + expect(nativeRequest.assets[2].required).to.equal(0); + expect(nativeRequest.assets[3].img).to.not.equal(null); + expect(nativeRequest.assets[3].img.wmin).to.equal(50); + expect(nativeRequest.assets[3].img.hmin).to.equal(50); + expect(nativeRequest.assets[3].img.type).to.equal(1); + expect(nativeRequest.assets[4].img).to.not.equal(null); + expect(nativeRequest.assets[4].img.wmin).to.equal(100); + expect(nativeRequest.assets[4].img.hmin).to.equal(150); + expect(nativeRequest.assets[4].img.type).to.equal(3); + }); + + it('Verify Native response', function () { + const request = spec.buildRequests(nativeSlotConfig); + expect(request.url).to.equal('//piohbdisp.hb.adx1.com/'); + expect(request.method).to.equal('POST'); + const ortbRequest = JSON.parse(request.data); + const nativeResponse = { + 'native': { + assets: [ + { id: 1, title: { text: 'Ad Title' } }, + { id: 2, data: { value: 'Test description' } }, + { id: 3, data: { value: 'Brand' } }, + { id: 4, img: { url: 'https://s3.amazonaws.com/adx1public/creatives_icon.png', w: 100, h: 100 } }, + { id: 5, img: { url: 'https://s3.amazonaws.com/adx1public/creatives_image.png', w: 300, h: 300 } } + ], + link: { url: 'http://brand.com/' } + } + }; + const ortbResponse = { + seatbid: [{ + bid: [{ + impid: ortbRequest.imp[0].id, + price: 1.25, + nurl: 'http://rtb.adx1.com/log', + adm: JSON.stringify(nativeResponse) + }] + }], + cur: 'USD', + }; + const bids = spec.interpretResponse({ body: ortbResponse }, request); + // verify bid + const bid = bids[0]; + expect(bid.cpm).to.equal(1.25); + expect(bid.adId).to.equal('bid12345'); + expect(bid.ad).to.be.undefined; + expect(bid.mediaType).to.equal('native'); + const nativeBid = bid['native']; + expect(nativeBid).to.not.equal(null); + expect(nativeBid.title).to.equal('Ad Title'); + expect(nativeBid.sponsoredBy).to.equal('Brand'); + expect(nativeBid.icon.url).to.equal('https://s3.amazonaws.com/adx1public/creatives_icon.png'); + expect(nativeBid.image.url).to.equal('https://s3.amazonaws.com/adx1public/creatives_image.png'); + expect(nativeBid.image.width).to.equal(300); + expect(nativeBid.image.height).to.equal(300); + expect(nativeBid.icon.width).to.equal(100); + expect(nativeBid.icon.height).to.equal(100); + expect(nativeBid.clickUrl).to.equal(encodeURIComponent('http://brand.com/')); + expect(nativeBid.impressionTrackers).to.have.lengthOf(1); + expect(nativeBid.impressionTrackers[0]).to.equal('http://rtb.adx1.com/log'); + }); + + it('Verify Video request', function () { + const request = spec.buildRequests(videoSlotConfig); + expect(request.url).to.equal('//piohbdisp.hb.adx1.com/'); + expect(request.method).to.equal('POST'); + const videoRequest = JSON.parse(request.data); + // site object + expect(videoRequest.site).to.not.equal(null); + expect(videoRequest.site.publisher.id).to.equal('29521'); + expect(videoRequest.site.ref).to.equal(window.top.document.referrer); + expect(videoRequest.site.page).to.equal(getTopWindowLocation().href); + // device object + expect(videoRequest.device).to.not.equal(null); + expect(videoRequest.device.ua).to.equal(navigator.userAgent); + // slot 1 + expect(videoRequest.imp[0].tagid).to.equal('1234567'); + expect(videoRequest.imp[0].video).to.not.equal(null); + expect(videoRequest.imp[0].video.w).to.equal(640); + expect(videoRequest.imp[0].video.h).to.equal(480); + expect(videoRequest.imp[0].banner).to.equal(null); + expect(videoRequest.imp[0].native).to.equal(null); + }); + + it('Verify parse video response', function () { + const request = spec.buildRequests(videoSlotConfig); + const videoRequest = JSON.parse(request.data); + const videoResponse = { + seatbid: [{ + bid: [{ + impid: videoRequest.imp[0].id, + price: 1.90, + adm: 'http://vid.example.com/9876', + crid: '510511_754567308' + }] + }], + cur: 'USD' + }; + const bids = spec.interpretResponse({ body: videoResponse }, request); + expect(bids).to.have.lengthOf(1); + // verify first bid + const bid = bids[0]; + expect(bid.cpm).to.equal(1.90); + expect(bid.vastUrl).to.equal('http://vid.example.com/9876'); + expect(bid.crid).to.equal('510511_754567308'); + expect(bid.width).to.equal(640); + expect(bid.height).to.equal(480); + expect(bid.adId).to.equal('bid12345678'); + expect(bid.netRevenue).to.equal(true); + expect(bid.currency).to.equal('USD'); + expect(bid.ttl).to.equal(360); + }); + + it('Verifies bidder code', function () { + expect(spec.code).to.equal('platformio'); + }); + + it('Verifies supported media types', function () { + expect(spec.supportedMediaTypes).to.have.lengthOf(3); + expect(spec.supportedMediaTypes[0]).to.equal('banner'); + expect(spec.supportedMediaTypes[1]).to.equal('native'); + expect(spec.supportedMediaTypes[2]).to.equal('video'); + }); + + it('Verifies if bid request valid', function () { + expect(spec.isBidRequestValid(slotConfigs[0])).to.equal(true); + expect(spec.isBidRequestValid(slotConfigs[1])).to.equal(true); + expect(spec.isBidRequestValid(nativeSlotConfig[0])).to.equal(true); + expect(spec.isBidRequestValid(videoSlotConfig[0])).to.equal(true); + }); + + it('Verify app requests', function () { + const request = spec.buildRequests(appSlotConfig); + const ortbRequest = JSON.parse(request.data); + expect(ortbRequest.site).to.equal(null); + expect(ortbRequest.app).to.not.be.null; + expect(ortbRequest.app.publisher).to.not.equal(null); + expect(ortbRequest.app.publisher.id).to.equal('29521'); + expect(ortbRequest.app.id).to.equal('1111'); + expect(ortbRequest.app.name).to.equal('app name'); + expect(ortbRequest.app.bundle).to.equal('io.platform.apps'); + expect(ortbRequest.app.storeurl).to.equal('http://platform.io/apps'); + expect(ortbRequest.app.domain).to.equal('platform.io'); + }); + + it('Verify GDPR', function () { + const bidderRequest = { + gdprConsent: { + gdprApplies: true, + consentString: 'serialized_gpdr_data' + } + }; + const request = spec.buildRequests(slotConfigs, bidderRequest); + expect(request.url).to.equal('//piohbdisp.hb.adx1.com/'); + expect(request.method).to.equal('POST'); + const ortbRequest = JSON.parse(request.data); + expect(ortbRequest.user).to.not.equal(null); + expect(ortbRequest.user.ext).to.not.equal(null); + expect(ortbRequest.user.ext.consent).to.equal('serialized_gpdr_data'); + expect(ortbRequest.regs).to.not.equal(null); + expect(ortbRequest.regs.ext).to.not.equal(null); + expect(ortbRequest.regs.ext.gdpr).to.equal(1); + }); +}); diff --git a/test/spec/modules/playgroundxyzBidAdapter_spec.js b/test/spec/modules/playgroundxyzBidAdapter_spec.js index becd8612a9c..ac0922ef82e 100644 --- a/test/spec/modules/playgroundxyzBidAdapter_spec.js +++ b/test/spec/modules/playgroundxyzBidAdapter_spec.js @@ -6,16 +6,16 @@ import { deepClone } from 'src/utils'; const URL = 'https://ads.playground.xyz/host-config/prebid'; const GDPR_CONSENT = 'XYZ-CONSENT'; -describe('playgroundxyzBidAdapter', () => { +describe('playgroundxyzBidAdapter', function () { const adapter = newBidder(spec); - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { 'bidder': 'playgroundxyz', 'params': { @@ -28,11 +28,11 @@ describe('playgroundxyzBidAdapter', () => { 'auctionId': '1d1a030790a475', }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -42,7 +42,7 @@ describe('playgroundxyzBidAdapter', () => { }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let bidRequests = [ { 'bidder': 'playgroundxyz', @@ -57,7 +57,7 @@ describe('playgroundxyzBidAdapter', () => { } ]; - it('sends bid request to ENDPOINT via POST', () => { + it('sends bid request to ENDPOINT via POST', function () { let bidRequest = Object.assign([], bidRequests); const request = spec.buildRequests(bidRequest); @@ -72,7 +72,7 @@ describe('playgroundxyzBidAdapter', () => { }); }) - describe('interpretResponse', () => { + describe('interpretResponse', function () { let response = { 'id': 'bidd_id', 'seatbid': [ { @@ -109,7 +109,7 @@ describe('playgroundxyzBidAdapter', () => { 'bidderCode': 'playgroundxyz' }; - it('should get correct bid response', () => { + it('should get correct bid response', function () { let expectedResponse = [ { 'requestId': '221f2bdc1fbc31', @@ -128,14 +128,14 @@ describe('playgroundxyzBidAdapter', () => { expect(Object.keys(result[0])).to.have.members(Object.keys(expectedResponse[0])); }); - it('handles nobid responses', () => { + it('handles nobid responses', function () { let response = ''; let result = spec.interpretResponse({ body: response }, {bidderRequest}); expect(result.length).to.equal(0); }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let bidRequests = [ { 'bidder': 'playgroundxyz', @@ -150,7 +150,7 @@ describe('playgroundxyzBidAdapter', () => { } ]; - it('should not populate GDPR', () => { + it('should not populate GDPR', function () { let bidRequest = Object.assign([], bidRequests); const request = spec.buildRequests(bidRequest); let data = JSON.parse(request.data); @@ -158,7 +158,7 @@ describe('playgroundxyzBidAdapter', () => { expect(data).to.not.have.property('regs'); }); - it('should populate GDPR and consent string when consetString is presented but not gdpApplies', () => { + it('should populate GDPR and consent string when consetString is presented but not gdpApplies', function () { let bidRequest = Object.assign([], bidRequests); const request = spec.buildRequests(bidRequest, {gdprConsent: {consentString: GDPR_CONSENT}}); let data = JSON.parse(request.data); @@ -166,7 +166,7 @@ describe('playgroundxyzBidAdapter', () => { expect(data.user.ext.consent).to.equal('XYZ-CONSENT'); }); - it('should populate GDPR and consent string when gdpr is set to true', () => { + it('should populate GDPR and consent string when gdpr is set to true', function () { let bidRequest = Object.assign([], bidRequests); const request = spec.buildRequests(bidRequest, {gdprConsent: {gdprApplies: true, consentString: GDPR_CONSENT}}); let data = JSON.parse(request.data); @@ -174,7 +174,7 @@ describe('playgroundxyzBidAdapter', () => { expect(data.user.ext.consent).to.equal('XYZ-CONSENT'); }); - it('should populate GDPR and consent string when gdpr is set to false', () => { + it('should populate GDPR and consent string when gdpr is set to false', function () { let bidRequest = Object.assign([], bidRequests); const request = spec.buildRequests(bidRequest, {gdprConsent: {gdprApplies: false, consentString: GDPR_CONSENT}}); let data = JSON.parse(request.data); diff --git a/test/spec/modules/polluxBidAdapter_spec.js b/test/spec/modules/polluxBidAdapter_spec.js index ea550fecd71..ad30771e15b 100644 --- a/test/spec/modules/polluxBidAdapter_spec.js +++ b/test/spec/modules/polluxBidAdapter_spec.js @@ -24,7 +24,7 @@ describe('POLLUX Bid Adapter tests', function () { params: {zone: '276'} }]; - it('TEST: verify buildRequests no valid bid requests', () => { + it('TEST: verify buildRequests no valid bid requests', function () { let request = spec.buildRequests(false); expect(request).to.not.equal(null); expect(request).to.not.have.property('method'); @@ -47,7 +47,7 @@ describe('POLLUX Bid Adapter tests', function () { expect(request).to.not.have.property('data'); }); - it('TEST: verify buildRequests single bid', () => { + it('TEST: verify buildRequests single bid', function () { const request = spec.buildRequests(setup_single_bid); expect(request.method).to.equal('POST'); const requested_bids = JSON.parse(request.data); @@ -70,7 +70,7 @@ describe('POLLUX Bid Adapter tests', function () { expect(requested_bids[0].zones).to.equal('1806,276'); }); - it('TEST: verify buildRequests multi bid', () => { + it('TEST: verify buildRequests multi bid', function () { const request = spec.buildRequests(setup_multi_bid); expect(request.method).to.equal('POST'); const requested_bids = JSON.parse(request.data); @@ -102,7 +102,7 @@ describe('POLLUX Bid Adapter tests', function () { expect(requested_bids[1].zones).to.equal('276'); }); - it('TEST: verify interpretResponse empty', () => { + it('TEST: verify interpretResponse empty', function () { let bids = spec.interpretResponse(false, {}); expect(bids).to.not.equal(null); expect(bids).to.have.lengthOf(0); @@ -117,7 +117,7 @@ describe('POLLUX Bid Adapter tests', function () { expect(bids).to.have.lengthOf(0); }); - it('TEST: verify interpretResponse ad_type url', () => { + it('TEST: verify interpretResponse ad_type url', function () { const serverResponse = { body: [ { @@ -147,7 +147,7 @@ describe('POLLUX Bid Adapter tests', function () { expect(bids[0]).to.not.have.property('ad'); }); - it('TEST: verify interpretResponse ad_type html', () => { + it('TEST: verify interpretResponse ad_type html', function () { const serverResponse = { body: [ { @@ -176,7 +176,7 @@ describe('POLLUX Bid Adapter tests', function () { expect(bids[0].ad).to.equal('

I am an ad

'); }); - it('TEST: verify url and query params', () => { + it('TEST: verify url and query params', function () { const URL = require('url-parse'); const querystringify = require('querystringify'); const request = spec.buildRequests(setup_single_bid); @@ -188,7 +188,7 @@ describe('POLLUX Bid Adapter tests', function () { expect(parsedQuery).to.have.property('domain').and.to.have.length.above(1); }); - it('TEST: verify isBidRequestValid', () => { + it('TEST: verify isBidRequestValid', function () { expect(spec.isBidRequestValid({})).to.equal(false); expect(spec.isBidRequestValid({params: {}})).to.equal(false); expect(spec.isBidRequestValid(setup_single_bid[0])).to.equal(true); @@ -196,11 +196,11 @@ describe('POLLUX Bid Adapter tests', function () { expect(spec.isBidRequestValid(setup_multi_bid[1])).to.equal(true); }); - it('TEST: verify bidder code', () => { + it('TEST: verify bidder code', function () { expect(spec.code).to.equal('pollux'); }); - it('TEST: verify bidder aliases', () => { + it('TEST: verify bidder aliases', function () { expect(spec.aliases).to.have.lengthOf(1); expect(spec.aliases[0]).to.equal('plx'); }); diff --git a/test/spec/modules/polymorphBidAdapter_spec.js b/test/spec/modules/polymorphBidAdapter_spec.js index cf20cdfaf22..e2df44e8cfc 100644 --- a/test/spec/modules/polymorphBidAdapter_spec.js +++ b/test/spec/modules/polymorphBidAdapter_spec.js @@ -33,19 +33,19 @@ const bidRequests = [{ 'auctionId': '1d1a030790a476', }]; -describe('Polymorph adapter test', () => { - describe('.code', () => { - it('should return a bidder code of polymorph', () => { +describe('Polymorph adapter test', function () { + describe('.code', function () { + it('should return a bidder code of polymorph', function () { expect(spec.code).to.eql(BIDDER_CODE); }); }); - describe('isBidRequestValid', () => { - it('should return true when required params found', () => { + describe('isBidRequestValid', function () { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bidRequests[0])).to.equal(true); }); - it('should return false if req has no placementId', () => { + it('should return false if req has no placementId', function () { const invalidBidRequest = { bidder: BIDDER_CODE, params: { @@ -55,7 +55,7 @@ describe('Polymorph adapter test', () => { expect(spec.isBidRequestValid(invalidBidRequest)).to.eql(false); }); - it('should return false if req has wrong bidder code', () => { + it('should return false if req has wrong bidder code', function () { const invalidBidRequest = { bidder: 'something', params: { @@ -66,8 +66,8 @@ describe('Polymorph adapter test', () => { }); }); - describe('buildRequests', () => { - it('payload test', () => { + describe('buildRequests', function () { + it('payload test', function () { const requests = spec.buildRequests(bidRequests); var payload1 = {}; requests[0].data.replace(/([^=&]+)=([^&]*)/g, function(m, key, value) { @@ -92,14 +92,14 @@ describe('Polymorph adapter test', () => { expect(payload2.sizes).to.equal('700,250,300,600'); }); - it('sends bid request to ENDPOINT via GET', () => { + it('sends bid request to ENDPOINT via GET', function () { const requests = spec.buildRequests(bidRequests); expect(requests[0].url).to.equal(ENDPOINT_URL); expect(requests[0].method).to.equal('GET'); }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { const response = { body: { 'status': 'OK', @@ -133,7 +133,7 @@ describe('Polymorph adapter test', () => { } }; - it('should get correct bid response', () => { + it('should get correct bid response', function () { const body = response.body; const expectedResponse = [{ requestId: bidRequests[0].bidId, @@ -152,7 +152,7 @@ describe('Polymorph adapter test', () => { expect(result).to.deep.equal(expectedResponse); }); - it('widget use case', () => { + it('widget use case', function () { const body = response2.body; const expectedResponse = [ { @@ -173,7 +173,7 @@ describe('Polymorph adapter test', () => { expect(result).to.deep.equal(expectedResponse); }); - it('handles nobid responses', () => { + it('handles nobid responses', function () { let response = []; let result = spec.interpretResponse(response, { 'bidderRequest': bidRequests[0] }); diff --git a/test/spec/modules/prebidServerBidAdapter_spec.js b/test/spec/modules/prebidServerBidAdapter_spec.js index 556755316eb..a22006e5a81 100644 --- a/test/spec/modules/prebidServerBidAdapter_spec.js +++ b/test/spec/modules/prebidServerBidAdapter_spec.js @@ -329,12 +329,12 @@ const RESPONSE_UNSUPPORTED_BIDDER = { }] }; -describe('S2S Adapter', () => { +describe('S2S Adapter', function () { let adapter, addBidResponse = sinon.spy(), done = sinon.spy(); - beforeEach(() => { + beforeEach(function () { adapter = new Adapter(); BID_REQUESTS = [ { @@ -370,16 +370,16 @@ describe('S2S Adapter', () => { ]; }); - afterEach(() => { + afterEach(function () { addBidResponse.resetHistory(); done.resetHistory(); }); - describe('request function', () => { + describe('request function', function () { let xhr; let requests; - beforeEach(() => { + beforeEach(function () { xhr = sinon.useFakeXMLHttpRequest(); requests = []; xhr.onCreate = request => requests.push(request); @@ -387,13 +387,15 @@ describe('S2S Adapter', () => { resetSyncedStatus(); }); - afterEach(() => xhr.restore()); + afterEach(function () { + xhr.restore(); + }); - it('exists and is a function', () => { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); - it('exists converts types', () => { + it('exists converts types', function () { config.setConfig({s2sConfig: CONFIG}); adapter.callBids(REQUEST, BID_REQUESTS, addBidResponse, done, ajax); const requestBid = JSON.parse(requests[0].requestBody); @@ -402,13 +404,13 @@ describe('S2S Adapter', () => { expect(requestBid.ad_units[0].bids[0].params.member).to.exist.and.to.be.a('string'); }); - describe('gdpr tests', () => { - afterEach(() => { + describe('gdpr tests', function () { + afterEach(function () { config.resetConfig(); $$PREBID_GLOBAL$$.requestBids.removeHook(requestBidsHook); }); - it('adds gdpr consent information to ortb2 request depending on presence of module', () => { + it('adds gdpr consent information to ortb2 request depending on presence of module', function () { let ortb2Config = utils.deepClone(CONFIG); ortb2Config.endpoint = 'https://prebid.adnxs.com/pbs/v1/openrtb2/auction' @@ -437,7 +439,7 @@ describe('S2S Adapter', () => { expect(requestBid.user).to.not.exist; }); - it('check gdpr info gets added into cookie_sync request: have consent data', () => { + it('check gdpr info gets added into cookie_sync request: have consent data', function () { let cookieSyncConfig = utils.deepClone(CONFIG); cookieSyncConfig.syncEndpoint = 'https://prebid.adnxs.com/pbs/v1/cookie_sync'; @@ -458,7 +460,7 @@ describe('S2S Adapter', () => { expect(requestBid.gdpr_consent).is.equal('abc123def'); }); - it('check gdpr info gets added into cookie_sync request: have consent data but gdprApplies is false', () => { + it('check gdpr info gets added into cookie_sync request: have consent data but gdprApplies is false', function () { let cookieSyncConfig = utils.deepClone(CONFIG); cookieSyncConfig.syncEndpoint = 'https://prebid.adnxs.com/pbs/v1/cookie_sync'; @@ -478,7 +480,7 @@ describe('S2S Adapter', () => { expect(requestBid.gdpr_consent).is.undefined; }); - it('checks gdpr info gets added to cookie_sync request: consent data unknown', () => { + it('checks gdpr info gets added to cookie_sync request: consent data unknown', function () { let cookieSyncConfig = utils.deepClone(CONFIG); cookieSyncConfig.syncEndpoint = 'https://prebid.adnxs.com/pbs/v1/cookie_sync'; @@ -499,7 +501,7 @@ describe('S2S Adapter', () => { }); }); - it('sets invalid cacheMarkup value to 0', () => { + it('sets invalid cacheMarkup value to 0', function () { const s2sConfig = Object.assign({}, CONFIG, { cacheMarkup: 999 }); @@ -509,7 +511,7 @@ describe('S2S Adapter', () => { expect(requestBid).to.have.property('cache_markup', 0); }); - it('adds digitrust id is present and user is not optout', () => { + it('adds digitrust id is present and user is not optout', function () { let digiTrustObj = { success: true, identity: { @@ -544,7 +546,7 @@ describe('S2S Adapter', () => { delete window.DigiTrust; }); - it('adds device and app objects to request', () => { + it('adds device and app objects to request', function () { const _config = { s2sConfig: CONFIG, device: { ifa: '6D92078A-8246-4BA4-AE5B-76104861E7DC' }, app: { bundle: 'com.test.app' }, @@ -562,7 +564,7 @@ describe('S2S Adapter', () => { }); }); - it('adds device and app objects to request for ORTB', () => { + it('adds device and app objects to request for ORTB', function () { const s2sConfig = Object.assign({}, CONFIG, { endpoint: 'https://prebid.adnxs.com/pbs/v1/openrtb2/auction' }); @@ -585,7 +587,7 @@ describe('S2S Adapter', () => { }); }); - it('adds site if app is not present', () => { + it('adds site if app is not present', function () { const s2sConfig = Object.assign({}, CONFIG, { endpoint: 'https://prebid.adnxs.com/pbs/v1/openrtb2/auction' }); @@ -602,7 +604,7 @@ describe('S2S Adapter', () => { expect(requestBid.site.page).to.exist.and.to.be.a('string'); }); - it('adds appnexus aliases to request', () => { + it('adds appnexus aliases to request', function () { const s2sConfig = Object.assign({}, CONFIG, { endpoint: 'https://prebid.adnxs.com/pbs/v1/openrtb2/auction' }); @@ -629,7 +631,7 @@ describe('S2S Adapter', () => { }); }); - it('adds dynamic aliases to request', () => { + it('adds dynamic aliases to request', function () { const s2sConfig = Object.assign({}, CONFIG, { endpoint: 'https://prebid.adnxs.com/pbs/v1/openrtb2/auction' }); @@ -659,7 +661,7 @@ describe('S2S Adapter', () => { }); }); - it('converts appnexus params to expected format for PBS', () => { + it('converts appnexus params to expected format for PBS', function () { const s2sConfig = Object.assign({}, CONFIG, { endpoint: 'https://prebid.adnxs.com/pbs/v1/openrtb2/auction' }); @@ -710,11 +712,11 @@ describe('S2S Adapter', () => { }); }); - describe('response handler', () => { + describe('response handler', function () { let server; let logWarnSpy; - beforeEach(() => { + beforeEach(function () { server = sinon.fakeServer.create(); sinon.stub(utils, 'triggerPixel'); sinon.stub(utils, 'insertUserSyncIframe'); @@ -724,7 +726,7 @@ describe('S2S Adapter', () => { logWarnSpy = sinon.spy(utils, 'logWarn'); }); - afterEach(() => { + afterEach(function () { server.restore(); utils.triggerPixel.restore(); utils.insertUserSyncIframe.restore(); @@ -735,7 +737,7 @@ describe('S2S Adapter', () => { }); // TODO: test dependent on pbjs_api_spec. Needs to be isolated - it('registers bids and calls BIDDER_DONE', () => { + it('registers bids and calls BIDDER_DONE', function () { server.respondWith(JSON.stringify(RESPONSE)); config.setConfig({s2sConfig: CONFIG}); @@ -758,7 +760,7 @@ describe('S2S Adapter', () => { expect(response).to.not.have.property('vastUrl'); }); - it('registers video bids', () => { + it('registers video bids', function () { server.respondWith(JSON.stringify(VIDEO_RESPONSE)); config.setConfig({s2sConfig: CONFIG}); @@ -776,7 +778,7 @@ describe('S2S Adapter', () => { expect(response).to.have.property('vastUrl', 'video_cache_url'); }); - it('does not call addBidResponse and calls done when ad unit not set', () => { + it('does not call addBidResponse and calls done when ad unit not set', function () { server.respondWith(JSON.stringify(RESPONSE_NO_BID_NO_UNIT)); config.setConfig({s2sConfig: CONFIG}); @@ -787,7 +789,7 @@ describe('S2S Adapter', () => { sinon.assert.calledOnce(done); }); - it('does not call addBidResponse and calls done when server requests cookie sync', () => { + it('does not call addBidResponse and calls done when server requests cookie sync', function () { server.respondWith(JSON.stringify(RESPONSE_NO_COOKIE)); config.setConfig({s2sConfig: CONFIG}); @@ -798,7 +800,7 @@ describe('S2S Adapter', () => { sinon.assert.calledOnce(done); }); - it('does not call addBidResponse and calls done when ad unit is set', () => { + it('does not call addBidResponse and calls done when ad unit is set', function () { server.respondWith(JSON.stringify(RESPONSE_NO_BID_UNIT_SET)); config.setConfig({s2sConfig: CONFIG}); @@ -809,7 +811,7 @@ describe('S2S Adapter', () => { sinon.assert.calledOnce(done); }); - it('registers successful bids and calls done when there are less bids than requests', () => { + it('registers successful bids and calls done when there are less bids than requests', function () { server.respondWith(JSON.stringify(RESPONSE)); config.setConfig({s2sConfig: CONFIG}); @@ -827,7 +829,7 @@ describe('S2S Adapter', () => { .to.have.property('statusMessage', 'Bid available'); }); - it('should have dealId in bidObject', () => { + it('should have dealId in bidObject', function () { server.respondWith(JSON.stringify(RESPONSE)); config.setConfig({s2sConfig: CONFIG}); @@ -837,7 +839,7 @@ describe('S2S Adapter', () => { expect(response).to.have.property('dealId', 'test-dealid'); }); - it('should pass through default adserverTargeting if present in bidObject', () => { + it('should pass through default adserverTargeting if present in bidObject', function () { server.respondWith(JSON.stringify(RESPONSE)); config.setConfig({s2sConfig: CONFIG}); @@ -847,7 +849,7 @@ describe('S2S Adapter', () => { expect(response).to.have.property('adserverTargeting').that.deep.equals({'foo': 'bar'}); }); - it('registers client user syncs when client bid adapter is present', () => { + it('registers client user syncs when client bid adapter is present', function () { let rubiconAdapter = { registerSyncs: sinon.spy() }; @@ -864,7 +866,7 @@ describe('S2S Adapter', () => { adapterManager.getBidAdapter.restore(); }); - it('registers client user syncs when using OpenRTB endpoint', () => { + it('registers client user syncs when using OpenRTB endpoint', function () { let rubiconAdapter = { registerSyncs: sinon.spy() }; @@ -884,7 +886,7 @@ describe('S2S Adapter', () => { adapterManager.getBidAdapter.restore(); }); - it('registers bid responses when server requests cookie sync', () => { + it('registers bid responses when server requests cookie sync', function () { server.respondWith(JSON.stringify(RESPONSE_NO_PBS_COOKIE)); config.setConfig({s2sConfig: CONFIG}); @@ -903,7 +905,7 @@ describe('S2S Adapter', () => { expect(bid_request_passed).to.have.property('adId', '123'); }); - it('does not call cookieSet cookie sync when no_cookie response && not opted in', () => { + it('does not call cookieSet cookie sync when no_cookie response && not opted in', function () { server.respondWith(JSON.stringify(RESPONSE_NO_PBS_COOKIE)); let myConfig = Object.assign({}, CONFIG); @@ -914,7 +916,7 @@ describe('S2S Adapter', () => { sinon.assert.notCalled(cookie.cookieSet); }); - it('calls cookieSet cookie sync when no_cookie response && opted in', () => { + it('calls cookieSet cookie sync when no_cookie response && opted in', function () { server.respondWith(JSON.stringify(RESPONSE_NO_PBS_COOKIE)); let myConfig = Object.assign({ cookieSet: true, @@ -927,7 +929,7 @@ describe('S2S Adapter', () => { sinon.assert.calledOnce(cookie.cookieSet); }); - it('handles OpenRTB responses and call BIDDER_DONE', () => { + it('handles OpenRTB responses and call BIDDER_DONE', function () { const s2sConfig = Object.assign({}, CONFIG, { endpoint: 'https://prebid.adnxs.com/pbs/v1/openrtb2/auction' }); @@ -950,7 +952,7 @@ describe('S2S Adapter', () => { expect(response).to.have.property('cpm', 0.5); }); - it('handles OpenRTB video responses', () => { + it('handles OpenRTB video responses', function () { const s2sConfig = Object.assign({}, CONFIG, { endpoint: 'https://prebidserverurl/openrtb2/auction?querystring=param' }); @@ -970,7 +972,7 @@ describe('S2S Adapter', () => { expect(response).to.have.property('cpm', 10); }); - it('should log warning for unsupported bidder', () => { + it('should log warning for unsupported bidder', function () { server.respondWith(JSON.stringify(RESPONSE_UNSUPPORTED_BIDDER)); const s2sConfig = Object.assign({}, CONFIG, { @@ -990,18 +992,18 @@ describe('S2S Adapter', () => { }); }); - describe('s2sConfig', () => { + describe('s2sConfig', function () { let logErrorSpy; - beforeEach(() => { + beforeEach(function () { logErrorSpy = sinon.spy(utils, 'logError'); }); - afterEach(() => { + afterEach(function () { utils.logError.restore(); }); - it('should log an error when accountId is missing', () => { + it('should log an error when accountId is missing', function () { const options = { enabled: true, bidders: ['appnexus'], @@ -1014,7 +1016,7 @@ describe('S2S Adapter', () => { sinon.assert.calledOnce(logErrorSpy); }); - it('should log an error when bidders is missing', () => { + it('should log an error when bidders is missing', function () { const options = { accountId: '1', enabled: true, @@ -1027,7 +1029,7 @@ describe('S2S Adapter', () => { sinon.assert.calledOnce(logErrorSpy); }); - it('should log an error when endpoint is missing', () => { + it('should log an error when endpoint is missing', function () { const options = { accountId: '1', bidders: ['appnexus'], @@ -1040,7 +1042,7 @@ describe('S2S Adapter', () => { sinon.assert.calledOnce(logErrorSpy); }); - it('should log an error when using an unknown vendor', () => { + it('should log an error when using an unknown vendor', function () { const options = { accountId: '1', bidders: ['appnexus'], @@ -1051,7 +1053,7 @@ describe('S2S Adapter', () => { sinon.assert.calledOnce(logErrorSpy); }); - it('should configure the s2sConfig object with appnexus vendor defaults unless specified by user', () => { + it('should configure the s2sConfig object with appnexus vendor defaults unless specified by user', function () { const options = { accountId: '123', bidders: ['appnexus'], @@ -1074,7 +1076,7 @@ describe('S2S Adapter', () => { expect(vendorConfig).to.have.property('timeout', 750); }); - it('should configure the s2sConfig object with rubicon vendor defaults unless specified by user', () => { + it('should configure the s2sConfig object with rubicon vendor defaults unless specified by user', function () { const options = { accountId: 'abc', bidders: ['rubicon'], diff --git a/test/spec/modules/pubCommonId_spec.js b/test/spec/modules/pubCommonId_spec.js index bdb9d4f0545..aaf296cfb43 100644 --- a/test/spec/modules/pubCommonId_spec.js +++ b/test/spec/modules/pubCommonId_spec.js @@ -18,7 +18,7 @@ const COOKIE_NAME = '_pubcid'; const TIMEOUT = 2000; describe('Publisher Common ID', function () { - afterEach(() => { + afterEach(function () { $$PREBID_GLOBAL$$.requestBids.removeHook(requestBidHook); }); describe('Decorate adUnits', function () { @@ -159,7 +159,7 @@ describe('Publisher Common ID', function () { getUserSyncs: () => {} }; - beforeEach(() => { + beforeEach(function () { adUnits = [{ code: 'adUnit-code', mediaTypes: { @@ -179,7 +179,7 @@ describe('Publisher Common ID', function () { registerBidder(sampleSpec); }); - afterEach(() => { + afterEach(function () { auctionModule.newAuction.restore(); }); diff --git a/test/spec/modules/pubmaticBidAdapter_spec.js b/test/spec/modules/pubmaticBidAdapter_spec.js index 5c1d668f435..e67ec1f11a2 100644 --- a/test/spec/modules/pubmaticBidAdapter_spec.js +++ b/test/spec/modules/pubmaticBidAdapter_spec.js @@ -3,13 +3,13 @@ import {spec} from 'modules/pubmaticBidAdapter'; import * as utils from 'src/utils'; const constants = require('src/constants.json'); -describe('PubMatic adapter', () => { +describe('PubMatic adapter', function () { let bidRequests; let videoBidRequests; let multipleMediaRequests; let bidResponses; - beforeEach(() => { + beforeEach(function () { bidRequests = [ { bidder: 'pubmatic', @@ -155,9 +155,9 @@ describe('PubMatic adapter', () => { }; }); - describe('implementation', () => { - describe('Bid validations', () => { - it('valid bid case', () => { + describe('implementation', function () { + describe('Bid validations', function () { + it('valid bid case', function () { let validBid = { bidder: 'pubmatic', params: { @@ -169,7 +169,7 @@ describe('PubMatic adapter', () => { expect(isValid).to.equal(true); }); - it('invalid bid case: publisherId not passed', () => { + it('invalid bid case: publisherId not passed', function () { let validBid = { bidder: 'pubmatic', params: { @@ -180,7 +180,7 @@ describe('PubMatic adapter', () => { expect(isValid).to.equal(false); }); - it('invalid bid case: publisherId is not string', () => { + it('invalid bid case: publisherId is not string', function () { let validBid = { bidder: 'pubmatic', params: { @@ -192,7 +192,7 @@ describe('PubMatic adapter', () => { expect(isValid).to.equal(false); }); - it('invalid bid case: adSlot not passed', () => { + it('invalid bid case: adSlot not passed', function () { let validBid = { bidder: 'pubmatic', params: { @@ -203,7 +203,7 @@ describe('PubMatic adapter', () => { expect(isValid).to.equal(false); }); - it('invalid bid case: adSlot is not string', () => { + it('invalid bid case: adSlot is not string', function () { let validBid = { bidder: 'pubmatic', params: { @@ -216,14 +216,14 @@ describe('PubMatic adapter', () => { }); }); - describe('Request formation', () => { - it('Endpoint checking', () => { + describe('Request formation', function () { + it('Endpoint checking', function () { let request = spec.buildRequests(bidRequests); expect(request.url).to.equal('//hbopenbid.pubmatic.com/translator?source=prebid-client'); expect(request.method).to.equal('POST'); }); - it('Request params check', () => { + it('Request params check', function () { let request = spec.buildRequests(bidRequests); let data = JSON.parse(request.data); expect(data.at).to.equal(1); // auction type @@ -254,7 +254,7 @@ describe('PubMatic adapter', () => { expect(data.imp[0].bidfloorcur).to.equal(bidRequests[0].params.currency); }); - it('Request params multi size format object check', () => { + it('Request params multi size format object check', function () { let bidRequests = [ { bidder: 'pubmatic', @@ -309,7 +309,7 @@ describe('PubMatic adapter', () => { expect(data.imp[0].banner.format[0].h).to.equal(600); // height }); - it('Request params currency check', () => { + it('Request params currency check', function () { let multipleBidRequests = [ { bidder: 'pubmatic', @@ -406,7 +406,7 @@ describe('PubMatic adapter', () => { expect(data.imp[1].bidfloorcur).to.equal('USD'); }); - it('Request params check with GDPR Consent', () => { + it('Request params check with GDPR Consent', function () { let bidRequest = { gdprConsent: { consentString: 'kjfdniwjnifwenrif3', @@ -442,7 +442,7 @@ describe('PubMatic adapter', () => { expect(data.imp[0].ext.pmZoneId).to.equal(bidRequests[0].params.pmzoneid.split(',').slice(0, 50).map(id => id.trim()).join()); // pmzoneid }); - it('Request params check for video ad', () => { + it('Request params check for video ad', function () { let request = spec.buildRequests(videoBidRequests); let data = JSON.parse(request.data); expect(data.imp[0].video).to.exist; @@ -480,7 +480,7 @@ describe('PubMatic adapter', () => { expect(data.imp[0]['video']['h']).to.equal(videoBidRequests[0].mediaTypes.video.playerSize[1]); }); - it('Request params check for 1 banner and 1 video ad', () => { + it('Request params check for 1 banner and 1 video ad', function () { let request = spec.buildRequests(multipleMediaRequests); let data = JSON.parse(request.data); @@ -549,7 +549,7 @@ describe('PubMatic adapter', () => { }); }); - it('Request params dctr check', () => { + it('Request params dctr check', function () { let multipleBidRequests = [ { bidder: 'pubmatic', @@ -632,8 +632,8 @@ describe('PubMatic adapter', () => { expect(data.site.ext).to.not.exist; }); - describe('Response checking', () => { - it('should check for valid response values', () => { + describe('Response checking', function () { + it('should check for valid response values', function () { let request = spec.buildRequests(bidRequests); let response = spec.interpretResponse(bidResponses, request); expect(response).to.be.an('array').with.length.above(0); @@ -670,7 +670,7 @@ describe('PubMatic adapter', () => { expect(response[1].ad).to.equal(bidResponses.body.seatbid[1].bid[0].adm); }); - it('should check for dealChannel value selection', () => { + it('should check for dealChannel value selection', function () { let request = spec.buildRequests(bidRequests); let response = spec.interpretResponse(bidResponses, request); expect(response).to.be.an('array').with.length.above(0); @@ -678,7 +678,7 @@ describe('PubMatic adapter', () => { expect(response[1].dealChannel).to.equal('PREF'); }); - it('should check for unexpected dealChannel value selection', () => { + it('should check for unexpected dealChannel value selection', function () { let request = spec.buildRequests(bidRequests); let updateBiResponse = bidResponses; updateBiResponse.body.seatbid[0].bid[0].ext.deal_channel = 11; diff --git a/test/spec/modules/pubwiseAnalyticsAdapter_spec.js b/test/spec/modules/pubwiseAnalyticsAdapter_spec.js index ffb8d3c0570..e7e31fccc43 100644 --- a/test/spec/modules/pubwiseAnalyticsAdapter_spec.js +++ b/test/spec/modules/pubwiseAnalyticsAdapter_spec.js @@ -6,21 +6,21 @@ let constants = require('src/constants.json'); describe('PubWise Prebid Analytics', function () { let xhr; - before(() => { + before(function () { xhr = sinon.useFakeXMLHttpRequest(); }); - after(() => { + after(function () { xhr.restore(); pubwiseAnalytics.disableAnalytics(); }); describe('enableAnalytics', function () { - beforeEach(() => { + beforeEach(function () { sinon.stub(events, 'getEvents').returns([]); }); - afterEach(() => { + afterEach(function () { events.getEvents.restore(); }); diff --git a/test/spec/modules/pulsepointBidAdapter_spec.js b/test/spec/modules/pulsepointBidAdapter_spec.js index 709dbeb76a2..ebeedde7783 100644 --- a/test/spec/modules/pulsepointBidAdapter_spec.js +++ b/test/spec/modules/pulsepointBidAdapter_spec.js @@ -4,7 +4,7 @@ import {spec} from 'modules/pulsepointBidAdapter'; import {getTopWindowLocation} from 'src/utils'; import {newBidder} from 'src/adapters/bidderFactory'; -describe('PulsePoint Adapter Tests', () => { +describe('PulsePoint Adapter Tests', function () { const slotConfigs = [{ placementCode: '/DfpAccount1/slot1', bidId: 'bid12345', @@ -49,7 +49,7 @@ describe('PulsePoint Adapter Tests', () => { } }]; - it('Verify build request', () => { + it('Verify build request', function () { const request = spec.buildRequests(slotConfigs); expect(request.url).to.equal('//bid.contextweb.com/header/ortb'); expect(request.method).to.equal('POST'); @@ -76,7 +76,7 @@ describe('PulsePoint Adapter Tests', () => { expect(ortbRequest.imp[1].banner.h).to.equal(90); }); - it('Verify parse response', () => { + it('Verify parse response', function () { const request = spec.buildRequests(slotConfigs); const ortbRequest = JSON.parse(request.data); const ortbResponse = { @@ -104,7 +104,7 @@ describe('PulsePoint Adapter Tests', () => { expect(bid.ttl).to.equal(20); }); - it('Verify use ttl in ext', () => { + it('Verify use ttl in ext', function () { const request = spec.buildRequests(slotConfigs); const ortbRequest = JSON.parse(request.data); const ortbResponse = { @@ -130,13 +130,13 @@ describe('PulsePoint Adapter Tests', () => { expect(bid.currency).to.equal('INR'); }); - it('Verify full passback', () => { + it('Verify full passback', function () { const request = spec.buildRequests(slotConfigs); const bids = spec.interpretResponse({ body: null }, request) expect(bids).to.have.lengthOf(0); }); - it('Verify Native request', () => { + it('Verify Native request', function () { const request = spec.buildRequests(nativeSlotConfig); expect(request.url).to.equal('//bid.contextweb.com/header/ortb'); expect(request.method).to.equal('POST'); @@ -174,7 +174,7 @@ describe('PulsePoint Adapter Tests', () => { expect(nativeRequest.assets[2].img.type).to.equal(3); }); - it('Verify Native response', () => { + it('Verify Native response', function () { const request = spec.buildRequests(nativeSlotConfig); expect(request.url).to.equal('//bid.contextweb.com/header/ortb'); expect(request.method).to.equal('POST'); @@ -217,22 +217,22 @@ describe('PulsePoint Adapter Tests', () => { expect(nativeBid.impressionTrackers[1]).to.equal('http://imp1.contextweb.com/'); }); - it('Verifies bidder code', () => { + it('Verifies bidder code', function () { expect(spec.code).to.equal('pulsepoint'); }); - it('Verifies bidder aliases', () => { + it('Verifies bidder aliases', function () { expect(spec.aliases).to.have.lengthOf(2); expect(spec.aliases[0]).to.equal('pulseLite'); expect(spec.aliases[1]).to.equal('pulsepointLite'); }); - it('Verifies supported media types', () => { + it('Verifies supported media types', function () { expect(spec.supportedMediaTypes).to.have.lengthOf(2); expect(spec.supportedMediaTypes[1]).to.equal('native'); }); - it('Verifies if bid request valid', () => { + it('Verifies if bid request valid', function () { expect(spec.isBidRequestValid(slotConfigs[0])).to.equal(true); expect(spec.isBidRequestValid(slotConfigs[1])).to.equal(true); expect(spec.isBidRequestValid(nativeSlotConfig[0])).to.equal(true); @@ -243,7 +243,7 @@ describe('PulsePoint Adapter Tests', () => { expect(spec.isBidRequestValid({ params: { ct: 123, cp: 234 } })).to.equal(true); }); - it('Verifies sync options', () => { + it('Verifies sync options', function () { expect(spec.getUserSyncs({})).to.be.undefined; expect(spec.getUserSyncs({ iframeEnabled: false })).to.be.undefined; const options = spec.getUserSyncs({ iframeEnabled: true }); @@ -253,7 +253,7 @@ describe('PulsePoint Adapter Tests', () => { expect(options[0].url).to.equal('//bh.contextweb.com/visitormatch'); }); - it('Verifies image pixel sync', () => { + it('Verifies image pixel sync', function () { const options = spec.getUserSyncs({ pixelEnabled: true }); expect(options).to.not.be.undefined; expect(options).to.have.lengthOf(1); @@ -261,7 +261,7 @@ describe('PulsePoint Adapter Tests', () => { expect(options[0].url).to.equal('//bh.contextweb.com/visitormatch/prebid'); }); - it('Verify app requests', () => { + it('Verify app requests', function () { const request = spec.buildRequests(appSlotConfig); const ortbRequest = JSON.parse(request.data); // site object @@ -274,7 +274,7 @@ describe('PulsePoint Adapter Tests', () => { expect(ortbRequest.app.domain).to.equal('pulsepoint.com'); }); - it('Verify GDPR', () => { + it('Verify GDPR', function () { const bidderRequest = { gdprConsent: { gdprApplies: true, diff --git a/test/spec/modules/quantcastBidAdapter_spec.js b/test/spec/modules/quantcastBidAdapter_spec.js index b6fc3f27f94..f5a7602c7ab 100644 --- a/test/spec/modules/quantcastBidAdapter_spec.js +++ b/test/spec/modules/quantcastBidAdapter_spec.js @@ -13,11 +13,11 @@ import { import { newBidder } from '../../../src/adapters/bidderFactory'; import { parse } from 'src/url'; -describe('Quantcast adapter', () => { +describe('Quantcast adapter', function () { const quantcastAdapter = newBidder(qcSpec); let bidRequest; - beforeEach(() => { + beforeEach(function () { bidRequest = { bidder: 'quantcast', bidId: '2f7b179d443f14', @@ -32,32 +32,32 @@ describe('Quantcast adapter', () => { }; }); - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(quantcastAdapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('`isBidRequestValid`', () => { - it('should return `false` when bid is not passed', () => { + describe('`isBidRequestValid`', function () { + it('should return `false` when bid is not passed', function () { expect(qcSpec.isBidRequestValid()).to.equal(false); }); - it('should return `false` when bid `mediaType` is `video`', () => { + it('should return `false` when bid `mediaType` is `video`', function () { const bidRequest = { mediaType: 'video' }; expect(qcSpec.isBidRequestValid(bidRequest)).to.equal(false); }); - it('should return `true` when bid contains required params', () => { + it('should return `true` when bid contains required params', function () { const bidRequest = { mediaType: 'banner' }; expect(qcSpec.isBidRequestValid(bidRequest)).to.equal(true); }); }); - describe('`buildRequests`', () => { - it('selects protocol and port', () => { + describe('`buildRequests`', function () { + it('selects protocol and port', function () { switch (window.location.protocol) { case 'https:': expect(QUANTCAST_PROTOCOL).to.equal('https'); @@ -70,13 +70,13 @@ describe('Quantcast adapter', () => { } }); - it('sends bid requests to Quantcast Canary Endpoint if `publisherId` is `test-publisher`', () => { + it('sends bid requests to Quantcast Canary Endpoint if `publisherId` is `test-publisher`', function () { const requests = qcSpec.buildRequests([bidRequest]); const url = parse(requests[0]['url']); expect(url.hostname).to.equal(QUANTCAST_TEST_DOMAIN); }); - it('sends bid requests to default endpoint for non standard publisher IDs', () => { + it('sends bid requests to default endpoint for non standard publisher IDs', function () { const modifiedBidRequest = Object.assign({}, bidRequest, { params: Object.assign({}, bidRequest.params, { publisherId: 'foo-bar', @@ -88,13 +88,13 @@ describe('Quantcast adapter', () => { ); }); - it('sends bid requests to Quantcast Header Bidding Endpoints via POST', () => { + it('sends bid requests to Quantcast Header Bidding Endpoints via POST', function () { const requests = qcSpec.buildRequests([bidRequest]); expect(requests[0].method).to.equal('POST'); }); - it('sends bid requests contains all the required parameters', () => { + it('sends bid requests contains all the required parameters', function () { const referrer = utils.getTopWindowUrl(); const loc = utils.getTopWindowLocation(); const domain = loc.hostname; @@ -126,7 +126,7 @@ describe('Quantcast adapter', () => { }); }); - it('propagates GDPR consent string and signal', () => { + it('propagates GDPR consent string and signal', function () { const gdprConsent = { gdprApplies: true, consentString: 'consentString' } const requests = qcSpec.buildRequests([bidRequest], { gdprConsent }); const parsed = JSON.parse(requests[0].data) @@ -134,7 +134,7 @@ describe('Quantcast adapter', () => { expect(parsed.gdprConsent).to.equal(gdprConsent.consentString); }); - describe('`interpretResponse`', () => { + describe('`interpretResponse`', function () { // The sample response is from https://wiki.corp.qc/display/adinf/QCX const body = { bidderCode: 'qcx', // Renaming it to use CamelCase since that is what is used in the Prebid.js variable name @@ -159,25 +159,25 @@ describe('Quantcast adapter', () => { headers: {} }; - it('should return an empty array if `serverResponse` is `undefined`', () => { + it('should return an empty array if `serverResponse` is `undefined`', function () { const interpretedResponse = qcSpec.interpretResponse(); expect(interpretedResponse.length).to.equal(0); }); - it('should return an empty array if the parsed response does NOT include `bids`', () => { + it('should return an empty array if the parsed response does NOT include `bids`', function () { const interpretedResponse = qcSpec.interpretResponse({}); expect(interpretedResponse.length).to.equal(0); }); - it('should return an empty array if the parsed response has an empty `bids`', () => { + it('should return an empty array if the parsed response has an empty `bids`', function () { const interpretedResponse = qcSpec.interpretResponse({ bids: [] }); expect(interpretedResponse.length).to.equal(0); }); - it('should get correct bid response', () => { + it('should get correct bid response', function () { const expectedResponse = { requestId: 'erlangcluster@qa-rtb002.us-ec.adtech.com-11417780270886458', cpm: 4.5, @@ -195,7 +195,7 @@ describe('Quantcast adapter', () => { expect(interpretedResponse[0]).to.deep.equal(expectedResponse); }); - it('handles no bid response', () => { + it('handles no bid response', function () { const body = { bidderCode: 'qcx', // Renaming it to use CamelCase since that is what is used in the Prebid.js variable name requestId: 'erlangcluster@qa-rtb002.us-ec.adtech.com-11417780270886458', // Added this field. This is not used now but could be useful in troubleshooting later on. Specially for sites using iFrames diff --git a/test/spec/modules/quantumBidAdapter_spec.js b/test/spec/modules/quantumBidAdapter_spec.js index f45b9ed37e7..d14d24ebfe1 100644 --- a/test/spec/modules/quantumBidAdapter_spec.js +++ b/test/spec/modules/quantumBidAdapter_spec.js @@ -203,38 +203,38 @@ const nativeServerResponse = { ] } -describe('quantumBidAdapter', () => { +describe('quantumBidAdapter', function () { const adapter = newBidder(spec) - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function') }) }) - describe('isBidRequestValid', () => { - it('should return true when required params found', () => { + describe('isBidRequestValid', function () { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(REQUEST)).to.equal(true) }) - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let bid = Object.assign({}, REQUEST) delete bid.params expect(spec.isBidRequestValid(bid)).to.equal(false) }) }) - describe('buildRequests', () => { + describe('buildRequests', function () { let bidRequests = [REQUEST] const request = spec.buildRequests(bidRequests, {}) - it('sends bid request to ENDPOINT via GET', () => { + it('sends bid request to ENDPOINT via GET', function () { expect(request[0].method).to.equal('GET') }) }) - describe('GDPR conformity', () => { + describe('GDPR conformity', function () { const bidRequests = [{ 'bidder': 'quantum', 'mediaType': 'native', @@ -256,7 +256,7 @@ describe('quantumBidAdapter', () => { } }; - it('should transmit correct data', () => { + it('should transmit correct data', function () { const requests = spec.buildRequests(bidRequests, bidderRequest); expect(requests.length).to.equal(1); expect(requests[0].data.quantx_gdpr).to.equal(1); @@ -264,7 +264,7 @@ describe('quantumBidAdapter', () => { }); }); - describe('GDPR absence conformity', () => { + describe('GDPR absence conformity', function () { const bidRequests = [{ 'bidder': 'quantum', 'mediaType': 'native', @@ -283,7 +283,7 @@ describe('quantumBidAdapter', () => { gdprConsent: undefined }; - it('should transmit correct data', () => { + it('should transmit correct data', function () { const requests = spec.buildRequests(bidRequests, bidderRequest); expect(requests.length).to.equal(1); expect(requests[0].data.quantx_gdpr).to.be.undefined; @@ -291,13 +291,13 @@ describe('quantumBidAdapter', () => { }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { let bidderRequest = { bidderCode: 'bidderCode', bids: [] } - it('handles native request : should get correct bid response', () => { + it('handles native request : should get correct bid response', function () { const result = spec.interpretResponse({body: nativeServerResponse}, NATIVE_REQUEST) expect(result[0]).to.have.property('cpm').equal(0.3) expect(result[0]).to.have.property('width').to.be.below(2) @@ -306,7 +306,7 @@ describe('quantumBidAdapter', () => { expect(result[0]).to.have.property('native') }) - it('should get correct bid response', () => { + it('should get correct bid response', function () { const result = spec.interpretResponse({body: serverResponse}, REQUEST) expect(result[0]).to.have.property('cpm').equal(0.3) expect(result[0]).to.have.property('width').equal(300) @@ -315,7 +315,7 @@ describe('quantumBidAdapter', () => { expect(result[0]).to.have.property('ad') }) - it('handles nobid responses', () => { + it('handles nobid responses', function () { const nobidServerResponse = {bids: []} const nobidResult = spec.interpretResponse({body: nobidServerResponse}, bidderRequest) // console.log(nobidResult) diff --git a/test/spec/modules/readpeakBidAdapter_spec.js b/test/spec/modules/readpeakBidAdapter_spec.js index 776261c8db2..572c2b73f8c 100644 --- a/test/spec/modules/readpeakBidAdapter_spec.js +++ b/test/spec/modules/readpeakBidAdapter_spec.js @@ -2,12 +2,12 @@ import { expect } from 'chai'; import { spec, ENDPOINT } from 'modules/readpeakBidAdapter'; import * as utils from 'src/utils'; -describe('ReadPeakAdapter', () => { +describe('ReadPeakAdapter', function () { let bidRequest let serverResponse let serverRequest - beforeEach(() => { + beforeEach(function () { bidRequest = { bidder: 'readpeak', nativeParams: { @@ -113,42 +113,42 @@ describe('ReadPeakAdapter', () => { } }); - describe('spec.isBidRequestValid', () => { - it('should return true when the required params are passed', () => { + describe('spec.isBidRequestValid', function () { + it('should return true when the required params are passed', function () { expect(spec.isBidRequestValid(bidRequest)).to.equal(true); }); - it('should return false when the native params are missing', () => { + it('should return false when the native params are missing', function () { bidRequest.nativeParams = undefined; expect(spec.isBidRequestValid(bidRequest)).to.equal(false); }); - it('should return false when the "publisherId" param is missing', () => { + it('should return false when the "publisherId" param is missing', function () { bidRequest.params = { bidfloor: 5.00 }; expect(spec.isBidRequestValid(bidRequest)).to.equal(false); }); - it('should return false when no bid params are passed', () => { + it('should return false when no bid params are passed', function () { bidRequest.params = {}; expect(spec.isBidRequestValid(bidRequest)).to.equal(false); }); - it('should return false when a bid request is not passed', () => { + it('should return false when a bid request is not passed', function () { expect(spec.isBidRequestValid()).to.equal(false); expect(spec.isBidRequestValid({})).to.equal(false); }); }); - describe('spec.buildRequests', () => { - it('should create a POST request for every bid', () => { + describe('spec.buildRequests', function () { + it('should create a POST request for every bid', function () { const request = spec.buildRequests([ bidRequest ]); expect(request.method).to.equal('POST'); expect(request.url).to.equal(ENDPOINT); }); - it('should attach request data', () => { + it('should attach request data', function () { const request = spec.buildRequests([ bidRequest ]); const data = JSON.parse(request.data); @@ -171,13 +171,13 @@ describe('ReadPeakAdapter', () => { }); }); - describe('spec.interpretResponse', () => { - it('should return no bids if the response is not valid', () => { + describe('spec.interpretResponse', function () { + it('should return no bids if the response is not valid', function () { const bidResponse = spec.interpretResponse({ body: null }, serverRequest); expect(bidResponse.length).to.equal(0); }); - it('should return a valid bid response', () => { + it('should return a valid bid response', function () { const bidResponse = spec.interpretResponse({ body: serverResponse }, serverRequest)[0]; expect(bidResponse).to.contain({ requestId: bidRequest.bidId, diff --git a/test/spec/modules/realvuAnalyticsAdapter_spec.js b/test/spec/modules/realvuAnalyticsAdapter_spec.js index 7bb43002939..1d0fcf9be1a 100644 --- a/test/spec/modules/realvuAnalyticsAdapter_spec.js +++ b/test/spec/modules/realvuAnalyticsAdapter_spec.js @@ -22,19 +22,19 @@ function addDiv(id) { return dv; } -describe('RealVu Analytics Adapter.', () => { - before(() => { +describe('RealVu Analytics Adapter.', function () { + before(function () { addDiv('ad1'); addDiv('ad2'); }); - after(() => { + after(function () { let a1 = document.getElementById('ad1'); document.body.removeChild(a1); let a2 = document.getElementById('ad2'); document.body.removeChild(a2); }); - it('enableAnalytics', () => { + it('enableAnalytics', function () { const config = { options: { partnerId: '1Y', @@ -46,7 +46,7 @@ describe('RealVu Analytics Adapter.', () => { expect(p).to.equal('1Y'); }); - it('checkIn', () => { + it('checkIn', function () { const bid = { adUnitCode: 'ad1', sizes: [ @@ -71,13 +71,13 @@ describe('RealVu Analytics Adapter.', () => { expect(inview).to.equal('yes'); }); - it('isInView return "NA"', () => { + it('isInView return "NA"', function () { const adUnitCode = '1234'; let result = realvuAnalyticsAdapter.isInView(adUnitCode); expect(result).to.equal('NA'); }); - it('bid response event', () => { + it('bid response event', function () { const config = { options: { partnerId: '1Y', @@ -112,12 +112,12 @@ describe('RealVu Analytics Adapter.', () => { }); }); -describe('RealVu Boost.', () => { - before(() => { +describe('RealVu Boost.', function () { + before(function () { addDiv('ad1'); addDiv('ad2'); }); - after(() => { + after(function () { let a1 = document.getElementById('ad1'); document.body.removeChild(a1); let a2 = document.getElementById('ad2'); @@ -126,25 +126,25 @@ describe('RealVu Boost.', () => { const boost = window.top1.realvu_aa; - it('brd', () => { + it('brd', function () { let a1 = document.getElementById('ad1'); let p = boost.brd(a1, 'Left'); expect(typeof p).to.not.equal('undefined'); }); - it('addUnitById', () => { + it('addUnitById', function () { let a1 = document.getElementById('ad1'); let p = boost.addUnitById('1Y', 'ad1'); expect(typeof p).to.not.equal('undefined'); }); - it('questA', () => { + it('questA', function () { const dv = document.getElementById('ad1'); let q = boost.questA(dv); expect(q).to.not.equal(null); }); - it('render', () => { + it('render', function () { let dv = document.getElementById('ad1'); // dv.style.width = '728px'; // dv.style.height = '90px'; @@ -155,7 +155,7 @@ describe('RealVu Boost.', () => { expect(q).to.not.equal(null); }); - it('readPos', () => { + it('readPos', function () { const a = boost.ads[boost.len - 1]; let r = boost.readPos(a); expect(r).to.equal(true); diff --git a/test/spec/modules/rhythmoneBidAdapter_spec.js b/test/spec/modules/rhythmoneBidAdapter_spec.js index dd7ce4c379d..2f06e7f8288 100644 --- a/test/spec/modules/rhythmoneBidAdapter_spec.js +++ b/test/spec/modules/rhythmoneBidAdapter_spec.js @@ -61,7 +61,7 @@ describe('rhythmone adapter tests', function () { assert.equal(mangoRequest.length, 1); }); - it('should send GDPR Consent data to RhythmOne tag', () => { + it('should send GDPR Consent data to RhythmOne tag', function () { let _consentString = 'testConsentString'; var request = z.buildRequests( [ diff --git a/test/spec/modules/rockyouBidAdapter_spec.js b/test/spec/modules/rockyouBidAdapter_spec.js index f929b50d581..65d87566c26 100644 --- a/test/spec/modules/rockyouBidAdapter_spec.js +++ b/test/spec/modules/rockyouBidAdapter_spec.js @@ -2,16 +2,16 @@ import { expect } from 'chai'; import { spec, internals } from 'modules/rockyouBidAdapter'; import { newBidder } from 'src/adapters/bidderFactory'; -describe('RockYouAdapter', () => { +describe('RockYouAdapter', function () { const adapter = newBidder(spec); - describe('bid validator', () => { - it('rejects a bid that is missing the placementId', () => { + describe('bid validator', function () { + it('rejects a bid that is missing the placementId', function () { let testBid = {}; expect(spec.isBidRequestValid(testBid)).to.be.false; }); - it('accepts a bid with all the expected parameters', () => { + it('accepts a bid with all the expected parameters', function () { let testBid = { params: { placementId: 'f39ba81609' @@ -22,7 +22,7 @@ describe('RockYouAdapter', () => { }); }); - describe('request builder', () => { + describe('request builder', function () { // Taken from the docs, so used as much as is valid const sampleBidRequest = { 'bidder': 'tests', @@ -43,7 +43,7 @@ describe('RockYouAdapter', () => { } }; - it('successfully generates a URL', () => { + it('successfully generates a URL', function () { const placementId = 'ZZZPLACEMENTZZZ'; let bidRequests = [ @@ -65,7 +65,7 @@ describe('RockYouAdapter', () => { expect(result.url).to.include('/servlet/rotator/' + placementId + '/0/vo?z=') }); - it('uses the bidId id as the openRtb request ID', () => { + it('uses the bidId id as the openRtb request ID', function () { const bidId = '51ef8751f9aead'; let bidRequests = [ @@ -84,7 +84,7 @@ describe('RockYouAdapter', () => { expect(payload.id).to.equal(bidId); }); - it('generates the device payload as expected', () => { + it('generates the device payload as expected', function () { let bidRequests = [ sampleBidRequest ]; @@ -103,7 +103,7 @@ describe('RockYouAdapter', () => { expect(userData).to.not.be.null; }); - it('generates multiple requests with single imp bodies', () => { + it('generates multiple requests with single imp bodies', function () { const SECOND_PLACEMENT_ID = 'YYYPLACEMENTIDYYY'; let firstBidRequest = JSON.parse(JSON.stringify(sampleBidRequest)); let secondBidRequest = JSON.parse(JSON.stringify(sampleBidRequest)); @@ -146,7 +146,7 @@ describe('RockYouAdapter', () => { expect(secondRequest.url.indexOf(SECOND_PLACEMENT_ID)).to.be.gt(0); }); - it('generates a banner request as expected', () => { + it('generates a banner request as expected', function () { // clone the sample for stability let localBidRequest = JSON.parse(JSON.stringify(sampleBidRequest)); @@ -172,7 +172,7 @@ describe('RockYouAdapter', () => { expect(bannerData.h).to.equal(50); }); - it('generates a banner request using a singular adSize instead of an array', () => { + it('generates a banner request using a singular adSize instead of an array', function () { // clone the sample for stability let localBidRequest = JSON.parse(JSON.stringify(sampleBidRequest)); localBidRequest.sizes = [320, 50]; @@ -200,7 +200,7 @@ describe('RockYouAdapter', () => { expect(bannerData.h).to.equal(50); }); - it('fails gracefully on an invalid size', () => { + it('fails gracefully on an invalid size', function () { // clone the sample for stability let localBidRequest = JSON.parse(JSON.stringify(sampleBidRequest)); localBidRequest.sizes = ['x', 'w']; @@ -229,7 +229,7 @@ describe('RockYouAdapter', () => { expect(bannerData.h).to.equal(null); }); - it('generates a video request as expected', () => { + it('generates a video request as expected', function () { // clone the sample for stability let localBidRequest = JSON.parse(JSON.stringify(sampleBidRequest)); @@ -259,7 +259,7 @@ describe('RockYouAdapter', () => { expect(videoData.h).to.equal(56); }); - it('propagates the mediaTypes object in the built request', () => { + it('propagates the mediaTypes object in the built request', function () { let localBidRequest = JSON.parse(JSON.stringify(sampleBidRequest)); localBidRequest.mediaTypes = { video: {} }; @@ -278,8 +278,8 @@ describe('RockYouAdapter', () => { }); }); - describe('response interpreter', () => { - it('returns an empty array when no bids present', () => { + describe('response interpreter', function () { + it('returns an empty array when no bids present', function () { // an empty JSON body indicates no ad was found let result = spec.interpretResponse({ body: '' }, {}) @@ -287,13 +287,13 @@ describe('RockYouAdapter', () => { expect(result).to.eql([]); }); - it('gracefully fails when a non-JSON body is present', () => { + it('gracefully fails when a non-JSON body is present', function () { let result = spec.interpretResponse({ body: 'THIS IS NOT ' }, {}) expect(result).to.eql([]); }); - it('returns a valid bid response on sucessful banner request', () => { + it('returns a valid bid response on sucessful banner request', function () { let incomingRequestId = 'XXtestingXX'; let responsePrice = 3.14 @@ -365,7 +365,7 @@ describe('RockYouAdapter', () => { expect(processedBid.currency).to.equal(responseCurrency); }); - it('returns an valid bid response on sucessful video request', () => { + it('returns an valid bid response on sucessful video request', function () { let incomingRequestId = 'XXtesting-275XX'; let responsePrice = 6 @@ -438,7 +438,7 @@ describe('RockYouAdapter', () => { expect(processedBid.vastXml).to.equal(responseCreative); }); - it('generates event callbacks as expected', () => { + it('generates event callbacks as expected', function () { let tally = {}; let renderer = { handleVideoEvent: (eventObject) => { @@ -466,7 +466,7 @@ describe('RockYouAdapter', () => { expect(tally['ended']).to.equal(2); }); - it('generates a renderer that will hide on complete', () => { + it('generates a renderer that will hide on complete', function () { let elementName = 'test_element_id'; let selector = `#${elementName}`; diff --git a/test/spec/modules/roxotAnalyticsAdapter_spec.js b/test/spec/modules/roxotAnalyticsAdapter_spec.js index 9a80d2d0597..cd48cb7f37d 100644 --- a/test/spec/modules/roxotAnalyticsAdapter_spec.js +++ b/test/spec/modules/roxotAnalyticsAdapter_spec.js @@ -161,20 +161,20 @@ describe('Roxot Prebid Analytic', function () { let bidderDone = bidRequested; let bidWon = bidAdjustmentWithBid; - before(() => { + before(function () { xhr = sinon.useFakeXMLHttpRequest(); xhr.onCreate = request => requests.push(request); }); - after(() => { + after(function () { xhr.restore(); }); describe('correct build and send events', function () { - beforeEach(() => { + beforeEach(function () { requests = []; sinon.stub(events, 'getEvents').returns([]); }); - afterEach(() => { + afterEach(function () { roxotAnalytic.disableAnalytics(); events.getEvents.restore(); }); @@ -249,11 +249,11 @@ describe('Roxot Prebid Analytic', function () { }); describe('support ad unit filter', function () { - beforeEach(() => { + beforeEach(function () { requests = []; sinon.stub(events, 'getEvents').returns([]); }); - afterEach(() => { + afterEach(function () { roxotAnalytic.disableAnalytics(); events.getEvents.restore(); }); @@ -297,12 +297,12 @@ describe('Roxot Prebid Analytic', function () { }); describe('should correct parse config', function () { - beforeEach(() => { + beforeEach(function () { requests = []; sinon.stub(events, 'getEvents').returns([]); }); - afterEach(() => { + afterEach(function () { roxotAnalytic.disableAnalytics(); events.getEvents.restore(); }); @@ -427,8 +427,8 @@ describe('Roxot Prebid Analytic', function () { }); }); - describe('build utm tag data', () => { - beforeEach(() => { + describe('build utm tag data', function () { + beforeEach(function () { localStorage.setItem('roxot_analytics_utm_source', 'utm_source'); localStorage.setItem('roxot_analytics_utm_medium', 'utm_medium'); localStorage.setItem('roxot_analytics_utm_campaign', ''); @@ -436,7 +436,7 @@ describe('Roxot Prebid Analytic', function () { localStorage.setItem('roxot_analytics_utm_content', ''); localStorage.setItem('roxot_analytics_utm_ttl', Date.now()); }); - afterEach(() => { + afterEach(function () { localStorage.removeItem('roxot_analytics_utm_source'); localStorage.removeItem('roxot_analytics_utm_medium'); localStorage.removeItem('roxot_analytics_utm_campaign'); @@ -444,7 +444,7 @@ describe('Roxot Prebid Analytic', function () { localStorage.removeItem('roxot_analytics_utm_content'); localStorage.removeItem('roxot_analytics_utm_ttl'); }); - it('should build utm data from local storage', () => { + it('should build utm data from local storage', function () { let utmTagData = roxotAnalytic.buildUtmTagData(); expect(utmTagData.utm_source).to.equal('utm_source'); expect(utmTagData.utm_medium).to.equal('utm_medium'); diff --git a/test/spec/modules/rtbdemandBidAdapter_spec.js b/test/spec/modules/rtbdemandBidAdapter_spec.js index 20d3e410aee..25178c21d88 100644 --- a/test/spec/modules/rtbdemandBidAdapter_spec.js +++ b/test/spec/modules/rtbdemandBidAdapter_spec.js @@ -2,16 +2,16 @@ import { expect } from 'chai'; import { spec } from 'modules/rtbdemandBidAdapter'; import { newBidder } from 'src/adapters/bidderFactory'; -describe('rtbdemandAdapter', () => { +describe('rtbdemandAdapter', function () { const adapter = newBidder(spec); - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { 'bidder': 'rtbdemand', 'params': { @@ -26,11 +26,11 @@ describe('rtbdemandAdapter', () => { 'auctionId': '1d1a030790a475', }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return true when required params found', () => { + it('should return true when required params found', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -39,7 +39,7 @@ describe('rtbdemandAdapter', () => { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -49,7 +49,7 @@ describe('rtbdemandAdapter', () => { }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let bidderRequest = { bidderCode: 'rtbdemand', auctionId: 'c45dd708-a418-42ec-b8a7-b70a6c6fab0a', @@ -89,7 +89,7 @@ describe('rtbdemandAdapter', () => { timeout: 5000 }; - it('should add source and verison to the tag', () => { + it('should add source and verison to the tag', function () { const [request] = spec.buildRequests(bidderRequest.bids, bidderRequest); const payload = request.data; expect(payload.from).to.exist; @@ -106,14 +106,14 @@ describe('rtbdemandAdapter', () => { expect(payload.tmax).to.exist; }); - it('sends bid request to ENDPOINT via GET', () => { + it('sends bid request to ENDPOINT via GET', function () { const [request] = spec.buildRequests(bidderRequest.bids, bidderRequest); expect(request.url).to.equal('//bidding.rtbdemand.com/hb'); expect(request.method).to.equal('GET'); }); }) - describe('interpretResponse', () => { + describe('interpretResponse', function () { let response = { 'id': '543210', 'seatbid': [ { @@ -128,7 +128,7 @@ describe('rtbdemandAdapter', () => { } ] }; - it('should get correct bid response', () => { + it('should get correct bid response', function () { let expectedResponse = [ { requestId: 'bidId-123456-1', @@ -147,7 +147,7 @@ describe('rtbdemandAdapter', () => { expect(Object.keys(result[0])).to.deep.equal(Object.keys(expectedResponse[0])); }); - it('handles nobid responses', () => { + it('handles nobid responses', function () { let response = { 'id': '543210', 'seatbid': [ ] @@ -158,10 +158,10 @@ describe('rtbdemandAdapter', () => { }); }); - describe('user sync', () => { + describe('user sync', function () { const syncUrl = '//bidding.rtbdemand.com/delivery/matches.php?type=iframe'; - it('should register the sync iframe', () => { + it('should register the sync iframe', function () { expect(spec.getUserSyncs({})).to.be.undefined; expect(spec.getUserSyncs({iframeEnabled: false})).to.be.undefined; const options = spec.getUserSyncs({iframeEnabled: true}); diff --git a/test/spec/modules/rtbdemandadkBidAdapter_spec.js b/test/spec/modules/rtbdemandadkBidAdapter_spec.js index 8e49c2b85da..c1fbd35d6c9 100644 --- a/test/spec/modules/rtbdemandadkBidAdapter_spec.js +++ b/test/spec/modules/rtbdemandadkBidAdapter_spec.js @@ -2,7 +2,7 @@ import {expect} from 'chai'; import {spec} from 'modules/rtbdemandadkBidAdapter'; import * as utils from 'src/utils'; -describe('rtbdemandadk adapter', () => { +describe('rtbdemandadk adapter', function () { const bid1_zone1 = { bidder: 'rtbdemandadk', bidId: 'Bid_01', @@ -107,29 +107,29 @@ describe('rtbdemandadk adapter', () => { } }; - describe('input parameters validation', () => { - it('empty request shouldn\'t generate exception', () => { + describe('input parameters validation', function () { + it('empty request shouldn\'t generate exception', function () { expect(spec.isBidRequestValid({ bidderCode: 'rtbdemandadk' })).to.be.equal(false); }); - it('request without zone shouldn\'t issue a request', () => { + it('request without zone shouldn\'t issue a request', function () { expect(spec.isBidRequestValid(bid_without_zone)).to.be.equal(false); }); - it('request without host shouldn\'t issue a request', () => { + it('request without host shouldn\'t issue a request', function () { expect(spec.isBidRequestValid(bid_without_host)).to.be.equal(false); }); - it('empty request shouldn\'t generate exception', () => { + it('empty request shouldn\'t generate exception', function () { expect(spec.isBidRequestValid(bid_with_wrong_zoneId)).to.be.equal(false); }); }); - describe('banner request building', () => { + describe('banner request building', function () { let bidRequest; - before(() => { + before(function () { let wmock = sinon.stub(utils, 'getTopWindowLocation').callsFake(() => ({ protocol: 'https:', hostname: 'example.com', @@ -144,33 +144,33 @@ describe('rtbdemandadk adapter', () => { dntmock.restore(); }); - it('should be a first-price auction', () => { + it('should be a first-price auction', function () { expect(bidRequest).to.have.property('at', 1); }); - it('should have banner object', () => { + it('should have banner object', function () { expect(bidRequest.imp[0]).to.have.property('banner'); }); - it('should have w/h', () => { + it('should have w/h', function () { expect(bidRequest.imp[0].banner).to.have.property('format'); expect(bidRequest.imp[0].banner.format).to.be.eql([{w: 300, h: 250}, {w: 300, h: 200}]); }); - it('should respect secure connection', () => { + it('should respect secure connection', function () { expect(bidRequest.imp[0]).to.have.property('secure', 1); }); - it('should have tagid', () => { + it('should have tagid', function () { expect(bidRequest.imp[0]).to.have.property('tagid', 'ad-unit-1'); }); - it('should create proper site block', () => { + it('should create proper site block', function () { expect(bidRequest.site).to.have.property('domain', 'example.com'); expect(bidRequest.site).to.have.property('page', 'https://example.com/index.html'); }); - it('should fill device with caller macro', () => { + it('should fill device with caller macro', function () { expect(bidRequest).to.have.property('device'); expect(bidRequest.device).to.have.property('ip', 'caller'); expect(bidRequest.device).to.have.property('ua', 'caller'); @@ -178,37 +178,37 @@ describe('rtbdemandadk adapter', () => { }); }); - describe('video request building', () => { + describe('video request building', function () { let bidRequest; - before(() => { + before(function () { let request = spec.buildRequests([bid_video])[0]; bidRequest = JSON.parse(request.data.r); }); - it('should have video object', () => { + it('should have video object', function () { expect(bidRequest.imp[0]).to.have.property('video'); }); - it('should have h/w', () => { + it('should have h/w', function () { expect(bidRequest.imp[0].video).to.have.property('w', 640); expect(bidRequest.imp[0].video).to.have.property('h', 480); }); - it('should have tagid', () => { + it('should have tagid', function () { expect(bidRequest.imp[0]).to.have.property('tagid', 'ad-unit-1'); }); }); - describe('requests routing', () => { - it('should issue a request for each host', () => { + describe('requests routing', function () { + it('should issue a request for each host', function () { let pbRequests = spec.buildRequests([bid1_zone1, bid3_host2]); expect(pbRequests).to.have.length(2); expect(pbRequests[0].url).to.have.string(`//${bid1_zone1.params.host}/`); expect(pbRequests[1].url).to.have.string(`//${bid3_host2.params.host}/`); }); - it('should issue a request for each zone', () => { + it('should issue a request for each zone', function () { let pbRequests = spec.buildRequests([bid1_zone1, bid2_zone2]); expect(pbRequests).to.have.length(2); expect(pbRequests[0].data.zone).to.be.equal(bid1_zone1.params.zoneId); @@ -216,8 +216,8 @@ describe('rtbdemandadk adapter', () => { }); }); - describe('responses processing', () => { - it('should return fully-initialized banner bid-response', () => { + describe('responses processing', function () { + it('should return fully-initialized banner bid-response', function () { let request = spec.buildRequests([bid1_zone1])[0]; let resp = spec.interpretResponse({body: bidResponse1}, request)[0]; expect(resp).to.have.property('requestId', 'Bid_01'); @@ -232,7 +232,7 @@ describe('rtbdemandadk adapter', () => { expect(resp.ad).to.have.string(''); }); - it('should return fully-initialized video bid-response', () => { + it('should return fully-initialized video bid-response', function () { let request = spec.buildRequests([bid_video])[0]; let resp = spec.interpretResponse({body: videoBidResponse}, request)[0]; expect(resp).to.have.property('requestId', 'Bid_Video'); @@ -243,20 +243,20 @@ describe('rtbdemandadk adapter', () => { expect(resp.height).to.equal(480); }); - it('should add nurl as pixel for banner response', () => { + it('should add nurl as pixel for banner response', function () { let request = spec.buildRequests([bid1_zone1])[0]; let resp = spec.interpretResponse({body: bidResponse1}, request)[0]; let expectedNurl = bidResponse1.seatbid[0].bid[0].nurl + '&px=1'; expect(resp.ad).to.have.string(expectedNurl); }); - it('should handle bidresponse with user-sync only', () => { + it('should handle bidresponse with user-sync only', function () { let request = spec.buildRequests([bid1_zone1])[0]; let resp = spec.interpretResponse({body: usersyncOnlyResponse}, request); expect(resp).to.have.length(0); }); - it('should perform usersync', () => { + it('should perform usersync', function () { let syncs = spec.getUserSyncs({iframeEnabled: false}, [{body: bidResponse1}]); expect(syncs).to.have.length(0); syncs = spec.getUserSyncs({iframeEnabled: true}, [{body: bidResponse1}]); diff --git a/test/spec/modules/rtbhouseBidAdapter_spec.js b/test/spec/modules/rtbhouseBidAdapter_spec.js index 70f21d2c868..b1d20ebc203 100644 --- a/test/spec/modules/rtbhouseBidAdapter_spec.js +++ b/test/spec/modules/rtbhouseBidAdapter_spec.js @@ -17,16 +17,16 @@ function buildEndpointUrl(region) { * endof Helpers */ -describe('RTBHouseAdapter', () => { +describe('RTBHouseAdapter', function () { const adapter = newBidder(spec); - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { 'bidder': 'rtbhouse', 'params': { @@ -40,11 +40,11 @@ describe('RTBHouseAdapter', () => { 'auctionId': '1d1a030790a475' }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -54,7 +54,7 @@ describe('RTBHouseAdapter', () => { }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let bidRequests = [ { 'bidder': 'rtbhouse', @@ -71,12 +71,12 @@ describe('RTBHouseAdapter', () => { } ]; - it('should build test param into the request', () => { + it('should build test param into the request', function () { let builtTestRequest = spec.buildRequests(bidRequests).data; expect(JSON.parse(builtTestRequest).test).to.equal(1); }); - it('sends bid request to ENDPOINT via POST', () => { + it('sends bid request to ENDPOINT via POST', function () { let bidRequest = Object.assign([], bidRequests); delete bidRequest[0].params.test; const request = spec.buildRequests(bidRequest); @@ -84,7 +84,7 @@ describe('RTBHouseAdapter', () => { expect(request.method).to.equal('POST'); }); - it('should not populate GDPR if for non-EEA users', () => { + it('should not populate GDPR if for non-EEA users', function () { let bidRequest = Object.assign([], bidRequests); delete bidRequest[0].params.test; const request = spec.buildRequests(bidRequest); @@ -93,7 +93,7 @@ describe('RTBHouseAdapter', () => { expect(data).to.not.have.property('user'); }); - it('should populate GDPR and consent string if available for EEA users', () => { + it('should populate GDPR and consent string if available for EEA users', function () { let bidRequest = Object.assign([], bidRequests); delete bidRequest[0].params.test; const request = spec.buildRequests(bidRequest, {gdprConsent: {gdprApplies: true, consentString: consentStr}}); @@ -102,7 +102,7 @@ describe('RTBHouseAdapter', () => { expect(data.user.ext.consent).to.equal('BOJ8RZsOJ8RZsABAB8AAAAAZ-A'); }); - it('should populate GDPR and empty consent string if available for EEA users without consent string but with consent', () => { + it('should populate GDPR and empty consent string if available for EEA users without consent string but with consent', function () { let bidRequest = Object.assign([], bidRequests); delete bidRequest[0].params.test; const request = spec.buildRequests(bidRequest, {gdprConsent: {gdprApplies: true}}); @@ -112,7 +112,7 @@ describe('RTBHouseAdapter', () => { }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { let response = [{ 'id': 'bidder_imp_identifier', 'impid': '552b8922e28f27', @@ -125,7 +125,7 @@ describe('RTBHouseAdapter', () => { 'h': 250 }]; - it('should get correct bid response', () => { + it('should get correct bid response', function () { let expectedResponse = [ { 'requestId': '552b8922e28f27', @@ -145,7 +145,7 @@ describe('RTBHouseAdapter', () => { expect(Object.keys(result[0])).to.have.members(Object.keys(expectedResponse[0])); }); - it('handles nobid responses', () => { + it('handles nobid responses', function () { let response = ''; let bidderRequest; let result = spec.interpretResponse({ body: response }, {bidderRequest}); diff --git a/test/spec/modules/rubiconAnalyticsAdapter_spec.js b/test/spec/modules/rubiconAnalyticsAdapter_spec.js index 3af82a1fb62..fa64513730a 100644 --- a/test/spec/modules/rubiconAnalyticsAdapter_spec.js +++ b/test/spec/modules/rubiconAnalyticsAdapter_spec.js @@ -409,14 +409,14 @@ function performStandardAuction() { events.emit(BID_WON, MOCK.BID_WON[1]); } -describe('rubicon analytics adapter', () => { +describe('rubicon analytics adapter', function () { let sandbox; let xhr; let requests; let oldScreen; let clock; - beforeEach(() => { + beforeEach(function () { sandbox = sinon.sandbox.create(); xhr = sandbox.useFakeXMLHttpRequest(); @@ -437,12 +437,12 @@ describe('rubicon analytics adapter', () => { }) }); - afterEach(() => { + afterEach(function () { sandbox.restore(); config.resetConfig(); }); - it('should require accountId', () => { + it('should require accountId', function () { sandbox.stub(utils, 'logError'); rubiconAnalyticsAdapter.enableAnalytics({ @@ -454,7 +454,7 @@ describe('rubicon analytics adapter', () => { expect(utils.logError.called).to.equal(true); }); - it('should require endpoint', () => { + it('should require endpoint', function () { sandbox.stub(utils, 'logError'); rubiconAnalyticsAdapter.enableAnalytics({ @@ -466,18 +466,18 @@ describe('rubicon analytics adapter', () => { expect(utils.logError.called).to.equal(true); }); - describe('sampling', () => { - beforeEach(() => { + describe('sampling', function () { + beforeEach(function () { sandbox.stub(Math, 'random').returns(0.08); sandbox.stub(utils, 'logError'); }); - afterEach(() => { + afterEach(function () { rubiconAnalyticsAdapter.disableAnalytics(); }); - describe('with options.samplingFactor', () => { - it('should sample', () => { + describe('with options.samplingFactor', function () { + it('should sample', function () { rubiconAnalyticsAdapter.enableAnalytics({ options: { endpoint: '//localhost:9999/event', @@ -491,7 +491,7 @@ describe('rubicon analytics adapter', () => { expect(requests.length).to.equal(1); }); - it('should unsample', () => { + it('should unsample', function () { rubiconAnalyticsAdapter.enableAnalytics({ options: { endpoint: '//localhost:9999/event', @@ -505,7 +505,7 @@ describe('rubicon analytics adapter', () => { expect(requests.length).to.equal(0); }); - it('should throw errors for invalid samplingFactor', () => { + it('should throw errors for invalid samplingFactor', function () { rubiconAnalyticsAdapter.enableAnalytics({ options: { endpoint: '//localhost:9999/event', @@ -520,8 +520,8 @@ describe('rubicon analytics adapter', () => { expect(utils.logError.called).to.equal(true); }); }); - describe('with options.sampling', () => { - it('should sample', () => { + describe('with options.sampling', function () { + it('should sample', function () { rubiconAnalyticsAdapter.enableAnalytics({ options: { endpoint: '//localhost:9999/event', @@ -535,7 +535,7 @@ describe('rubicon analytics adapter', () => { expect(requests.length).to.equal(1); }); - it('should unsample', () => { + it('should unsample', function () { rubiconAnalyticsAdapter.enableAnalytics({ options: { endpoint: '//localhost:9999/event', @@ -549,7 +549,7 @@ describe('rubicon analytics adapter', () => { expect(requests.length).to.equal(0); }); - it('should throw errors for invalid samplingFactor', () => { + it('should throw errors for invalid samplingFactor', function () { rubiconAnalyticsAdapter.enableAnalytics({ options: { endpoint: '//localhost:9999/event', @@ -566,8 +566,8 @@ describe('rubicon analytics adapter', () => { }); }); - describe('when handling events', () => { - beforeEach(() => { + describe('when handling events', function () { + beforeEach(function () { rubiconAnalyticsAdapter.enableAnalytics({ options: { endpoint: '//localhost:9999/event', @@ -576,11 +576,11 @@ describe('rubicon analytics adapter', () => { }); }); - afterEach(() => { + afterEach(function () { rubiconAnalyticsAdapter.disableAnalytics(); }); - it('should build a batched message from prebid events', () => { + it('should build a batched message from prebid events', function () { performStandardAuction(); expect(requests.length).to.equal(1); @@ -594,7 +594,7 @@ describe('rubicon analytics adapter', () => { expect(message).to.deep.equal(ANALYTICS_MESSAGE); }); - it('should send batched message without BID_WON if necessary and further BID_WON events individually', () => { + it('should send batched message without BID_WON if necessary and further BID_WON events individually', function () { events.emit(AUCTION_INIT, MOCK.AUCTION_INIT); events.emit(BID_REQUESTED, MOCK.BID_REQUESTED); events.emit(BID_RESPONSE, MOCK.BID_RESPONSE[0]); @@ -623,7 +623,7 @@ describe('rubicon analytics adapter', () => { expect(message.bidsWon[0]).to.deep.equal(ANALYTICS_MESSAGE.bidsWon[1]); }); - it('should properly mark bids as timed out', () => { + it('should properly mark bids as timed out', function () { events.emit(AUCTION_INIT, MOCK.AUCTION_INIT); events.emit(BID_REQUESTED, MOCK.BID_REQUESTED); events.emit(BID_TIMEOUT, MOCK.BID_TIMEOUT); diff --git a/test/spec/modules/rubiconBidAdapter_spec.js b/test/spec/modules/rubiconBidAdapter_spec.js index c02a4c9f86c..3afb424c824 100644 --- a/test/spec/modules/rubiconBidAdapter_spec.js +++ b/test/spec/modules/rubiconBidAdapter_spec.js @@ -12,7 +12,7 @@ var CONSTANTS = require('src/constants.json'); const INTEGRATION = `pbjs_lite_v$prebid.version$`; // $prebid.version$ will be substituted in by gulp in built prebid -describe('the rubicon adapter', () => { +describe('the rubicon adapter', function () { let sandbox, bidderRequest, sizeMap; @@ -257,7 +257,7 @@ describe('the rubicon adapter', () => { }; } - beforeEach(() => { + beforeEach(function () { sandbox = sinon.sandbox.create(); bidderRequest = { @@ -327,17 +327,17 @@ describe('the rubicon adapter', () => { }); }); - afterEach(() => { + afterEach(function () { sandbox.restore(); }); - describe('MAS mapping / ordering', () => { - it('should sort values without any MAS priority sizes in regular ascending order', () => { + describe('MAS mapping / ordering', function () { + it('should sort values without any MAS priority sizes in regular ascending order', function () { let ordering = masSizeOrdering([126, 43, 65, 16]); expect(ordering).to.deep.equal([16, 43, 65, 126]); }); - it('should sort MAS priority sizes in the proper order w/ rest ascending', () => { + it('should sort MAS priority sizes in the proper order w/ rest ascending', function () { let ordering = masSizeOrdering([43, 9, 65, 15, 16, 126]); expect(ordering).to.deep.equal([15, 9, 16, 43, 65, 126]); @@ -349,10 +349,10 @@ describe('the rubicon adapter', () => { }); }); - describe('buildRequests implementation', () => { - describe('for requests', () => { - describe('to fastlane', () => { - it('should make a well-formed request objects', () => { + describe('buildRequests implementation', function () { + describe('for requests', function () { + describe('to fastlane', function () { + it('should make a well-formed request objects', function () { sandbox.stub(Math, 'random').callsFake(() => 0.1); let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest); let data = parseQuery(request.data); @@ -394,7 +394,7 @@ describe('the rubicon adapter', () => { }); }); - it('ad engine query params should be ordered correctly', () => { + it('ad engine query params should be ordered correctly', function () { sandbox.stub(Math, 'random').callsFake(() => 0.1); let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest); @@ -405,7 +405,7 @@ describe('the rubicon adapter', () => { }); }); - it('should make a well-formed request object without latLong', () => { + it('should make a well-formed request object without latLong', function () { let expectedQuery = { 'account_id': '14062', 'site_id': '70608', @@ -466,7 +466,7 @@ describe('the rubicon adapter', () => { }); }); - it('page_url should use params.referrer, config.getConfig("pageUrl"), utils.getTopWindowUrl() in that order', () => { + it('page_url should use params.referrer, config.getConfig("pageUrl"), utils.getTopWindowUrl() in that order', function () { sandbox.stub(utils, 'getTopWindowUrl').callsFake(() => 'http://www.prebid.org'); let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest); @@ -491,7 +491,7 @@ describe('the rubicon adapter', () => { expect(parseQuery(request.data).rf).to.equal('https://www.rubiconproject.com'); }); - it('should use rubicon sizes if present (including non-mappable sizes)', () => { + it('should use rubicon sizes if present (including non-mappable sizes)', function () { var sizesBidderRequest = clone(bidderRequest); sizesBidderRequest.bids[0].params.sizes = [55, 57, 59, 801]; @@ -502,7 +502,7 @@ describe('the rubicon adapter', () => { expect(data['alt_size_ids']).to.equal('57,59,801'); }); - it('should not validate bid request if no valid sizes', () => { + it('should not validate bid request if no valid sizes', function () { var sizesBidderRequest = clone(bidderRequest); sizesBidderRequest.bids[0].sizes = [[621, 250], [300, 251]]; @@ -511,7 +511,7 @@ describe('the rubicon adapter', () => { expect(result).to.equal(false); }); - it('should not validate bid request if no account id is present', () => { + it('should not validate bid request if no account id is present', function () { var noAccountBidderRequest = clone(bidderRequest); delete noAccountBidderRequest.bids[0].params.accountId; @@ -520,7 +520,7 @@ describe('the rubicon adapter', () => { expect(result).to.equal(false); }); - it('should allow a floor override', () => { + it('should allow a floor override', function () { var floorBidderRequest = clone(bidderRequest); floorBidderRequest.bids[0].params.floor = 2; @@ -530,7 +530,7 @@ describe('the rubicon adapter', () => { expect(data['rp_floor']).to.equal('2'); }); - it('should send digitrust params', () => { + it('should send digitrust params', function () { window.DigiTrust = { getUser: function () { } @@ -564,7 +564,7 @@ describe('the rubicon adapter', () => { delete window.DigiTrust; }); - it('should not send digitrust params when DigiTrust not loaded', () => { + it('should not send digitrust params when DigiTrust not loaded', function () { let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest); let data = parseQuery(request.data); @@ -576,7 +576,7 @@ describe('the rubicon adapter', () => { }); }); - it('should not send digitrust params due to optout', () => { + it('should not send digitrust params due to optout', function () { window.DigiTrust = { getUser: function () { } @@ -605,7 +605,7 @@ describe('the rubicon adapter', () => { delete window.DigiTrust; }); - it('should not send digitrust params due to failure', () => { + it('should not send digitrust params due to failure', function () { window.DigiTrust = { getUser: function () { } @@ -634,19 +634,19 @@ describe('the rubicon adapter', () => { delete window.DigiTrust; }); - describe('digiTrustId config', () => { + describe('digiTrustId config', function () { var origGetConfig; - beforeEach(() => { + beforeEach(function () { window.DigiTrust = { getUser: sandbox.spy() }; }); - afterEach(() => { + afterEach(function () { delete window.DigiTrust; }); - it('should send digiTrustId config params', () => { + it('should send digiTrustId config params', function () { sandbox.stub(config, 'getConfig').callsFake((key) => { var config = { digiTrustId: { @@ -679,7 +679,7 @@ describe('the rubicon adapter', () => { expect(window.DigiTrust.getUser.notCalled).to.equal(true); }); - it('should not send digiTrustId config params due to optout', () => { + it('should not send digiTrustId config params due to optout', function () { sandbox.stub(config, 'getConfig').callsFake((key) => { var config = { digiTrustId: { @@ -708,7 +708,7 @@ describe('the rubicon adapter', () => { expect(window.DigiTrust.getUser.notCalled).to.equal(true); }); - it('should not send digiTrustId config params due to failure', () => { + it('should not send digiTrustId config params due to failure', function () { sandbox.stub(config, 'getConfig').callsFake((key) => { var config = { digiTrustId: { @@ -737,7 +737,7 @@ describe('the rubicon adapter', () => { expect(window.DigiTrust.getUser.notCalled).to.equal(true); }); - it('should not send digiTrustId config params if they do not exist', () => { + it('should not send digiTrustId config params if they do not exist', function () { sandbox.stub(config, 'getConfig').callsFake((key) => { var config = {}; return config[key]; @@ -758,8 +758,8 @@ describe('the rubicon adapter', () => { }); }); - describe('GDPR consent config', () => { - it('should send "gdpr" and "gdpr_consent", when gdprConsent defines consentString and gdprApplies', () => { + describe('GDPR consent config', function () { + it('should send "gdpr" and "gdpr_consent", when gdprConsent defines consentString and gdprApplies', function () { createGdprBidderRequest(true); let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest); let data = parseQuery(request.data); @@ -768,7 +768,7 @@ describe('the rubicon adapter', () => { expect(data['gdpr_consent']).to.equal('BOJ/P2HOJ/P2HABABMAAAAAZ+A=='); }); - it('should send only "gdpr_consent", when gdprConsent defines only consentString', () => { + it('should send only "gdpr_consent", when gdprConsent defines only consentString', function () { createGdprBidderRequest(); let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest); let data = parseQuery(request.data); @@ -777,7 +777,7 @@ describe('the rubicon adapter', () => { expect(data['gdpr']).to.equal(undefined); }); - it('should not send GDPR params if gdprConsent is not defined', () => { + it('should not send GDPR params if gdprConsent is not defined', function () { let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest); let data = parseQuery(request.data); @@ -785,7 +785,7 @@ describe('the rubicon adapter', () => { expect(data['gdpr_consent']).to.equal(undefined); }); - it('should set "gdpr" value as 1 or 0, using "gdprApplies" value of either true/false', () => { + it('should set "gdpr" value as 1 or 0, using "gdprApplies" value of either true/false', function () { createGdprBidderRequest(true); let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest); let data = parseQuery(request.data); @@ -798,8 +798,8 @@ describe('the rubicon adapter', () => { }); }); - describe('singleRequest config', () => { - it('should group all bid requests with the same site id', () => { + describe('singleRequest config', function () { + it('should group all bid requests with the same site id', function () { sandbox.stub(Math, 'random').callsFake(() => 0.1); sandbox.stub(config, 'getConfig').callsFake((key) => { @@ -914,7 +914,7 @@ describe('the rubicon adapter', () => { }); }); - it('should not send more than 10 bids in a request', () => { + it('should not send more than 10 bids in a request', function () { sandbox.stub(config, 'getConfig').callsFake((key) => { const config = { 'rubicon.singleRequest': true @@ -945,7 +945,7 @@ describe('the rubicon adapter', () => { expect(data.zone_id.split(';')).to.have.lengthOf(10); }); - it('should not group bid requests if singleRequest does not equal true', () => { + it('should not group bid requests if singleRequest does not equal true', function () { sandbox.stub(config, 'getConfig').callsFake((key) => { const config = { 'rubicon.singleRequest': false @@ -968,7 +968,7 @@ describe('the rubicon adapter', () => { expect(serverRequests).that.is.an('array').of.length(4); }); - it('should not group video bid requests', () => { + it('should not group video bid requests', function () { sandbox.stub(config, 'getConfig').callsFake((key) => { const config = { 'rubicon.singleRequest': true @@ -1009,8 +1009,8 @@ describe('the rubicon adapter', () => { }); }); - describe('for video requests', () => { - it('should make a well-formed video request with legacy mediaType config', () => { + describe('for video requests', function () { + it('should make a well-formed video request with legacy mediaType config', function () { createLegacyVideoBidderRequest(); sandbox.stub(Date, 'now').callsFake(() => @@ -1074,7 +1074,7 @@ describe('the rubicon adapter', () => { expect(slot.visitor).to.have.property('likes').that.deep.equals(['sports', 'video games']); }); - it('should make a well-formed video request', () => { + it('should make a well-formed video request', function () { createVideoBidderRequest(); sandbox.stub(Date, 'now').callsFake(() => @@ -1138,7 +1138,7 @@ describe('the rubicon adapter', () => { expect(slot.visitor).to.have.property('likes').that.deep.equals(['sports', 'video games']); }); - it('should send request with proper ad position', () => { + it('should send request with proper ad position', function () { createVideoBidderRequest(); var positionBidderRequest = clone(bidderRequest); positionBidderRequest.bids[0].params.position = 'atf'; @@ -1182,7 +1182,7 @@ describe('the rubicon adapter', () => { expect(slot.position).to.equal('unknown'); }); - it('should allow a floor price override', () => { + it('should allow a floor price override', function () { createVideoBidderRequest(); sandbox.stub(Date, 'now').callsFake(() => @@ -1202,7 +1202,7 @@ describe('the rubicon adapter', () => { expect(floor).to.equal(3.25); }); - it('should validate bid request with invalid video if a mediaTypes banner property is defined', () => { + it('should validate bid request with invalid video if a mediaTypes banner property is defined', function () { const bidRequest = { mediaTypes: { video: { @@ -1226,7 +1226,7 @@ describe('the rubicon adapter', () => { expect(spec.isBidRequestValid(bidRequest)).to.equal(true); }); - it('should not validate bid request when a invalid video object and no banner object is passed in', () => { + it('should not validate bid request when a invalid video object and no banner object is passed in', function () { createVideoBidderRequestNoVideo(); sandbox.stub(Date, 'now').callsFake(() => bidderRequest.auctionStart + 100 @@ -1251,7 +1251,7 @@ describe('the rubicon adapter', () => { expect(spec.isBidRequestValid(bidRequestCopy)).to.equal(false); }); - it('should not validate bid request when an invalid video object is passed in with legacy config mediaType', () => { + it('should not validate bid request when an invalid video object is passed in with legacy config mediaType', function () { createLegacyVideoBidderRequestNoVideo(); sandbox.stub(Date, 'now').callsFake(() => bidderRequest.auctionStart + 100 @@ -1273,7 +1273,7 @@ describe('the rubicon adapter', () => { expect(spec.isBidRequestValid(bidderRequestCopy.bids[0])).to.equal(false); }); - it('bid request is valid when video context is outstream', () => { + it('bid request is valid when video context is outstream', function () { createVideoBidderRequestOutstream(); sandbox.stub(Date, 'now').callsFake(() => bidderRequest.auctionStart + 100 @@ -1286,7 +1286,7 @@ describe('the rubicon adapter', () => { expect(request.data.slots[0].size_id).to.equal(203); }); - it('should get size from bid.sizes too', () => { + it('should get size from bid.sizes too', function () { createVideoBidderRequestNoPlayer(); sandbox.stub(Date, 'now').callsFake(() => bidderRequest.auctionStart + 100 @@ -1300,7 +1300,7 @@ describe('the rubicon adapter', () => { expect(request.data.slots[0].height).to.equal(250); }); - it('should get size from bid.sizes too with legacy config mediaType', () => { + it('should get size from bid.sizes too with legacy config mediaType', function () { createLegacyVideoBidderRequestNoPlayer(); sandbox.stub(Date, 'now').callsFake(() => bidderRequest.auctionStart + 100 @@ -1315,8 +1315,8 @@ describe('the rubicon adapter', () => { }); }); - describe('combineSlotUrlParams', () => { - it('should combine an array of slot url params', () => { + describe('combineSlotUrlParams', function () { + it('should combine an array of slot url params', function () { expect(spec.combineSlotUrlParams([])).to.deep.equal({}); expect(spec.combineSlotUrlParams([{p1: 'foo', p2: 'test', p3: ''}])).to.deep.equal({p1: 'foo', p2: 'test', p3: ''}); @@ -1341,8 +1341,8 @@ describe('the rubicon adapter', () => { }); }); - describe('createSlotParams', () => { - it('should return a valid slot params object', () => { + describe('createSlotParams', function () { + it('should return a valid slot params object', function () { let expectedQuery = { 'account_id': '14062', 'site_id': '70608', @@ -1380,14 +1380,14 @@ describe('the rubicon adapter', () => { }); }); - describe('hasVideoMediaType', () => { - it('should return true if mediaType is video and size_id is set', () => { + describe('hasVideoMediaType', function () { + it('should return true if mediaType is video and size_id is set', function () { createVideoBidderRequest(); const legacyVideoTypeBidRequest = hasVideoMediaType(bidderRequest.bids[0]); expect(legacyVideoTypeBidRequest).is.equal(true); }); - it('should return false if mediaType is video and size_id is not defined', () => { + it('should return false if mediaType is video and size_id is not defined', function () { expect(spec.isBidRequestValid({ bid: 99, mediaType: 'video', @@ -1397,17 +1397,17 @@ describe('the rubicon adapter', () => { })).is.equal(false); }); - it('should return false if bidRequest.mediaType is not equal to video', () => { + it('should return false if bidRequest.mediaType is not equal to video', function () { expect(hasVideoMediaType({ mediaType: 'banner' })).is.equal(false); }); - it('should return false if bidRequest.mediaType is not defined', () => { + it('should return false if bidRequest.mediaType is not defined', function () { expect(hasVideoMediaType({})).is.equal(false); }); - it('should return true if bidRequest.mediaTypes.video.context is instream and size_id is defined', () => { + it('should return true if bidRequest.mediaTypes.video.context is instream and size_id is defined', function () { expect(hasVideoMediaType({ mediaTypes: { video: { @@ -1422,7 +1422,7 @@ describe('the rubicon adapter', () => { })).is.equal(true); }); - it('should return false if bidRequest.mediaTypes.video.context is instream but size_id is not defined', () => { + it('should return false if bidRequest.mediaTypes.video.context is instream but size_id is not defined', function () { expect(spec.isBidRequestValid({ mediaTypes: { video: { @@ -1437,9 +1437,9 @@ describe('the rubicon adapter', () => { }); }); - describe('interpretResponse', () => { - describe('for fastlane', () => { - it('should handle a success response and sort by cpm', () => { + describe('interpretResponse', function () { + describe('for fastlane', function () { + it('should handle a success response and sort by cpm', function () { let response = { 'status': 'ok', 'account_id': 14062, @@ -1534,7 +1534,7 @@ describe('the rubicon adapter', () => { expect(bids[1].rubiconTargeting.rpfl_14062).to.equal('15_tier_all_test'); }); - it('should be fine with a CPM of 0', () => { + it('should be fine with a CPM of 0', function () { let response = { 'status': 'ok', 'account_id': 14062, @@ -1561,7 +1561,7 @@ describe('the rubicon adapter', () => { expect(bids[0].cpm).to.be.equal(0); }); - it('should handle an error with no ads returned', () => { + it('should handle an error with no ads returned', function () { let response = { 'status': 'ok', 'account_id': 14062, @@ -1583,7 +1583,7 @@ describe('the rubicon adapter', () => { expect(bids).to.be.lengthOf(0); }); - it('should handle an error', () => { + it('should handle an error', function () { let response = { 'status': 'ok', 'account_id': 14062, @@ -1607,7 +1607,7 @@ describe('the rubicon adapter', () => { expect(bids).to.be.lengthOf(0); }); - it('should handle an error because of malformed json response', () => { + it('should handle an error because of malformed json response', function () { let response = '{test{'; let bids = spec.interpretResponse({body: response}, { @@ -1617,7 +1617,7 @@ describe('the rubicon adapter', () => { expect(bids).to.be.lengthOf(0); }); - it('should handle a bidRequest argument of type Array', () => { + it('should handle a bidRequest argument of type Array', function () { let response = { 'status': 'ok', 'account_id': 14062, @@ -1644,8 +1644,8 @@ describe('the rubicon adapter', () => { expect(bids[0].cpm).to.be.equal(0); }); - describe('singleRequest enabled', () => { - it('handles bidRequest of type Array and returns associated adUnits', () => { + describe('singleRequest enabled', function () { + it('handles bidRequest of type Array and returns associated adUnits', function () { const overrideMap = []; overrideMap[0] = { impression_id: '1' }; @@ -1700,7 +1700,7 @@ describe('the rubicon adapter', () => { }); }); - it('handles incorrect adUnits length by returning all bids with matching ads', () => { + it('handles incorrect adUnits length by returning all bids with matching ads', function () { const overrideMap = []; overrideMap[0] = { impression_id: '1' }; @@ -1730,7 +1730,7 @@ describe('the rubicon adapter', () => { expect(bids).to.be.a('array').with.lengthOf(6); }); - it('skips adUnits with error status and returns all bids with ok status', () => { + it('skips adUnits with error status and returns all bids with ok status', function () { const stubAds = []; // Create overrides to break associations between bids and ads // Each override should cause one less bid to be returned by interpretResponse @@ -1795,12 +1795,12 @@ describe('the rubicon adapter', () => { }); }); - describe('for video', () => { - beforeEach(() => { + describe('for video', function () { + beforeEach(function () { createVideoBidderRequest(); }); - it('should register a successful bid', () => { + it('should register a successful bid', function () { let response = { 'status': 'ok', 'ads': { @@ -1849,14 +1849,14 @@ describe('the rubicon adapter', () => { }); }); - describe('user sync', () => { + describe('user sync', function () { const emilyUrl = 'https://eus.rubiconproject.com/usync.html'; - beforeEach(() => { + beforeEach(function () { resetUserSync(); }); - it('should register the Emily iframe', () => { + it('should register the Emily iframe', function () { let syncs = spec.getUserSyncs({ iframeEnabled: true }); @@ -1864,7 +1864,7 @@ describe('the rubicon adapter', () => { expect(syncs).to.deep.equal({type: 'iframe', url: emilyUrl}); }); - it('should not register the Emily iframe more than once', () => { + it('should not register the Emily iframe more than once', function () { let syncs = spec.getUserSyncs({ iframeEnabled: true }); @@ -1875,7 +1875,7 @@ describe('the rubicon adapter', () => { expect(syncs).to.equal(undefined); }); - it('should pass gdpr params if consent is true', () => { + it('should pass gdpr params if consent is true', function () { expect(spec.getUserSyncs({ iframeEnabled: true }, {}, { gdprApplies: true, consentString: 'foo' })).to.deep.equal({ @@ -1883,7 +1883,7 @@ describe('the rubicon adapter', () => { }); }); - it('should pass gdpr params if consent is false', () => { + it('should pass gdpr params if consent is false', function () { expect(spec.getUserSyncs({ iframeEnabled: true }, {}, { gdprApplies: false, consentString: 'foo' })).to.deep.equal({ @@ -1891,7 +1891,7 @@ describe('the rubicon adapter', () => { }); }); - it('should pass gdpr param gdpr_consent only when gdprApplies is undefined', () => { + it('should pass gdpr param gdpr_consent only when gdprApplies is undefined', function () { expect(spec.getUserSyncs({ iframeEnabled: true }, {}, { consentString: 'foo' })).to.deep.equal({ @@ -1899,13 +1899,13 @@ describe('the rubicon adapter', () => { }); }); - it('should pass no params if gdpr consentString is not defined', () => { + it('should pass no params if gdpr consentString is not defined', function () { expect(spec.getUserSyncs({ iframeEnabled: true }, {}, {})).to.deep.equal({ type: 'iframe', url: `${emilyUrl}` }); }); - it('should pass no params if gdpr consentString is a number', () => { + it('should pass no params if gdpr consentString is a number', function () { expect(spec.getUserSyncs({ iframeEnabled: true }, {}, { consentString: 0 })).to.deep.equal({ @@ -1913,7 +1913,7 @@ describe('the rubicon adapter', () => { }); }); - it('should pass no params if gdpr consentString is null', () => { + it('should pass no params if gdpr consentString is null', function () { expect(spec.getUserSyncs({ iframeEnabled: true }, {}, { consentString: null })).to.deep.equal({ @@ -1921,7 +1921,7 @@ describe('the rubicon adapter', () => { }); }); - it('should pass no params if gdpr consentString is a object', () => { + it('should pass no params if gdpr consentString is a object', function () { expect(spec.getUserSyncs({ iframeEnabled: true }, {}, { consentString: {} })).to.deep.equal({ @@ -1929,7 +1929,7 @@ describe('the rubicon adapter', () => { }); }); - it('should pass no params if gdpr is not defined', () => { + it('should pass no params if gdpr is not defined', function () { expect(spec.getUserSyncs({ iframeEnabled: true }, {}, undefined)).to.deep.equal({ type: 'iframe', url: `${emilyUrl}` }); diff --git a/test/spec/modules/rxrtbBidAdapter_spec.js b/test/spec/modules/rxrtbBidAdapter_spec.js index 0785c6f144b..b56ef0544b2 100644 --- a/test/spec/modules/rxrtbBidAdapter_spec.js +++ b/test/spec/modules/rxrtbBidAdapter_spec.js @@ -1,9 +1,9 @@ import {expect} from 'chai'; import {spec} from 'modules/rxrtbBidAdapter'; -describe('rxrtb adapater', () => { - describe('Test validate req', () => { - it('should accept minimum valid bid', () => { +describe('rxrtb adapater', function () { + describe('Test validate req', function () { + it('should accept minimum valid bid', function () { let bid = { bidder: 'rxrtb', params: { @@ -17,7 +17,7 @@ describe('rxrtb adapater', () => { expect(isValid).to.equal(true); }); - it('should reject missing id', () => { + it('should reject missing id', function () { let bid = { bidder: 'rxrtb', params: { @@ -30,7 +30,7 @@ describe('rxrtb adapater', () => { expect(isValid).to.equal(false); }); - it('should reject id not Integer', () => { + it('should reject id not Integer', function () { let bid = { bidder: 'rxrtb', params: { @@ -44,7 +44,7 @@ describe('rxrtb adapater', () => { expect(isValid).to.equal(false); }); - it('should reject missing source', () => { + it('should reject missing source', function () { let bid = { bidder: 'rxrtb', params: { @@ -58,8 +58,8 @@ describe('rxrtb adapater', () => { }); }); - describe('Test build request', () => { - it('minimum request', () => { + describe('Test build request', function () { + it('minimum request', function () { let bid = { bidder: 'rxrtb', sizes: [[728, 90]], @@ -88,8 +88,8 @@ describe('rxrtb adapater', () => { }); }); - describe('Test interpret response', () => { - it('General banner response', () => { + describe('Test interpret response', function () { + it('General banner response', function () { let resp = spec.interpretResponse({ body: { id: 'abcd', diff --git a/test/spec/modules/s2sTesting_spec.js b/test/spec/modules/s2sTesting_spec.js index 33552011aa1..b2b35a585c7 100644 --- a/test/spec/modules/s2sTesting_spec.js +++ b/test/spec/modules/s2sTesting_spec.js @@ -12,15 +12,15 @@ describe('s2sTesting', function () { let mathRandomStub; let randomNumber = 0; - beforeEach(() => { + beforeEach(function () { mathRandomStub = sinon.stub(Math, 'random').callsFake(() => { return randomNumber; }); }); - afterEach(() => { + afterEach(function () { mathRandomStub.restore(); }); - describe('getSource', () => { + describe('getSource', function () { // helper function to set random number and get the source function getExpectedSource(randNumber, sourceWeights, sources) { // set random number for testing @@ -28,18 +28,18 @@ describe('s2sTesting', function () { return getSource(sourceWeights, sources); } - it('returns undefined if no sources', () => { + it('returns undefined if no sources', function () { expect(getExpectedSource(0, {})).to.be.undefined; expect(getExpectedSource(0.5, {})).to.be.undefined; expect(getExpectedSource(0.9999, {})).to.be.undefined; }); - it('returns undefined if no weights', () => { + it('returns undefined if no weights', function () { expect(getExpectedSource(0, {server: 0, client: 0})).to.be.undefined; expect(getExpectedSource(0.5, {client: 0})).to.be.undefined; }); - it('gets the expected source from 3 sources', () => { + it('gets the expected source from 3 sources', function () { var sources = ['server', 'client', 'both']; expect(getExpectedSource(0, {server: 1, client: 1, both: 2}, sources)).to.equal('server'); expect(getExpectedSource(0.2499999, {server: 1, client: 1, both: 2}, sources)).to.equal('server'); @@ -49,7 +49,7 @@ describe('s2sTesting', function () { expect(getExpectedSource(0.99999, {server: 1, client: 1, both: 2}, sources)).to.equal('both'); }); - it('gets the expected source from 2 sources', () => { + it('gets the expected source from 2 sources', function () { expect(getExpectedSource(0, {server: 2, client: 3})).to.equal('server'); expect(getExpectedSource(0.39999, {server: 2, client: 3})).to.equal('server'); expect(getExpectedSource(0.4, {server: 2, client: 3})).to.equal('client'); @@ -61,19 +61,19 @@ describe('s2sTesting', function () { expect(getExpectedSource(0.9, {server: 2, client: 3}, sources)).to.equal('client'); }); - it('gets the expected source from 1 source', () => { + it('gets the expected source from 1 source', function () { expect(getExpectedSource(0, {client: 2})).to.equal('client'); expect(getExpectedSource(0.5, {client: 2})).to.equal('client'); expect(getExpectedSource(0.99999, {client: 2})).to.equal('client'); }); - it('ignores an invalid source', () => { + it('ignores an invalid source', function () { expect(getExpectedSource(0, {client: 2, cache: 2})).to.equal('client'); expect(getExpectedSource(0.3333, {server: 1, cache: 1, client: 2})).to.equal('server'); expect(getExpectedSource(0.34, {server: 1, cache: 1, client: 2})).to.equal('client'); }); - it('ignores order of sources', () => { + it('ignores order of sources', function () { var sources = ['server', 'client', 'both']; expect(getExpectedSource(0, {client: 1, server: 1, both: 2}, sources)).to.equal('server'); expect(getExpectedSource(0.2499999, {both: 2, client: 1, server: 1}, sources)).to.equal('server'); @@ -82,21 +82,21 @@ describe('s2sTesting', function () { expect(getExpectedSource(0.5, {both: 2, server: 1, client: 1}, sources)).to.equal('both'); }); - it('accepts an array of sources', () => { + it('accepts an array of sources', function () { expect(getExpectedSource(0.3333, {second: 2, first: 1}, ['first', 'second'])).to.equal('first'); expect(getExpectedSource(0.34, {second: 2, first: 1}, ['first', 'second'])).to.equal('second'); expect(getExpectedSource(0.9999, {second: 2, first: 1}, ['first', 'second'])).to.equal('second'); }); }); - describe('getSourceBidderMap', () => { - describe('setting source through s2sConfig', () => { - beforeEach(() => { + describe('getSourceBidderMap', function () { + describe('setting source through s2sConfig', function () { + beforeEach(function () { // set random number for testing randomNumber = 0.7; }); - it('does not work if testing is "false"', () => { + it('does not work if testing is "false"', function () { config.setConfig({s2sConfig: { bidders: ['rubicon'], testing: false, @@ -108,7 +108,7 @@ describe('s2sTesting', function () { }); }); - it('sets one client bidder', () => { + it('sets one client bidder', function () { config.setConfig({s2sConfig: { bidders: ['rubicon'], testing: true, @@ -120,7 +120,7 @@ describe('s2sTesting', function () { }); }); - it('sets one server bidder', () => { + it('sets one server bidder', function () { config.setConfig({s2sConfig: { bidders: ['rubicon'], testing: true, @@ -132,7 +132,7 @@ describe('s2sTesting', function () { }); }); - it('defaults to server', () => { + it('defaults to server', function () { config.setConfig({s2sConfig: { bidders: ['rubicon'], testing: true @@ -143,7 +143,7 @@ describe('s2sTesting', function () { }); }); - it('sets two bidders', () => { + it('sets two bidders', function () { config.setConfig({s2sConfig: { bidders: ['rubicon', 'appnexus'], testing: true, @@ -157,15 +157,15 @@ describe('s2sTesting', function () { }); }); - describe('setting source through adUnits', () => { - beforeEach(() => { + describe('setting source through adUnits', function () { + beforeEach(function () { // reset s2sconfig bid sources config.setConfig({s2sConfig: {testing: true}}); // set random number for testing randomNumber = 0.7; }); - it('sets one bidder source from one adUnit', () => { + it('sets one bidder source from one adUnit', function () { var adUnits = [ {bids: [ {bidder: 'rubicon', bidSource: {server: 4, client: 1}} @@ -193,7 +193,7 @@ describe('s2sTesting', function () { expect(adUnits[0].bids[0].finalSource).to.equal('client'); }); - it('defaults to client if no bidSource', () => { + it('defaults to client if no bidSource', function () { var adUnits = [ {bids: [ {bidder: 'rubicon', bidSource: {}} @@ -208,7 +208,7 @@ describe('s2sTesting', function () { expect(adUnits[0].bids[0].finalSource).to.equal('client'); }); - it('sets multiple bidders sources from one adUnit', () => { + it('sets multiple bidders sources from one adUnit', function () { var adUnits = [ {bids: [ {bidder: 'rubicon', bidSource: {server: 2, client: 1}}, @@ -225,7 +225,7 @@ describe('s2sTesting', function () { expect(adUnits[0].bids[1].finalSource).to.equal('server'); }); - it('sets multiple bidders sources from multiple adUnits', () => { + it('sets multiple bidders sources from multiple adUnits', function () { var adUnits = [ {bids: [ {bidder: 'rubicon', bidSource: {server: 2, client: 1}}, @@ -251,7 +251,7 @@ describe('s2sTesting', function () { expect(adUnits[1].bids[1].finalSource).to.equal('client'); }); - it('should reuse calculated sources', () => { + it('should reuse calculated sources', function () { var adUnits = [ {bids: [ {bidder: 'rubicon', calcSource: 'client', bidSource: {server: 4, client: 1}}, @@ -275,15 +275,15 @@ describe('s2sTesting', function () { }); }); - describe('setting source through s2sconfig and adUnits', () => { - beforeEach(() => { + describe('setting source through s2sconfig and adUnits', function () { + beforeEach(function () { // reset s2sconfig bid sources config.setConfig({s2sConfig: {testing: true}}); // set random number for testing randomNumber = 0.7; }); - it('should get sources from both', () => { + it('should get sources from both', function () { // set rubicon: server and appnexus: client var adUnits = [ {bids: [ diff --git a/test/spec/modules/saraBidAdapter_spec.js b/test/spec/modules/saraBidAdapter_spec.js index 1b5d75170ae..6614ec65265 100644 --- a/test/spec/modules/saraBidAdapter_spec.js +++ b/test/spec/modules/saraBidAdapter_spec.js @@ -5,13 +5,13 @@ import { newBidder } from 'src/adapters/bidderFactory'; describe('Sara Adapter', function () { const adapter = newBidder(spec); - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { 'bidder': 'sara', 'params': { @@ -24,11 +24,11 @@ describe('Sara Adapter', function () { 'auctionId': '1d1a030790a475', }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -38,7 +38,7 @@ describe('Sara Adapter', function () { }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { function parseRequest(url) { const res = {}; url.split('&').forEach((it) => { @@ -83,7 +83,7 @@ describe('Sara Adapter', function () { } ]; - it('should attach valid params to the tag', () => { + it('should attach valid params to the tag', function () { const request = spec.buildRequests([bidRequests[0]]); expect(request.data).to.be.an('string'); const payload = parseRequest(request.data); @@ -92,7 +92,7 @@ describe('Sara Adapter', function () { expect(payload).to.have.property('auids', '5'); }); - it('auids must not be duplicated', () => { + it('auids must not be duplicated', function () { const request = spec.buildRequests(bidRequests); expect(request.data).to.be.an('string'); const payload = parseRequest(request.data); @@ -101,7 +101,7 @@ describe('Sara Adapter', function () { expect(payload).to.have.property('auids', '5,6'); }); - it('pt parameter must be "gross" if params.priceType === "gross"', () => { + it('pt parameter must be "gross" if params.priceType === "gross"', function () { bidRequests[1].params.priceType = 'gross'; const request = spec.buildRequests(bidRequests); expect(request.data).to.be.an('string'); @@ -112,7 +112,7 @@ describe('Sara Adapter', function () { delete bidRequests[1].params.priceType; }); - it('pt parameter must be "net" or "gross"', () => { + it('pt parameter must be "net" or "gross"', function () { bidRequests[1].params.priceType = 'some'; const request = spec.buildRequests(bidRequests); expect(request.data).to.be.an('string'); @@ -124,7 +124,7 @@ describe('Sara Adapter', function () { }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { const responses = [ {'bid': [{'price': 1.15, 'adm': '
test content 1
', 'auid': 4, 'h': 250, 'w': 300}], 'seat': '1'}, {'bid': [{'price': 0.5, 'adm': '
test content 2
', 'auid': 5, 'h': 90, 'w': 728}], 'seat': '1'}, @@ -135,7 +135,7 @@ describe('Sara Adapter', function () { {'seat': '1'}, ]; - it('should get correct bid response', () => { + it('should get correct bid response', function () { const bidRequests = [ { 'bidder': 'sara', @@ -169,7 +169,7 @@ describe('Sara Adapter', function () { expect(result).to.deep.equal(expectedResponse); }); - it('should get correct multi bid response', () => { + it('should get correct multi bid response', function () { const bidRequests = [ { 'bidder': 'sara', @@ -249,7 +249,7 @@ describe('Sara Adapter', function () { expect(result).to.deep.equal(expectedResponse); }); - it('handles wrong and nobid responses', () => { + it('handles wrong and nobid responses', function () { const bidRequests = [ { 'bidder': 'sara', diff --git a/test/spec/modules/sekindoUMBidAdapter_spec.js b/test/spec/modules/sekindoUMBidAdapter_spec.js index 8f275d7fc05..b699015bb3e 100644 --- a/test/spec/modules/sekindoUMBidAdapter_spec.js +++ b/test/spec/modules/sekindoUMBidAdapter_spec.js @@ -2,7 +2,7 @@ import { expect } from 'chai'; import { spec } from 'modules/sekindoUMBidAdapter'; import { newBidder } from 'src/adapters/bidderFactory'; -describe('sekindoUMAdapter', () => { +describe('sekindoUMAdapter', function () { const adapter = newBidder(spec); const bannerParams = { @@ -29,34 +29,34 @@ describe('sekindoUMAdapter', () => { 'mediaType': 'banner' }; - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { - it('should return true when required params found', () => { + describe('isBidRequestValid', function () { + it('should return true when required params found', function () { bidRequests.mediaType = 'banner'; bidRequests.params = bannerParams; expect(spec.isBidRequestValid(bidRequests)).to.equal(true); }); - it('should return false when required video params are missing', () => { + it('should return false when required video params are missing', function () { bidRequests.mediaType = 'video'; bidRequests.params = bannerParams; expect(spec.isBidRequestValid(bidRequests)).to.equal(false); }); - it('should return true when required Video params found', () => { + it('should return true when required Video params found', function () { bidRequests.mediaType = 'video'; bidRequests.params = videoParams; expect(spec.isBidRequestValid(bidRequests)).to.equal(true); }); }); - describe('buildRequests', () => { - it('banner data should be a query string and method = GET', () => { + describe('buildRequests', function () { + it('banner data should be a query string and method = GET', function () { bidRequests.mediaType = 'banner'; bidRequests.params = bannerParams; const request = spec.buildRequests([bidRequests]); @@ -64,7 +64,7 @@ describe('sekindoUMAdapter', () => { expect(request[0].method).to.equal('GET'); }); - it('with gdprConsent, banner data should be a query string and method = GET', () => { + it('with gdprConsent, banner data should be a query string and method = GET', function () { bidRequests.mediaType = 'banner'; bidRequests.params = bannerParams; const request = spec.buildRequests([bidRequests], {'gdprConsent': {'consentString': 'BOJ/P2HOJ/P2HABABMAAAAAZ+A==', 'vendorData': {}, 'gdprApplies': true}}); @@ -72,7 +72,7 @@ describe('sekindoUMAdapter', () => { expect(request[0].method).to.equal('GET'); }); - it('video data should be a query string and method = GET', () => { + it('video data should be a query string and method = GET', function () { bidRequests.mediaType = 'video'; bidRequests.params = videoParams; const request = spec.buildRequests([bidRequests]); @@ -81,8 +81,8 @@ describe('sekindoUMAdapter', () => { }); }); - describe('interpretResponse', () => { - it('banner should get correct bid response', () => { + describe('interpretResponse', function () { + it('banner should get correct bid response', function () { let response = { 'headers': function(header) { return 'dummy header'; @@ -110,7 +110,7 @@ describe('sekindoUMAdapter', () => { expect(Object.keys(result[0])).to.deep.equal(Object.keys(expectedResponse[0])); }); - it('vastXml video should get correct bid response', () => { + it('vastXml video should get correct bid response', function () { let response = { 'headers': function(header) { return 'dummy header'; @@ -138,7 +138,7 @@ describe('sekindoUMAdapter', () => { expect(Object.keys(result[0])).to.deep.equal(Object.keys(expectedResponse[0])); }); - it('vastUrl video should get correct bid response', () => { + it('vastUrl video should get correct bid response', function () { let response = { 'headers': function(header) { return 'dummy header'; diff --git a/test/spec/modules/serverbidBidAdapter_spec.js b/test/spec/modules/serverbidBidAdapter_spec.js index d3dc64ae6df..aa40ee31ce5 100644 --- a/test/spec/modules/serverbidBidAdapter_spec.js +++ b/test/spec/modules/serverbidBidAdapter_spec.js @@ -100,11 +100,11 @@ const RESPONSE = { } }; -describe('Serverbid BidAdapter', () => { +describe('Serverbid BidAdapter', function () { let bidRequests; let adapter = spec; - beforeEach(() => { + beforeEach(function () { bidRequests = [ { bidder: 'serverbid', @@ -122,8 +122,8 @@ describe('Serverbid BidAdapter', () => { ]; }); - describe('bid request validation', () => { - it('should accept valid bid requests', () => { + describe('bid request validation', function () { + it('should accept valid bid requests', function () { let bid = { bidder: 'serverbid', params: { @@ -134,7 +134,7 @@ describe('Serverbid BidAdapter', () => { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should accept valid bid requests with extra fields', () => { + it('should accept valid bid requests with extra fields', function () { let bid = { bidder: 'serverbid', params: { @@ -146,7 +146,7 @@ describe('Serverbid BidAdapter', () => { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should reject bid requests without siteId', () => { + it('should reject bid requests without siteId', function () { let bid = { bidder: 'serverbid', params: { @@ -156,7 +156,7 @@ describe('Serverbid BidAdapter', () => { expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should reject bid requests without networkId', () => { + it('should reject bid requests without networkId', function () { let bid = { bidder: 'serverbid', params: { @@ -167,45 +167,45 @@ describe('Serverbid BidAdapter', () => { }); }); - describe('buildRequests validation', () => { - it('creates request data', () => { + describe('buildRequests validation', function () { + it('creates request data', function () { let request = spec.buildRequests(bidRequests); expect(request).to.exist.and.to.be.a('object'); }); - it('request to serverbid should contain a url', () => { + it('request to serverbid should contain a url', function () { let request = spec.buildRequests(bidRequests); expect(request.url).to.have.string('serverbid.com'); }); - it('requires valid bids to make request', () => { + it('requires valid bids to make request', function () { let request = spec.buildRequests([]); expect(request.bidRequest).to.be.empty; }); - it('sends bid request to ENDPOINT via POST', () => { + it('sends bid request to ENDPOINT via POST', function () { let request = spec.buildRequests(bidRequests); expect(request.method).to.have.string('POST'); }); }); - describe('interpretResponse validation', () => { - it('response should have valid bidderCode', () => { + describe('interpretResponse validation', function () { + it('response should have valid bidderCode', function () { let bidRequest = spec.buildRequests(REQUEST.bidRequest); let bid = bidFactory.createBid(1, bidRequest.bidRequest[0]); expect(bid.bidderCode).to.equal('serverbid'); }); - it('response should include objects for all bids', () => { + it('response should include objects for all bids', function () { let bids = spec.interpretResponse(RESPONSE, REQUEST); expect(bids.length).to.equal(2); }); - it('registers bids', () => { + it('registers bids', function () { let bids = spec.interpretResponse(RESPONSE, REQUEST); bids.forEach(b => { expect(b).to.have.property('cpm'); @@ -223,29 +223,29 @@ describe('Serverbid BidAdapter', () => { }); }); - it('handles nobid responses', () => { + it('handles nobid responses', function () { let EMPTY_RESP = Object.assign({}, RESPONSE, {'body': {'decisions': null}}) let bids = spec.interpretResponse(EMPTY_RESP, REQUEST); expect(bids).to.be.empty; }); - it('handles no server response', () => { + it('handles no server response', function () { let bids = spec.interpretResponse(null, REQUEST); expect(bids).to.be.empty; }); }); - describe('getUserSyncs', () => { + describe('getUserSyncs', function () { let syncOptions = {'iframeEnabled': true}; - it('handles empty sync options', () => { + it('handles empty sync options', function () { let opts = spec.getUserSyncs({}); expect(opts).to.be.empty; }); - it('should return a sync url if iframe syncs are enabled', () => { + it('should return a sync url if iframe syncs are enabled', function () { let opts = spec.getUserSyncs(syncOptions); expect(opts.length).to.equal(1); diff --git a/test/spec/modules/serverbidServerBidAdapter_spec.js b/test/spec/modules/serverbidServerBidAdapter_spec.js index 29d35b921d6..7c428647f62 100644 --- a/test/spec/modules/serverbidServerBidAdapter_spec.js +++ b/test/spec/modules/serverbidServerBidAdapter_spec.js @@ -184,51 +184,55 @@ const REQUEST_TWO_UNITS = { ] }; -describe('ServerBid S2S Adapter', () => { +describe('ServerBid S2S Adapter', function () { let adapter, addBidResponse = sinon.spy(), done = sinon.spy(); - beforeEach(() => adapter = new Adapter()); + beforeEach(function () { + adapter = new Adapter() + }); - afterEach(() => { + afterEach(function () { addBidResponse.resetHistory(); done.resetHistory(); }); - describe('request function', () => { + describe('request function', function () { let xhr; let requests; - beforeEach(() => { + beforeEach(function () { xhr = sinon.useFakeXMLHttpRequest(); requests = []; xhr.onCreate = request => requests.push(request); }); - afterEach(() => xhr.restore()); + afterEach(function () { + xhr.restore(); + }); - it('exists and is a function', () => { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('response handler', () => { + describe('response handler', function () { let server; - beforeEach(() => { + beforeEach(function () { server = sinon.fakeServer.create(); sinon.stub(utils, 'getBidRequest').returns({ bidId: '123' }); }); - afterEach(() => { + afterEach(function () { server.restore(); utils.getBidRequest.restore(); }); - it('registers bids', () => { + it('registers bids', function () { server.respondWith(JSON.stringify(RESPONSE)); config.setConfig(CONFIG_ARG); @@ -242,7 +246,7 @@ describe('ServerBid S2S Adapter', () => { expect(response).to.have.property('adId', '123'); }); - it('registers no-bid response when ad unit not set', () => { + it('registers no-bid response when ad unit not set', function () { server.respondWith(JSON.stringify(RESPONSE_NO_BID_NO_UNIT)); config.setConfig(CONFIG_ARG); @@ -260,7 +264,7 @@ describe('ServerBid S2S Adapter', () => { expect(bid_request_passed).to.have.property('adId', '123'); }); - it('registers no-bid response when ad unit is set', () => { + it('registers no-bid response when ad unit is set', function () { server.respondWith(JSON.stringify(RESPONSE_NO_BID_NO_UNIT)); config.setConfig(CONFIG_ARG); @@ -275,7 +279,7 @@ describe('ServerBid S2S Adapter', () => { expect(response).to.have.property('statusMessage', 'Bid returned empty or error response'); }); - it('registers no-bid response when there are less bids than requests', () => { + it('registers no-bid response when there are less bids than requests', function () { server.respondWith(JSON.stringify(RESPONSE)); config.setConfig(CONFIG_ARG); diff --git a/test/spec/modules/sharethroughBidAdapter_spec.js b/test/spec/modules/sharethroughBidAdapter_spec.js index 85fc6daf758..6a4ab016fdc 100644 --- a/test/spec/modules/sharethroughBidAdapter_spec.js +++ b/test/spec/modules/sharethroughBidAdapter_spec.js @@ -104,15 +104,15 @@ const b64EncodeUnicode = (str) => { })); } -describe('sharethrough adapter spec', () => { - describe('.code', () => { - it('should return a bidder code of sharethrough', () => { +describe('sharethrough adapter spec', function () { + describe('.code', function () { + it('should return a bidder code of sharethrough', function () { expect(spec.code).to.eql('sharethrough'); }); }) - describe('.isBidRequestValid', () => { - it('should return false if req has no pkey', () => { + describe('.isBidRequestValid', function () { + it('should return false if req has no pkey', function () { const invalidBidRequest = { bidder: 'sharethrough', params: { @@ -122,7 +122,7 @@ describe('sharethrough adapter spec', () => { expect(spec.isBidRequestValid(invalidBidRequest)).to.eql(false); }); - it('should return false if req has wrong bidder code', () => { + it('should return false if req has wrong bidder code', function () { const invalidBidRequest = { bidder: 'notSharethrough', params: { @@ -132,14 +132,14 @@ describe('sharethrough adapter spec', () => { expect(spec.isBidRequestValid(invalidBidRequest)).to.eql(false); }); - it('should return true if req is correct', () => { + it('should return true if req is correct', function () { expect(spec.isBidRequestValid(bidderRequest[0])).to.eq(true); expect(spec.isBidRequestValid(bidderRequest[1])).to.eq(true); }) }); - describe('.buildRequests', () => { - it('should return an array of requests', () => { + describe('.buildRequests', function () { + it('should return an array of requests', function () { const bidRequests = spec.buildRequests(bidderRequest); expect(bidRequests[0].url).to.eq( @@ -149,7 +149,7 @@ describe('sharethrough adapter spec', () => { expect(bidRequests[0].method).to.eq('GET'); }); - it('should add consent parameters if gdprConsent is present', () => { + it('should add consent parameters if gdprConsent is present', function () { const gdprConsent = { consentString: 'consent_string123', gdprApplies: true }; const fakeBidRequest = { gdprConsent: gdprConsent }; const bidRequest = spec.buildRequests(bidderRequest, fakeBidRequest)[0]; @@ -157,7 +157,7 @@ describe('sharethrough adapter spec', () => { expect(bidRequest.data.consent_string).to.eq('consent_string123'); }); - it('should handle gdprConsent is present but values are undefined case', () => { + it('should handle gdprConsent is present but values are undefined case', function () { const gdprConsent = { consent_string: undefined, gdprApplies: undefined }; const fakeBidRequest = { gdprConsent: gdprConsent }; const bidRequest = spec.buildRequests(bidderRequest, fakeBidRequest)[0]; @@ -165,8 +165,8 @@ describe('sharethrough adapter spec', () => { }); }); - describe('.interpretResponse', () => { - it('returns a correctly parsed out response', () => { + describe('.interpretResponse', function () { + it('returns a correctly parsed out response', function () { expect(spec.interpretResponse(bidderResponse, prebidRequests[0])[0]).to.include( { width: 0, @@ -180,7 +180,7 @@ describe('sharethrough adapter spec', () => { }); }); - it('returns a correctly parsed out response with largest size when strData.stayInIframe is true', () => { + it('returns a correctly parsed out response with largest size when strData.stayInIframe is true', function () { expect(spec.interpretResponse(bidderResponse, prebidRequests[1])[0]).to.include( { width: 300, @@ -194,7 +194,7 @@ describe('sharethrough adapter spec', () => { }); }); - it('returns a correctly parsed out response with explicitly defined size when strData.stayInIframe is true and strData.iframeSize is provided', () => { + it('returns a correctly parsed out response with explicitly defined size when strData.stayInIframe is true and strData.iframeSize is provided', function () { expect(spec.interpretResponse(bidderResponse, prebidRequests[2])[0]).to.include( { width: 500, @@ -208,22 +208,22 @@ describe('sharethrough adapter spec', () => { }); }); - it('returns a blank array if there are no creatives', () => { + it('returns a blank array if there are no creatives', function () { const bidResponse = { body: { creatives: [] } }; expect(spec.interpretResponse(bidResponse, prebidRequests[0])).to.be.an('array').that.is.empty; }); - it('returns a blank array if body object is empty', () => { + it('returns a blank array if body object is empty', function () { const bidResponse = { body: {} }; expect(spec.interpretResponse(bidResponse, prebidRequests[0])).to.be.an('array').that.is.empty; }); - it('returns a blank array if body is null', () => { + it('returns a blank array if body is null', function () { const bidResponse = { body: null }; expect(spec.interpretResponse(bidResponse, prebidRequests[0])).to.be.an('array').that.is.empty; }); - it('correctly generates ad markup', () => { + it('correctly generates ad markup', function () { const adMarkup = spec.interpretResponse(bidderResponse, prebidRequests[0])[0].ad; let resp = null; @@ -240,7 +240,7 @@ describe('sharethrough adapter spec', () => { /window.top.document.getElementsByTagName\('body'\)\[0\].appendChild\(sfp_js\);/) }); - it('correctly generates ad markup for staying in iframe', () => { + it('correctly generates ad markup for staying in iframe', function () { const adMarkup = spec.interpretResponse(bidderResponse, prebidRequests[1])[0].ad; let resp = null; @@ -254,11 +254,11 @@ describe('sharethrough adapter spec', () => { }); }); - describe('.getUserSyncs', () => { + describe('.getUserSyncs', function () { const cookieSyncs = ['cookieUrl1', 'cookieUrl2', 'cookieUrl3']; const serverResponses = [{ body: { cookieSyncUrls: cookieSyncs } }]; - it('returns an array of correctly formatted user syncs', () => { + it('returns an array of correctly formatted user syncs', function () { const syncArray = spec.getUserSyncs({ pixelEnabled: true }, serverResponses); expect(syncArray).to.deep.equal([ { type: 'image', url: 'cookieUrl1' }, @@ -267,17 +267,17 @@ describe('sharethrough adapter spec', () => { ); }); - it('returns an empty array if the body is null', () => { + it('returns an empty array if the body is null', function () { const syncArray = spec.getUserSyncs({ pixelEnabled: true }, [{ body: null }]); expect(syncArray).to.be.an('array').that.is.empty; }); - it('returns an empty array if the body.cookieSyncUrls is missing', () => { + it('returns an empty array if the body.cookieSyncUrls is missing', function () { const syncArray = spec.getUserSyncs({ pixelEnabled: true }, [{ body: { creatives: ['creative'] } }]); expect(syncArray).to.be.an('array').that.is.empty; }); - it('returns an empty array if pixels are not enabled', () => { + it('returns an empty array if pixels are not enabled', function () { const syncArray = spec.getUserSyncs({ pixelEnabled: false }, serverResponses); expect(syncArray).to.be.an('array').that.is.empty; }); diff --git a/test/spec/modules/sigmoidAnalyticsAdapter_spec.js b/test/spec/modules/sigmoidAnalyticsAdapter_spec.js index 115c296d489..0552e02383a 100644 --- a/test/spec/modules/sigmoidAnalyticsAdapter_spec.js +++ b/test/spec/modules/sigmoidAnalyticsAdapter_spec.js @@ -6,21 +6,21 @@ let constants = require('src/constants.json'); describe('sigmoid Prebid Analytic', function () { let xhr; - before(() => { + before(function () { xhr = sinon.useFakeXMLHttpRequest(); }) - after(() => { + after(function () { sigmoidAnalytic.disableAnalytics(); xhr.restore(); }); describe('enableAnalytics', function () { - beforeEach(() => { + beforeEach(function () { sinon.spy(sigmoidAnalytic, 'track'); sinon.stub(events, 'getEvents').returns([]); }); - afterEach(() => { + afterEach(function () { sigmoidAnalytic.track.restore(); events.getEvents.restore(); }); @@ -46,8 +46,8 @@ describe('sigmoid Prebid Analytic', function () { sinon.assert.callCount(sigmoidAnalytic.track, 5); }); }); - describe('build utm tag data', () => { - beforeEach(() => { + describe('build utm tag data', function () { + beforeEach(function () { localStorage.setItem('sigmoid_analytics_utm_source', 'utm_source'); localStorage.setItem('sigmoid_analytics_utm_medium', 'utm_medium'); localStorage.setItem('sigmoid_analytics_utm_campaign', ''); @@ -55,7 +55,7 @@ describe('sigmoid Prebid Analytic', function () { localStorage.setItem('sigmoid_analytics_utm_content', ''); localStorage.setItem('sigmoid_analytics_utm_timeout', Date.now()); }); - it('should build utm data from local storage', () => { + it('should build utm data from local storage', function () { let utmTagData = sigmoidAnalytic.buildUtmTagData(); expect(utmTagData.utm_source).to.equal('utm_source'); expect(utmTagData.utm_medium).to.equal('utm_medium'); diff --git a/test/spec/modules/smartadserverBidAdapter_spec.js b/test/spec/modules/smartadserverBidAdapter_spec.js index e6364de94a9..91fb4e3e6a7 100644 --- a/test/spec/modules/smartadserverBidAdapter_spec.js +++ b/test/spec/modules/smartadserverBidAdapter_spec.js @@ -14,7 +14,7 @@ import * as utils from 'src/utils'; import { requestBidsHook } from 'modules/consentManagement'; // Default params with optional ones -describe('Smart bid adapter tests', () => { +describe('Smart bid adapter tests', function () { var DEFAULT_PARAMS = [{ adUnitCode: 'sas_42', bidId: 'abcd1234', @@ -71,7 +71,7 @@ describe('Smart bid adapter tests', () => { } }; - it('Verify build request', () => { + it('Verify build request', function () { config.setConfig({ 'currency': { 'adServerCurrency': 'EUR' @@ -100,13 +100,13 @@ describe('Smart bid adapter tests', () => { expect(requestContent).to.have.property('ckid').and.to.equal(42); }); - describe('gdpr tests', () => { - afterEach(() => { + describe('gdpr tests', function () { + afterEach(function () { config.resetConfig(); $$PREBID_GLOBAL$$.requestBids.removeHook(requestBidsHook); }); - it('Verify build request with GDPR', () => { + it('Verify build request with GDPR', function () { config.setConfig({ 'currency': { 'adServerCurrency': 'EUR' @@ -129,7 +129,7 @@ describe('Smart bid adapter tests', () => { expect(requestContent).to.have.property('gdpr_consent').and.to.equal('BOKAVy4OKAVy4ABAB8AAAAAZ+A=='); }); - it('Verify build request with GDPR without gdprApplies', () => { + it('Verify build request with GDPR without gdprApplies', function () { config.setConfig({ 'currency': { 'adServerCurrency': 'EUR' @@ -152,7 +152,7 @@ describe('Smart bid adapter tests', () => { }); }); - it('Verify parse response', () => { + it('Verify parse response', function () { const request = spec.buildRequests(DEFAULT_PARAMS); const bids = spec.interpretResponse(BID_RESPONSE, request[0]); expect(bids).to.have.lengthOf(1); @@ -176,16 +176,16 @@ describe('Smart bid adapter tests', () => { }).to.not.throw(); }); - it('Verifies bidder code', () => { + it('Verifies bidder code', function () { expect(spec.code).to.equal('smartadserver'); }); - it('Verifies bidder aliases', () => { + it('Verifies bidder aliases', function () { expect(spec.aliases).to.have.lengthOf(1); expect(spec.aliases[0]).to.equal('smart'); }); - it('Verifies if bid request valid', () => { + it('Verifies if bid request valid', function () { expect(spec.isBidRequestValid(DEFAULT_PARAMS[0])).to.equal(true); expect(spec.isBidRequestValid(DEFAULT_PARAMS_WO_OPTIONAL[0])).to.equal(true); expect(spec.isBidRequestValid({})).to.equal(false); @@ -243,7 +243,7 @@ describe('Smart bid adapter tests', () => { })).to.equal(false); }); - it('Verifies user sync', () => { + it('Verifies user sync', function () { var syncs = spec.getUserSyncs({ iframeEnabled: true }, [BID_RESPONSE]); diff --git a/test/spec/modules/smartyadsBidAdapter_spec.js b/test/spec/modules/smartyadsBidAdapter_spec.js index 858e8bf37a0..e301e9733a6 100644 --- a/test/spec/modules/smartyadsBidAdapter_spec.js +++ b/test/spec/modules/smartyadsBidAdapter_spec.js @@ -1,7 +1,7 @@ import {expect} from 'chai'; import {spec} from '../../../modules/smartyadsBidAdapter'; -describe('SmartyadsAdapter', () => { +describe('SmartyadsAdapter', function () { let bid = { bidId: '23fhj33i987f', bidder: 'smartyads', @@ -11,31 +11,31 @@ describe('SmartyadsAdapter', () => { } }; - describe('isBidRequestValid', () => { - it('Should return true if there are bidId, params and placementId parameters present', () => { + describe('isBidRequestValid', function () { + it('Should return true if there are bidId, params and placementId parameters present', function () { expect(spec.isBidRequestValid(bid)).to.be.true; }); - it('Should return false if at least one of parameters is not present', () => { + it('Should return false if at least one of parameters is not present', function () { delete bid.params.placementId; expect(spec.isBidRequestValid(bid)).to.be.false; }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let serverRequest = spec.buildRequests([bid]); - it('Creates a ServerRequest object with method, URL and data', () => { + it('Creates a ServerRequest object with method, URL and data', function () { expect(serverRequest).to.exist; expect(serverRequest.method).to.exist; expect(serverRequest.url).to.exist; expect(serverRequest.data).to.exist; }); - it('Returns POST method', () => { + it('Returns POST method', function () { expect(serverRequest.method).to.equal('POST'); }); - it('Returns valid URL', () => { + it('Returns valid URL', function () { expect(serverRequest.url).to.equal('//ssp-nj.webtradehub.com/?c=o&m=multi'); }); - it('Returns valid data if array of bids is valid', () => { + it('Returns valid data if array of bids is valid', function () { let data = serverRequest.data; expect(data).to.be.an('object'); expect(data).to.have.all.keys('deviceWidth', 'deviceHeight', 'language', 'secure', 'host', 'page', 'placements'); @@ -51,14 +51,14 @@ describe('SmartyadsAdapter', () => { expect(placement.bidId).to.equal('23fhj33i987f'); expect(placement.traffic).to.equal('banner'); }); - it('Returns empty data if no valid requests are passed', () => { + it('Returns empty data if no valid requests are passed', function () { serverRequest = spec.buildRequests([]); let data = serverRequest.data; expect(data.placements).to.be.an('array').that.is.empty; }); }); - describe('interpretResponse', () => { - it('Should interpret banner response', () => { + describe('interpretResponse', function () { + it('Should interpret banner response', function () { const banner = { body: [{ mediaType: 'banner', @@ -89,7 +89,7 @@ describe('SmartyadsAdapter', () => { expect(dataItem.netRevenue).to.be.true; expect(dataItem.currency).to.equal('USD'); }); - it('Should interpret video response', () => { + it('Should interpret video response', function () { const video = { body: [{ vastUrl: 'test.com', @@ -118,7 +118,7 @@ describe('SmartyadsAdapter', () => { expect(dataItem.netRevenue).to.be.true; expect(dataItem.currency).to.equal('USD'); }); - it('Should interpret native response', () => { + it('Should interpret native response', function () { const native = { body: [{ mediaType: 'native', @@ -152,7 +152,7 @@ describe('SmartyadsAdapter', () => { expect(dataItem.netRevenue).to.be.true; expect(dataItem.currency).to.equal('USD'); }); - it('Should return an empty array if invalid banner response is passed', () => { + it('Should return an empty array if invalid banner response is passed', function () { const invBanner = { body: [{ width: 300, @@ -170,7 +170,7 @@ describe('SmartyadsAdapter', () => { let serverResponses = spec.interpretResponse(invBanner); expect(serverResponses).to.be.an('array').that.is.empty; }); - it('Should return an empty array if invalid video response is passed', () => { + it('Should return an empty array if invalid video response is passed', function () { const invVideo = { body: [{ mediaType: 'video', @@ -186,7 +186,7 @@ describe('SmartyadsAdapter', () => { let serverResponses = spec.interpretResponse(invVideo); expect(serverResponses).to.be.an('array').that.is.empty; }); - it('Should return an empty array if invalid native response is passed', () => { + it('Should return an empty array if invalid native response is passed', function () { const invNative = { body: [{ mediaType: 'native', @@ -203,7 +203,7 @@ describe('SmartyadsAdapter', () => { let serverResponses = spec.interpretResponse(invNative); expect(serverResponses).to.be.an('array').that.is.empty; }); - it('Should return an empty array if invalid response is passed', () => { + it('Should return an empty array if invalid response is passed', function () { const invalid = { body: [{ ttl: 120, @@ -217,9 +217,9 @@ describe('SmartyadsAdapter', () => { expect(serverResponses).to.be.an('array').that.is.empty; }); }); - describe('getUserSyncs', () => { + describe('getUserSyncs', function () { let userSync = spec.getUserSyncs(); - it('Returns valid URL and type', () => { + it('Returns valid URL and type', function () { expect(userSync).to.be.an('array').with.lengthOf(1); expect(userSync[0].type).to.exist; expect(userSync[0].url).to.exist; diff --git a/test/spec/modules/somoaudienceBidAdapter_spec.js b/test/spec/modules/somoaudienceBidAdapter_spec.js index 79ece7ffcf6..bdd2dade96f 100644 --- a/test/spec/modules/somoaudienceBidAdapter_spec.js +++ b/test/spec/modules/somoaudienceBidAdapter_spec.js @@ -2,16 +2,16 @@ import {expect} from 'chai'; import {spec} from 'modules/somoaudienceBidAdapter'; import * as utils from 'src/utils'; -describe('Somo Audience Adapter Tests', () => { - describe('isBidRequestValid', () => { - it('should return false when given an invalid bid', () => { +describe('Somo Audience Adapter Tests', function () { + describe('isBidRequestValid', function () { + it('should return false when given an invalid bid', function () { const bid = { bidder: 'somoaudience', }; const isValid = spec.isBidRequestValid(bid); expect(isValid).to.equal(false); }); - it('should return true when given a placementId bid', () => { + it('should return true when given a placementId bid', function () { const bid = { bidder: 'somoaudience', params: { @@ -23,9 +23,9 @@ describe('Somo Audience Adapter Tests', () => { }); }); - describe('buildRequests', () => { - describe('buildBannerRequests', () => { - it('should properly build a banner request with type not defined and sizes not defined', () => { + describe('buildRequests', function () { + describe('buildBannerRequests', function () { + it('should properly build a banner request with type not defined and sizes not defined', function () { const bidRequests = [{ bidder: 'somoaudience', params: { @@ -47,7 +47,7 @@ describe('Somo Audience Adapter Tests', () => { expect(ortbRequest.imp[0].banner).to.not.equal(null); }); - it('should properly build a banner request with sizes defined in 2d array', () => { + it('should properly build a banner request with sizes defined in 2d array', function () { const bidRequests = [{ bidder: 'somoaudience', sizes: [[300, 250]], @@ -69,7 +69,7 @@ describe('Somo Audience Adapter Tests', () => { expect(ortbRequest.imp[0].banner.w).to.equal(300); expect(ortbRequest.imp[0].banner.h).to.equal(250); }); - it('should properly build a banner request with sizes defined in 1d array', () => { + it('should properly build a banner request with sizes defined in 1d array', function () { const bidRequests = [{ bidder: 'somoaudience', sizes: [300, 250], @@ -96,7 +96,7 @@ describe('Somo Audience Adapter Tests', () => { expect(ortbRequest.imp[0].banner.battr).to.equal(undefined); }); - it('should populate optional banner parameters', () => { + it('should populate optional banner parameters', function () { const bidRequests = [ { bidder: 'somoaudience', @@ -125,8 +125,8 @@ describe('Somo Audience Adapter Tests', () => { }); }); - describe('buildVideoRequests', () => { - it('should properly build a video request with sizes defined', () => { + describe('buildVideoRequests', function () { + it('should properly build a video request with sizes defined', function () { const bidRequests = [{ bidder: 'somoaudience', mediaTypes: { @@ -149,7 +149,7 @@ describe('Somo Audience Adapter Tests', () => { expect(ortbRequest.imp[0].video.h).to.equal(300); }); - it('should properly build a video request with sizes defined in 2d array', () => { + it('should properly build a video request with sizes defined in 2d array', function () { const bidRequests = [{ bidder: 'somoaudience', mediaTypes: { @@ -171,7 +171,7 @@ describe('Somo Audience Adapter Tests', () => { expect(ortbRequest.imp[0].video.w).to.equal(200); expect(ortbRequest.imp[0].video.h).to.equal(300); }); - it('should properly build a video request with sizes not defined', () => { + it('should properly build a video request with sizes not defined', function () { const bidRequests = [{ bidder: 'somoaudience', mediaType: 'video', @@ -196,7 +196,7 @@ describe('Somo Audience Adapter Tests', () => { expect(ortbRequest.imp[0].video.battr).to.equal(undefined); }); - it('should populate optional video parameters', () => { + it('should populate optional video parameters', function () { const bidRequests = [ { bidder: 'somoaudience', @@ -239,8 +239,8 @@ describe('Somo Audience Adapter Tests', () => { }); }); - describe('buildSiteRequests', () => { - it('should fill in basic site parameters', () => { + describe('buildSiteRequests', function () { + it('should fill in basic site parameters', function () { const bidRequests = [{ bidder: 'somoaudience', params: { @@ -256,7 +256,7 @@ describe('Somo Audience Adapter Tests', () => { expect(ortbRequest.site.domain).to.not.be.undefined; }); - it('should fill in optional site parameters', () => { + it('should fill in optional site parameters', function () { const bidRequests = [{ bidder: 'somoaudience', params: { @@ -282,8 +282,8 @@ describe('Somo Audience Adapter Tests', () => { }) }); - describe('buildAppRequests', () => { - it('should fill in app parameters', () => { + describe('buildAppRequests', function () { + it('should fill in app parameters', function () { const bidRequests = [{ bidder: 'somoaudience', params: { @@ -315,7 +315,7 @@ describe('Somo Audience Adapter Tests', () => { }); }); - describe('buildGDPRRequests', () => { + describe('buildGDPRRequests', function () { const bidderRequest = { gdprConsent: { gdprApplies: true, @@ -323,7 +323,7 @@ describe('Somo Audience Adapter Tests', () => { }, }; - it('should properly build request with gdpr consent', () => { + it('should properly build request with gdpr consent', function () { const bidRequests = [{ bidder: 'somoaudience', params: { @@ -339,7 +339,7 @@ describe('Somo Audience Adapter Tests', () => { expect(ortbRequest.user.ext).to.not.equal(undefined); expect(ortbRequest.user.ext.consent).to.equal('test'); }); - it('should properly build request with gdpr not applies', () => { + it('should properly build request with gdpr not applies', function () { bidderRequest.gdprConsent.gdprApplies = false; const bidRequests = [{ bidder: 'somoaudience', @@ -358,8 +358,8 @@ describe('Somo Audience Adapter Tests', () => { }); }); - describe('buildExtraArgsRequests', () => { - it('should populate optional parameters', () => { + describe('buildExtraArgsRequests', function () { + it('should populate optional parameters', function () { const bidRequests = [ { bidder: 'somoaudience', @@ -385,8 +385,8 @@ describe('Somo Audience Adapter Tests', () => { }); }); - describe('interpretResponse', () => { - it('Verify banner parse response', () => { + describe('interpretResponse', function () { + it('Verify banner parse response', function () { const bidRequests = [ { bidder: 'somoaudience', @@ -414,7 +414,7 @@ describe('Somo Audience Adapter Tests', () => { expect(bid.ad).to.equal('Somo Test Ad'); }); - it('Verify video parse response', () => { + it('Verify video parse response', function () { const bidRequests = [ { bidder: 'somoaudience', @@ -447,8 +447,8 @@ describe('Somo Audience Adapter Tests', () => { }); }); - describe('user sync', () => { - it('should register the pixel sync url', () => { + describe('user sync', function () { + it('should register the pixel sync url', function () { let syncs = spec.getUserSyncs({ pixelEnabled: true }); @@ -457,7 +457,7 @@ describe('Somo Audience Adapter Tests', () => { expect(syncs[0].type).to.equal('image'); }); - it('should pass gdpr params', () => { + it('should pass gdpr params', function () { let syncs = spec.getUserSyncs({ pixelEnabled: true }, {}, { gdprApplies: false, consentString: 'test' }); @@ -467,7 +467,7 @@ describe('Somo Audience Adapter Tests', () => { expect(syncs[0].url).to.contains('gdpr=0'); }); - it('should pass gdpr applies params', () => { + it('should pass gdpr applies params', function () { let syncs = spec.getUserSyncs({ pixelEnabled: true }, {}, { gdprApplies: true, consentString: 'test' }); diff --git a/test/spec/modules/sonobiBidAdapter_spec.js b/test/spec/modules/sonobiBidAdapter_spec.js index 1b0986cb8c1..349a2e80263 100644 --- a/test/spec/modules/sonobiBidAdapter_spec.js +++ b/test/spec/modules/sonobiBidAdapter_spec.js @@ -2,22 +2,22 @@ import { expect } from 'chai' import { spec, _getPlatform } from 'modules/sonobiBidAdapter' import { newBidder } from 'src/adapters/bidderFactory' -describe('SonobiBidAdapter', () => { +describe('SonobiBidAdapter', function () { const adapter = newBidder(spec) - describe('.code', () => { - it('should return a bidder code of sonobi', () => { + describe('.code', function () { + it('should return a bidder code of sonobi', function () { expect(spec.code).to.equal('sonobi') }) }) - describe('inherited functions', () => { - it('should exist and be a function', () => { + describe('inherited functions', function () { + it('should exist and be a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function') }) }) - describe('.isBidRequestValid', () => { + describe('.isBidRequestValid', function () { let bid = { 'bidder': 'sonobi', 'params': { @@ -32,11 +32,11 @@ describe('SonobiBidAdapter', () => { 'auctionId': '1d1a030790a475', } - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true) }) - it('should return true when bid.params.placement_id and bid.params.sizes are found', () => { + it('should return true when bid.params.placement_id and bid.params.sizes are found', function () { let bid = Object.assign({}, bid) delete bid.params delete bid.sizes @@ -48,7 +48,7 @@ describe('SonobiBidAdapter', () => { expect(spec.isBidRequestValid(bid)).to.equal(true) }) - it('should return true when bid.params.placement_id and bid.sizes are found', () => { + it('should return true when bid.params.placement_id and bid.sizes are found', function () { let bid = Object.assign({}, bid) delete bid.params bid.sizes = [[300, 250], [300, 600]] @@ -59,7 +59,7 @@ describe('SonobiBidAdapter', () => { expect(spec.isBidRequestValid(bid)).to.equal(true) }) - it('should return true when bid.params.ad_unit and bid.params.sizes are found', () => { + it('should return true when bid.params.ad_unit and bid.params.sizes are found', function () { let bid = Object.assign({}, bid) delete bid.params delete bid.sizes @@ -71,7 +71,7 @@ describe('SonobiBidAdapter', () => { expect(spec.isBidRequestValid(bid)).to.equal(true) }) - it('should return true when bid.params.ad_unit and bid.sizes are found', () => { + it('should return true when bid.params.ad_unit and bid.sizes are found', function () { let bid = Object.assign({}, bid) delete bid.params bid.sizes = [[300, 250], [300, 600]] @@ -82,13 +82,13 @@ describe('SonobiBidAdapter', () => { expect(spec.isBidRequestValid(bid)).to.equal(true) }) - it('should return false when no params are found', () => { + it('should return false when no params are found', function () { let bid = Object.assign({}, bid) delete bid.params expect(spec.isBidRequestValid(bid)).to.equal(false) }) - it('should return false when bid.params.placement_id and bid.params.ad_unit are not found', () => { + it('should return false when bid.params.placement_id and bid.params.ad_unit are not found', function () { let bid = Object.assign({}, bid) delete bid.params bid.params = { @@ -100,7 +100,7 @@ describe('SonobiBidAdapter', () => { }) }) - describe('.buildRequests', () => { + describe('.buildRequests', function () { let bidRequest = [{ 'bidder': 'sonobi', 'params': { @@ -138,7 +138,7 @@ describe('SonobiBidAdapter', () => { }, }; - it('should return a properly formatted request', () => { + it('should return a properly formatted request', function () { const bidRequests = spec.buildRequests(bidRequest) const bidRequestsPageViewID = spec.buildRequests(bidRequest) expect(bidRequests.url).to.equal('https://apex.go.sonobi.com/trinity.json') @@ -153,7 +153,7 @@ describe('SonobiBidAdapter', () => { expect(['mobile', 'tablet', 'desktop']).to.contain(bidRequests.data.vp); }) - it('should return a properly formatted request with GDPR applies set to true', () => { + it('should return a properly formatted request with GDPR applies set to true', function () { const bidRequests = spec.buildRequests(bidRequest, bidderRequests) expect(bidRequests.url).to.equal('https://apex.go.sonobi.com/trinity.json') expect(bidRequests.method).to.equal('GET') @@ -161,7 +161,7 @@ describe('SonobiBidAdapter', () => { expect(bidRequests.data.consent_string).to.equal('BOJ/P2HOJ/P2HABABMAAAAAZ+A==') }) - it('should return a properly formatted request with GDPR applies set to false', () => { + it('should return a properly formatted request with GDPR applies set to false', function () { bidderRequests.gdprConsent.gdprApplies = false; const bidRequests = spec.buildRequests(bidRequest, bidderRequests) expect(bidRequests.url).to.equal('https://apex.go.sonobi.com/trinity.json') @@ -169,7 +169,7 @@ describe('SonobiBidAdapter', () => { expect(bidRequests.data.gdpr).to.equal('false') expect(bidRequests.data.consent_string).to.equal('BOJ/P2HOJ/P2HABABMAAAAAZ+A==') }) - it('should return a properly formatted request with GDPR applies set to false with no consent_string param', () => { + it('should return a properly formatted request with GDPR applies set to false with no consent_string param', function () { let bidderRequests = { 'gdprConsent': { 'consentString': undefined, @@ -183,7 +183,7 @@ describe('SonobiBidAdapter', () => { expect(bidRequests.data.gdpr).to.equal('false') expect(bidRequests.data).to.not.include.keys('consent_string') }) - it('should return a properly formatted request with GDPR applies set to true with no consent_string param', () => { + it('should return a properly formatted request with GDPR applies set to true with no consent_string param', function () { let bidderRequests = { 'gdprConsent': { 'consentString': undefined, @@ -197,7 +197,7 @@ describe('SonobiBidAdapter', () => { expect(bidRequests.data.gdpr).to.equal('true') expect(bidRequests.data).to.not.include.keys('consent_string') }) - it('should return a properly formatted request with hfa', () => { + it('should return a properly formatted request with hfa', function () { bidRequest[0].params.hfa = 'hfakey' bidRequest[1].params.hfa = 'hfakey' const bidRequests = spec.buildRequests(bidRequest) @@ -208,13 +208,13 @@ describe('SonobiBidAdapter', () => { expect(bidRequests.data.hfa).to.equal('hfakey') }) - it('should return null if there is nothing to bid on', () => { + it('should return null if there is nothing to bid on', function () { const bidRequests = spec.buildRequests([{params: {}}]) expect(bidRequests).to.equal(null); }) }) - describe('.interpretResponse', () => { + describe('.interpretResponse', function () { const bidRequests = { 'method': 'GET', 'url': 'https://apex.go.sonobi.com/trinity.json', @@ -316,7 +316,7 @@ describe('SonobiBidAdapter', () => { } ]; - it('should map bidResponse to prebidResponse', () => { + it('should map bidResponse to prebidResponse', function () { const response = spec.interpretResponse(bidResponse, bidRequests); response.forEach(resp => { let regx = /http:\/\/localhost:9876\/.*?(?="|$)/ @@ -326,7 +326,7 @@ describe('SonobiBidAdapter', () => { }) }) - describe('.getUserSyncs', () => { + describe('.getUserSyncs', function () { let bidResponse = [{ 'body': { 'sbi_px': [{ @@ -338,35 +338,35 @@ describe('SonobiBidAdapter', () => { } }]; - it('should return one sync pixel', () => { + it('should return one sync pixel', function () { expect(spec.getUserSyncs({ pixelEnabled: true }, bidResponse)).to.deep.equal([{ type: 'image', url: 'https://pixel-test' }]); }) - it('should return an empty array when sync is enabled but there are no bidResponses', () => { + it('should return an empty array when sync is enabled but there are no bidResponses', function () { expect(spec.getUserSyncs({ pixelEnabled: true }, [])).to.have.length(0); }) - it('should return an empty array when sync is enabled but no sync pixel returned', () => { + it('should return an empty array when sync is enabled but no sync pixel returned', function () { const pixel = Object.assign({}, bidResponse); delete pixel[0].body.sbi_px; expect(spec.getUserSyncs({ pixelEnabled: true }, bidResponse)).to.have.length(0); }) - it('should return an empty array', () => { + it('should return an empty array', function () { expect(spec.getUserSyncs({ pixelEnabled: false }, bidResponse)).to.have.length(0); expect(spec.getUserSyncs({ pixelEnabled: true }, [])).to.have.length(0); }); }) - describe('_getPlatform', () => { - it('should return mobile', () => { + describe('_getPlatform', function () { + it('should return mobile', function () { expect(_getPlatform({innerWidth: 767})).to.equal('mobile') }) - it('should return tablet', () => { + it('should return tablet', function () { expect(_getPlatform({innerWidth: 800})).to.equal('tablet') }) - it('should return desktop', () => { + it('should return desktop', function () { expect(_getPlatform({innerWidth: 1000})).to.equal('desktop') }) }) diff --git a/test/spec/modules/sortableBidAdapter_spec.js b/test/spec/modules/sortableBidAdapter_spec.js index 6f1c9efba84..09f5b4f7514 100644 --- a/test/spec/modules/sortableBidAdapter_spec.js +++ b/test/spec/modules/sortableBidAdapter_spec.js @@ -9,7 +9,7 @@ const ENDPOINT = `//c.deployads.com/openrtb2/auction?src=${REPO_AND_VERSION}&hos describe('sortableBidAdapter', function() { const adapter = newBidder(spec); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { function makeBid() { return { 'bidder': 'sortable', @@ -35,35 +35,35 @@ describe('sortableBidAdapter', function() { }; } - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(makeBid())).to.equal(true); }); - it('should return false when tagId not passed correctly', () => { + it('should return false when tagId not passed correctly', function () { let bid = makeBid(); delete bid.params.tagId; expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should return false when sizes not passed correctly', () => { + it('should return false when sizes not passed correctly', function () { let bid = makeBid(); delete bid.sizes; expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should return false when sizes are wrong length', () => { + it('should return false when sizes are wrong length', function () { let bid = makeBid(); bid.sizes = [[300]]; expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should return false when require params are not passed', () => { + it('should return false when require params are not passed', function () { let bid = makeBid(); bid.params = {}; expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should return false when the floorSizeMap is invalid', () => { + it('should return false when the floorSizeMap is invalid', function () { let bid = makeBid(); bid.params.floorSizeMap = { 'sixforty by foureighty': 1234 @@ -77,14 +77,14 @@ describe('sortableBidAdapter', function() { expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should return true when the floorSizeMap is missing or empty', () => { + it('should return true when the floorSizeMap is missing or empty', function () { let bid = makeBid(); bid.params.floorSizeMap = {}; expect(spec.isBidRequestValid(bid)).to.equal(true); delete bid.params.floorSizeMap; expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when the keywords are invalid', () => { + it('should return false when the keywords are invalid', function () { let bid = makeBid(); bid.params.keywords = { 'badval': 1234 @@ -94,7 +94,7 @@ describe('sortableBidAdapter', function() { expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should return true when the keywords are missing or empty', () => { + it('should return true when the keywords are missing or empty', function () { let bid = makeBid(); bid.params.keywords = {}; expect(spec.isBidRequestValid(bid)).to.equal(true); @@ -103,7 +103,7 @@ describe('sortableBidAdapter', function() { }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { const bidRequests = [{ 'bidder': 'sortable', 'params': { @@ -130,25 +130,25 @@ describe('sortableBidAdapter', function() { const request = spec.buildRequests(bidRequests); const requestBody = JSON.parse(request.data); - it('sends bid request to our endpoint via POST', () => { + it('sends bid request to our endpoint via POST', function () { expect(request.method).to.equal('POST'); }); - it('attaches source and version to endpoint URL as query params', () => { + it('attaches source and version to endpoint URL as query params', function () { expect(request.url).to.equal(ENDPOINT); }); - it('sends screen dimensions', () => { + it('sends screen dimensions', function () { expect(requestBody.site.device.w).to.equal(screen.width); expect(requestBody.site.device.h).to.equal(screen.height); }); - it('includes the ad size in the bid request', () => { + it('includes the ad size in the bid request', function () { expect(requestBody.imp[0].banner.format[0].w).to.equal(300); expect(requestBody.imp[0].banner.format[0].h).to.equal(250); }); - it('includes the params in the bid request', () => { + it('includes the params in the bid request', function () { expect(requestBody.imp[0].ext.keywords).to.deep.equal( {'key1': 'val1', 'key2': 'val2'} @@ -158,7 +158,7 @@ describe('sortableBidAdapter', function() { expect(requestBody.imp[0].bidfloor).to.equal(0.21); }); - it('should have the floor size map set', () => { + it('should have the floor size map set', function () { expect(requestBody.imp[0].ext.floorSizeMap).to.deep.equal({ '728x90': 0.15, '300x250': 1.20 @@ -166,7 +166,7 @@ describe('sortableBidAdapter', function() { }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { function makeResponse() { return { body: { @@ -208,13 +208,13 @@ describe('sortableBidAdapter', function() { 'ad': '
' }; - it('should get the correct bid response', () => { + it('should get the correct bid response', function () { let result = spec.interpretResponse(makeResponse()); expect(result.length).to.equal(1); expect(result[0]).to.deep.equal(expectedBid); }); - it('should handle a missing crid', () => { + it('should handle a missing crid', function () { let noCridResponse = makeResponse(); delete noCridResponse.body.seatbid[0].bid[0].crid; const fallbackCrid = noCridResponse.body.seatbid[0].bid[0].id; @@ -224,7 +224,7 @@ describe('sortableBidAdapter', function() { expect(result[0]).to.deep.equal(noCridResult); }); - it('should handle a missing nurl', () => { + it('should handle a missing nurl', function () { let noNurlResponse = makeResponse(); delete noNurlResponse.body.seatbid[0].bid[0].nurl; let noNurlResult = Object.assign({}, expectedBid); @@ -234,7 +234,7 @@ describe('sortableBidAdapter', function() { expect(result[0]).to.deep.equal(noNurlResult); }); - it('should handle a missing adm', () => { + it('should handle a missing adm', function () { let noAdmResponse = makeResponse(); delete noAdmResponse.body.seatbid[0].bid[0].adm; let noAdmResult = Object.assign({}, expectedBid); @@ -245,7 +245,7 @@ describe('sortableBidAdapter', function() { expect(result[0]).to.deep.equal(noAdmResult); }); - it('handles empty bid response', () => { + it('handles empty bid response', function () { let response = { body: { 'id': '5e5c23a5ba71e78', diff --git a/test/spec/modules/sovrnBidAdapter_spec.js b/test/spec/modules/sovrnBidAdapter_spec.js index dd3a43a3f0c..0f1c0d43396 100644 --- a/test/spec/modules/sovrnBidAdapter_spec.js +++ b/test/spec/modules/sovrnBidAdapter_spec.js @@ -8,7 +8,7 @@ const ENDPOINT = `//ap.lijit.com/rtb/bid?src=${REPO_AND_VERSION}`; describe('sovrnBidAdapter', function() { const adapter = newBidder(spec); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { 'bidder': 'sovrn', 'params': { @@ -23,23 +23,23 @@ describe('sovrnBidAdapter', function() { 'auctionId': '1d1a030790a475', }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when tagid not passed correctly', () => { + it('should return false when tagid not passed correctly', function () { bid.params.tagid = 'ABCD'; expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should return false when require params are not passed', () => { + it('should return false when require params are not passed', function () { let bid = Object.assign({}, bid); bid.params = {}; expect(spec.isBidRequestValid(bid)).to.equal(false); }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { const bidRequests = [{ 'bidder': 'sovrn', 'params': { @@ -56,15 +56,15 @@ describe('sovrnBidAdapter', function() { const request = spec.buildRequests(bidRequests); - it('sends bid request to our endpoint via POST', () => { + it('sends bid request to our endpoint via POST', function () { expect(request.method).to.equal('POST'); }); - it('attaches source and version to endpoint URL as query params', () => { + it('attaches source and version to endpoint URL as query params', function () { expect(request.url).to.equal(ENDPOINT) }); - it('sends \'iv\' as query param if present', () => { + it('sends \'iv\' as query param if present', function () { const ivBidRequests = [{ 'bidder': 'sovrn', 'params': { @@ -84,7 +84,7 @@ describe('sovrnBidAdapter', function() { expect(request.url).to.contain('iv=vet') }); - it('sends gdpr info if exists', () => { + it('sends gdpr info if exists', function () { let consentString = 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A=='; let bidderRequest = { 'bidderCode': 'sovrn', @@ -107,7 +107,7 @@ describe('sovrnBidAdapter', function() { expect(payload.user.ext.consent).to.equal(consentString); }); - it('converts tagid to string', () => { + it('converts tagid to string', function () { const ivBidRequests = [{ 'bidder': 'sovrn', 'params': { @@ -128,9 +128,9 @@ describe('sovrnBidAdapter', function() { }) }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { let response; - beforeEach(() => { + beforeEach(function () { response = { body: { 'id': '37386aade21a71', @@ -150,7 +150,7 @@ describe('sovrnBidAdapter', function() { }; }); - it('should get the correct bid response', () => { + it('should get the correct bid response', function () { let expectedResponse = [{ 'requestId': '263c448586f5a1', 'cpm': 0.45882675, @@ -169,7 +169,7 @@ describe('sovrnBidAdapter', function() { expect(Object.keys(result[0])).to.deep.equal(Object.keys(expectedResponse[0])); }); - it('crid should default to the bid id if not on the response', () => { + it('crid should default to the bid id if not on the response', function () { delete response.body.seatbid[0].bid[0].crid; let expectedResponse = [{ 'requestId': '263c448586f5a1', @@ -189,7 +189,7 @@ describe('sovrnBidAdapter', function() { expect(Object.keys(result[0])).to.deep.equal(Object.keys(expectedResponse[0])); }); - it('should get correct bid response when dealId is passed', () => { + it('should get correct bid response when dealId is passed', function () { response.body.dealid = 'baking'; let expectedResponse = [{ @@ -210,7 +210,7 @@ describe('sovrnBidAdapter', function() { expect(Object.keys(result[0])).to.deep.equal(Object.keys(expectedResponse[0])); }); - it('handles empty bid response', () => { + it('handles empty bid response', function () { let response = { body: { 'id': '37386aade21a71', diff --git a/test/spec/modules/telariaBidAdapter_spec.js b/test/spec/modules/telariaBidAdapter_spec.js index 2483ec70e76..6b5278c20ae 100644 --- a/test/spec/modules/telariaBidAdapter_spec.js +++ b/test/spec/modules/telariaBidAdapter_spec.js @@ -34,26 +34,26 @@ const RESPONSE = { }] }; -describe('TelariaAdapter', () => { +describe('TelariaAdapter', function () { const adapter = newBidder(spec); - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = REQUEST.bids[0]; - it('should return true when required params found', () => { + it('should return true when required params found', function () { let tempBid = bid; tempBid.params.adCode = 'ssp-!demo!-lufip'; tempBid.params.supplyCode = 'ssp-demo-rm6rh'; expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return true when required params found', () => { + it('should return true when required params found', function () { let tempBid = bid; delete tempBid.params; tempBid.params = { @@ -64,14 +64,14 @@ describe('TelariaAdapter', () => { expect(spec.isBidRequestValid(tempBid)).to.equal(true); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let tempBid = bid; tempBid.params = {}; expect(spec.isBidRequestValid(tempBid)).to.equal(false); }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { const stub = [{ bidder: 'tremor', sizes: [[300, 250], [300, 600]], @@ -82,16 +82,16 @@ describe('TelariaAdapter', () => { } }]; - it('exists and is a function', () => { + it('exists and is a function', function () { expect(spec.buildRequests).to.exist.and.to.be.a('function'); }); - it('requires supply code, ad code and sizes to make a request', () => { + it('requires supply code, ad code and sizes to make a request', function () { const tempRequest = spec.buildRequests(stub); expect(tempRequest.length).to.equal(1); }); - it('generates an array of requests with 4 params, method, url, bidId and vastUrl', () => { + it('generates an array of requests with 4 params, method, url, bidId and vastUrl', function () { const tempRequest = spec.buildRequests(stub); expect(tempRequest.length).to.equal(1); @@ -101,7 +101,7 @@ describe('TelariaAdapter', () => { expect(tempRequest[0].vastUrl).to.exist; }); - it('requires sizes to make a request', () => { + it('requires sizes to make a request', function () { let tempBid = stub; tempBid[0].sizes = null; const tempRequest = spec.buildRequests(tempBid); @@ -109,13 +109,13 @@ describe('TelariaAdapter', () => { expect(tempRequest.length).to.equal(0); }); - it('generates a valid request with sizes as an array of two elements', () => { + it('generates a valid request with sizes as an array of two elements', function () { let tempBid = stub; tempBid[0].sizes = [640, 480]; expect(spec.buildRequests(tempBid).length).to.equal(1); }); - it('requires ad code and supply code to make a request', () => { + it('requires ad code and supply code to make a request', function () { let tempBid = stub; tempBid[0].params.adCode = null; tempBid[0].params.supplyCode = null; @@ -126,7 +126,7 @@ describe('TelariaAdapter', () => { }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { const responseStub = RESPONSE; const stub = [{ bidder: 'tremor', @@ -138,7 +138,7 @@ describe('TelariaAdapter', () => { } }]; - it('should get correct bid response', () => { + it('should get correct bid response', function () { let expectedResponseKeys = ['bidderCode', 'width', 'height', 'statusMessage', 'adId', 'mediaType', 'source', 'getStatusCode', 'getSize', 'requestId', 'cpm', 'creativeId', 'vastXml', 'vastUrl', 'currency', 'netRevenue', 'ttl', 'ad']; @@ -149,7 +149,7 @@ describe('TelariaAdapter', () => { expect(Object.keys(result[0])).to.have.members(expectedResponseKeys); }); - it('handles nobid responses', () => { + it('handles nobid responses', function () { let tempResponse = responseStub; tempResponse.seatbid = []; @@ -160,18 +160,18 @@ describe('TelariaAdapter', () => { expect(result.length).to.equal(0); }); - it('handles invalid responses', () => { + it('handles invalid responses', function () { let result = spec.interpretResponse(null, {bbidderCode: 'telaria'}); expect(result.length).to.equal(0); }); - it('handles error responses', () => { + it('handles error responses', function () { let result = spec.interpretResponse({body: {error: 'Invalid request'}}, {bbidderCode: 'telaria'}); expect(result.length).to.equal(0); }); }); - describe('getUserSyncs', () => { + describe('getUserSyncs', function () { const responses = [{body: RESPONSE}]; responses[0].body.ext = { telaria: { @@ -182,7 +182,7 @@ describe('TelariaAdapter', () => { } }; - it('should get the correct number of sync urls', () => { + it('should get the correct number of sync urls', function () { let urls = spec.getUserSyncs({pixelEnabled: true}, responses); expect(urls.length).to.equal(2); }); diff --git a/test/spec/modules/trionBidAdapter_spec.js b/test/spec/modules/trionBidAdapter_spec.js index 559122a2772..805ae70a339 100644 --- a/test/spec/modules/trionBidAdapter_spec.js +++ b/test/spec/modules/trionBidAdapter_spec.js @@ -35,22 +35,24 @@ const TRION_BID_RESPONSE = { }; -describe('Trion adapter tests', () => { +describe('Trion adapter tests', function () { let adapter; - beforeEach(() => { + beforeEach(function () { // adapter = trionAdapter.createNew(); sinon.stub(document.body, 'appendChild'); }); - afterEach(() => document.body.appendChild.restore()); + afterEach(function () { + document.body.appendChild.restore(); + }); - describe('isBidRequestValid', () => { - it('should return true with correct params', () => { + describe('isBidRequestValid', function () { + it('should return true with correct params', function () { expect(spec.isBidRequestValid(TRION_BID)).to.equal(true); }); - it('should return false when params are missing', () => { + it('should return false when params are missing', function () { TRION_BID.params = {}; expect(spec.isBidRequestValid(TRION_BID)).to.equal(false); @@ -60,7 +62,7 @@ describe('Trion adapter tests', () => { }; }); - it('should return false when pubId is missing', () => { + it('should return false when pubId is missing', function () { TRION_BID.params = { sectionId: '2' }; @@ -72,7 +74,7 @@ describe('Trion adapter tests', () => { }; }); - it('should return false when sectionId is missing', () => { + it('should return false when sectionId is missing', function () { TRION_BID.params = { pubId: '1' }; @@ -85,20 +87,20 @@ describe('Trion adapter tests', () => { }); }); - describe('buildRequests', () => { - it('should return bids requests with empty params', () => { + describe('buildRequests', function () { + it('should return bids requests with empty params', function () { let bidRequests = spec.buildRequests([]); expect(bidRequests.length).to.equal(0); }); - it('should include the base bidrequest url', () => { + it('should include the base bidrequest url', function () { let bidRequests = spec.buildRequests(TRION_BID_REQUEST); let bidUrl = bidRequests[0].url; expect(bidUrl).to.include(BID_REQUEST_BASE_URL); }); - it('should call buildRequests with the correct required params', () => { + it('should call buildRequests with the correct required params', function () { let bidRequests = spec.buildRequests(TRION_BID_REQUEST); let bidUrlParams = bidRequests[0].data; @@ -107,7 +109,7 @@ describe('Trion adapter tests', () => { expect(bidUrlParams).to.include('sizes=300x250,300x600'); }); - it('should call buildRequests with the correct optional params', () => { + it('should call buildRequests with the correct optional params', function () { let params = TRION_BID_REQUEST[0].params; params.re = 1; let bidRequests = spec.buildRequests(TRION_BID_REQUEST); @@ -119,13 +121,13 @@ describe('Trion adapter tests', () => { }); }); - describe('interpretResponse', () => { - it('when there is no response do not bid', () => { + describe('interpretResponse', function () { + it('when there is no response do not bid', function () { let response = spec.interpretResponse(null, {bidRequest: TRION_BID}); expect(response).to.deep.equal([]); }); - it('when place bid is returned as false', () => { + it('when place bid is returned as false', function () { TRION_BID_RESPONSE.result.placeBid = false; let response = spec.interpretResponse({body: TRION_BID_RESPONSE}, {bidRequest: TRION_BID}); @@ -134,21 +136,21 @@ describe('Trion adapter tests', () => { TRION_BID_RESPONSE.result.placeBid = true; }); - it('when no cpm is in the response', () => { + it('when no cpm is in the response', function () { TRION_BID_RESPONSE.result.cpm = 0; let response = spec.interpretResponse({body: TRION_BID_RESPONSE}, {bidRequest: TRION_BID}); expect(response).to.deep.equal([]); TRION_BID_RESPONSE.result.cpm = 1; }); - it('when no ad is in the response', () => { + it('when no ad is in the response', function () { TRION_BID_RESPONSE.result.ad = null; let response = spec.interpretResponse({body: TRION_BID_RESPONSE}, {bidRequest: TRION_BID}); expect(response).to.deep.equal([]); TRION_BID_RESPONSE.result.ad = 'test'; }); - it('height and width are appropriately set', () => { + it('height and width are appropriately set', function () { let bidWidth = '1'; let bidHeight = '2'; TRION_BID_RESPONSE.result.width = bidWidth; @@ -160,7 +162,7 @@ describe('Trion adapter tests', () => { TRION_BID_RESPONSE.result.height = '250'; }); - it('cpm is properly set and transformed to cents', () => { + it('cpm is properly set and transformed to cents', function () { let bidCpm = 2; TRION_BID_RESPONSE.result.cpm = bidCpm * 100; let response = spec.interpretResponse({body: TRION_BID_RESPONSE}, {bidRequest: TRION_BID}); @@ -169,15 +171,15 @@ describe('Trion adapter tests', () => { }); }); - describe('getUserSyncs', () => { + describe('getUserSyncs', function () { const USER_SYNC_URL = 'https://in-appadvertising.com/api/userSync.html'; const BASE_KEY = '_trion_'; - beforeEach(() => { + beforeEach(function () { delete window.TR_INT_T; }); - it('trion int is included in bid url', () => { + it('trion int is included in bid url', function () { window.TR_INT_T = 'test_user_sync'; let userTag = encodeURIComponent(window.TR_INT_T); let bidRequests = spec.buildRequests(TRION_BID_REQUEST); @@ -186,7 +188,7 @@ describe('Trion adapter tests', () => { expect(bidUrlParams).to.include(userTag); }); - it('should register trion user script', () => { + it('should register trion user script', function () { let syncs = spec.getUserSyncs({iframeEnabled: true}); let url = utils.getTopWindowUrl(); let pubId = 1; @@ -195,7 +197,7 @@ describe('Trion adapter tests', () => { expect(syncs[0]).to.deep.equal({type: 'iframe', url: USER_SYNC_URL + syncString}); }); - it('should except posted messages from user sync script', () => { + it('should except posted messages from user sync script', function () { let testId = 'testId'; let message = BASE_KEY + 'userId=' + testId; setStorageData(BASE_KEY + 'int_t', null); @@ -204,7 +206,7 @@ describe('Trion adapter tests', () => { expect(newKey).to.equal(testId); }); - it('should not try to post messages not from trion', () => { + it('should not try to post messages not from trion', function () { let testId = 'testId'; let badId = 'badId'; let message = 'Not Trion: userId=' + testId; diff --git a/test/spec/modules/tripleliftBidAdapter_spec.js b/test/spec/modules/tripleliftBidAdapter_spec.js index ed343f1ebf9..d3013d9be22 100644 --- a/test/spec/modules/tripleliftBidAdapter_spec.js +++ b/test/spec/modules/tripleliftBidAdapter_spec.js @@ -5,16 +5,16 @@ import { deepClone } from 'src/utils'; const ENDPOINT = document.location.protocol + '//tlx.3lift.com/header/auction?'; -describe('triplelift adapter', () => { +describe('triplelift adapter', function () { const adapter = newBidder(tripleliftAdapterSpec); - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { bidder: 'triplelift', params: { @@ -28,11 +28,11 @@ describe('triplelift adapter', () => { 'auctionId': '1d1a030790a475', }; - it('should return true for valid bid request', () => { + it('should return true for valid bid request', function () { expect(tripleliftAdapterSpec.isBidRequestValid(bid)).to.equal(true); }); - it('should return true when required params found', () => { + it('should return true when required params found', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -42,7 +42,7 @@ describe('triplelift adapter', () => { expect(tripleliftAdapterSpec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -52,7 +52,7 @@ describe('triplelift adapter', () => { }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let bidRequests = [ { bidder: 'triplelift', @@ -68,18 +68,18 @@ describe('triplelift adapter', () => { } ]; - it('exists and is an object', () => { + it('exists and is an object', function () { const request = tripleliftAdapterSpec.buildRequests(bidRequests); expect(request).to.exist.and.to.be.a('object'); }); - it('should only parse sizes that are of the proper length and format', () => { + it('should only parse sizes that are of the proper length and format', function () { const request = tripleliftAdapterSpec.buildRequests(bidRequests); expect(request.data.imp[0].banner.format).to.have.length(2); expect(request.data.imp[0].banner.format).to.deep.equal([{w: 300, h: 250}, {w: 300, h: 600}]); }); - it('should be a post request and populate the payload', () => { + it('should be a post request and populate the payload', function () { const request = tripleliftAdapterSpec.buildRequests(bidRequests); const payload = request.data; expect(payload).to.exist; @@ -88,7 +88,7 @@ describe('triplelift adapter', () => { expect(payload.imp[0].banner.format).to.deep.equal([{w: 300, h: 250}, {w: 300, h: 600}]); }); - it('should return a query string for TL call', () => { + it('should return a query string for TL call', function () { const request = tripleliftAdapterSpec.buildRequests(bidRequests); const url = request.url; expect(url).to.exist; @@ -101,7 +101,7 @@ describe('triplelift adapter', () => { }) }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { let response = { body: { bids: [ @@ -136,7 +136,7 @@ describe('triplelift adapter', () => { } }; - it('should get correct bid response', () => { + it('should get correct bid response', function () { let expectedResponse = [ { requestId: '3db3773286ee59', @@ -156,7 +156,7 @@ describe('triplelift adapter', () => { expect(Object.keys(result[0])).to.have.members(Object.keys(expectedResponse[0])); }); - it('should return multile responses to support SRA', () => { + it('should return multile responses to support SRA', function () { let response = { body: { bids: [ diff --git a/test/spec/modules/trustxBidAdapter_spec.js b/test/spec/modules/trustxBidAdapter_spec.js index 2e099772593..9f2fdca6a99 100644 --- a/test/spec/modules/trustxBidAdapter_spec.js +++ b/test/spec/modules/trustxBidAdapter_spec.js @@ -5,13 +5,13 @@ import { newBidder } from 'src/adapters/bidderFactory'; describe('TrustXAdapter', function () { const adapter = newBidder(spec); - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { 'bidder': 'trustx', 'params': { @@ -24,11 +24,11 @@ describe('TrustXAdapter', function () { 'auctionId': '1d1a030790a475', }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -38,7 +38,7 @@ describe('TrustXAdapter', function () { }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { function parseRequest(url) { const res = {}; url.split('&').forEach((it) => { @@ -83,7 +83,7 @@ describe('TrustXAdapter', function () { } ]; - it('should attach valid params to the tag', () => { + it('should attach valid params to the tag', function () { const request = spec.buildRequests([bidRequests[0]]); expect(request.data).to.be.an('string'); const payload = parseRequest(request.data); @@ -93,7 +93,7 @@ describe('TrustXAdapter', function () { expect(payload).to.have.property('r', '22edbae2733bf6'); }); - it('auids must not be duplicated', () => { + it('auids must not be duplicated', function () { const request = spec.buildRequests(bidRequests); expect(request.data).to.be.an('string'); const payload = parseRequest(request.data); @@ -103,7 +103,7 @@ describe('TrustXAdapter', function () { expect(payload).to.have.property('r', '22edbae2733bf6'); }); - it('pt parameter must be "gross" if params.priceType === "gross"', () => { + it('pt parameter must be "gross" if params.priceType === "gross"', function () { bidRequests[1].params.priceType = 'gross'; const request = spec.buildRequests(bidRequests); expect(request.data).to.be.an('string'); @@ -115,7 +115,7 @@ describe('TrustXAdapter', function () { delete bidRequests[1].params.priceType; }); - it('pt parameter must be "net" or "gross"', () => { + it('pt parameter must be "net" or "gross"', function () { bidRequests[1].params.priceType = 'some'; const request = spec.buildRequests(bidRequests); expect(request.data).to.be.an('string'); @@ -127,7 +127,7 @@ describe('TrustXAdapter', function () { delete bidRequests[1].params.priceType; }); - it('if gdprConsent is present payload must have gdpr params', () => { + it('if gdprConsent is present payload must have gdpr params', function () { const request = spec.buildRequests(bidRequests, {gdprConsent: {consentString: 'AAA', gdprApplies: true}}); expect(request.data).to.be.an('string'); const payload = parseRequest(request.data); @@ -135,7 +135,7 @@ describe('TrustXAdapter', function () { expect(payload).to.have.property('gdpr_applies', '1'); }); - it('if gdprApplies is false gdpr_applies must be 0', () => { + it('if gdprApplies is false gdpr_applies must be 0', function () { const request = spec.buildRequests(bidRequests, {gdprConsent: {consentString: 'AAA', gdprApplies: false}}); expect(request.data).to.be.an('string'); const payload = parseRequest(request.data); @@ -143,7 +143,7 @@ describe('TrustXAdapter', function () { expect(payload).to.have.property('gdpr_applies', '0'); }); - it('if gdprApplies is undefined gdpr_applies must be 1', () => { + it('if gdprApplies is undefined gdpr_applies must be 1', function () { const request = spec.buildRequests(bidRequests, {gdprConsent: {consentString: 'AAA'}}); expect(request.data).to.be.an('string'); const payload = parseRequest(request.data); @@ -152,7 +152,7 @@ describe('TrustXAdapter', function () { }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { const responses = [ {'bid': [{'price': 1.15, 'adm': '
test content 1
', 'auid': 43, 'h': 250, 'w': 300}], 'seat': '1'}, {'bid': [{'price': 0.5, 'adm': '
test content 2
', 'auid': 44, 'h': 90, 'w': 728}], 'seat': '1'}, @@ -163,7 +163,7 @@ describe('TrustXAdapter', function () { {'seat': '1'}, ]; - it('should get correct bid response', () => { + it('should get correct bid response', function () { const bidRequests = [ { 'bidder': 'trustx', @@ -198,7 +198,7 @@ describe('TrustXAdapter', function () { expect(result).to.deep.equal(expectedResponse); }); - it('should get correct multi bid response', () => { + it('should get correct multi bid response', function () { const bidRequests = [ { 'bidder': 'trustx', @@ -281,7 +281,7 @@ describe('TrustXAdapter', function () { expect(result).to.deep.equal(expectedResponse); }); - it('handles wrong and nobid responses', () => { + it('handles wrong and nobid responses', function () { const bidRequests = [ { 'bidder': 'trustx', diff --git a/test/spec/modules/ucfunnelBidAdapter_spec.js b/test/spec/modules/ucfunnelBidAdapter_spec.js index e8a4624bf16..32daf5ecb96 100644 --- a/test/spec/modules/ucfunnelBidAdapter_spec.js +++ b/test/spec/modules/ucfunnelBidAdapter_spec.js @@ -89,34 +89,34 @@ const validNativeBidRes = { width: 1 }; -describe('ucfunnel Adapter', () => { - describe('request', () => { - it('should validate bid request', () => { +describe('ucfunnel Adapter', function () { + describe('request', function () { + it('should validate bid request', function () { expect(spec.isBidRequestValid(validBannerBidReq)).to.equal(true); }); - it('should not validate incorrect bid request', () => { + it('should not validate incorrect bid request', function () { expect(spec.isBidRequestValid(invalidBannerBidReq)).to.equal(false); }); }); - describe('build request', () => { + describe('build request', function () { const request = spec.buildRequests([validBannerBidReq]); - it('should create a POST request for every bid', () => { + it('should create a POST request for every bid', function () { expect(request[0].method).to.equal('GET'); expect(request[0].url).to.equal(location.protocol + spec.ENDPOINT); }); - it('should attach the bid request object', () => { + it('should attach the bid request object', function () { expect(request[0].bidRequest).to.equal(validBannerBidReq); }); - it('should attach request data', () => { + it('should attach request data', function () { const data = request[0].data; const [ width, height ] = validBannerBidReq.sizes[0]; expect(data.w).to.equal(width); expect(data.h).to.equal(height); }); - it('must parse bid size from a nested array', () => { + it('must parse bid size from a nested array', function () { const width = 640; const height = 480; validBannerBidReq.sizes = [[ width, height ]]; @@ -127,15 +127,15 @@ describe('ucfunnel Adapter', () => { }); }); - describe('interpretResponse', () => { - describe('should support banner', () => { + describe('interpretResponse', function () { + describe('should support banner', function () { const request = spec.buildRequests([ validBannerBidReq ]); const result = spec.interpretResponse({body: validBannerBidRes}, request[0]); - it('should build bid array for banner', () => { + it('should build bid array for banner', function () { expect(result.length).to.equal(1); }); - it('should have all relevant fields', () => { + it('should have all relevant fields', function () { const bid = result[0]; expect(bid.mediaType).to.equal(BANNER); @@ -147,14 +147,14 @@ describe('ucfunnel Adapter', () => { }); }); - describe('should support video', () => { + describe('should support video', function () { const request = spec.buildRequests([ validVideoBidReq ]); const result = spec.interpretResponse({body: validVideoBidRes}, request[0]); - it('should build bid array', () => { + it('should build bid array', function () { expect(result.length).to.equal(1); }); - it('should have all relevant fields', () => { + it('should have all relevant fields', function () { const bid = result[0]; expect(bid.mediaType).to.equal(VIDEO); @@ -167,14 +167,14 @@ describe('ucfunnel Adapter', () => { }); }); - describe('should support native', () => { + describe('should support native', function () { const request = spec.buildRequests([ validNativeBidReq ]); const result = spec.interpretResponse({body: validNativeBidRes}, request[0]); - it('should build bid array', () => { + it('should build bid array', function () { expect(result.length).to.equal(1); }); - it('should have all relevant fields', () => { + it('should have all relevant fields', function () { const bid = result[0]; expect(bid.mediaType).to.equal(NATIVE); diff --git a/test/spec/modules/underdogmediaBidAdapter_spec.js b/test/spec/modules/underdogmediaBidAdapter_spec.js index 8ccac8d4f08..6f4df57d316 100644 --- a/test/spec/modules/underdogmediaBidAdapter_spec.js +++ b/test/spec/modules/underdogmediaBidAdapter_spec.js @@ -1,11 +1,11 @@ import { expect } from 'chai'; import { spec } from 'modules/underdogmediaBidAdapter'; -describe('UnderdogMedia adapter', () => { +describe('UnderdogMedia adapter', function () { let bidRequests; let bidderRequest; - beforeEach(() => { + beforeEach(function () { bidRequests = [ { bidder: 'underdogmedia', @@ -35,9 +35,9 @@ describe('UnderdogMedia adapter', () => { } }); - describe('implementation', () => { - describe('for requests', () => { - it('should accept valid bid', () => { + describe('implementation', function () { + describe('for requests', function () { + it('should accept valid bid', function () { let validBid = { bidder: 'underdogmedia', params: { @@ -50,7 +50,7 @@ describe('UnderdogMedia adapter', () => { expect(isValid).to.equal(true); }); - it('should reject invalid bid missing sizes', () => { + it('should reject invalid bid missing sizes', function () { let invalidBid = { bidder: 'underdogmedia', params: { @@ -62,7 +62,7 @@ describe('UnderdogMedia adapter', () => { expect(isValid).to.equal(false); }); - it('should reject invalid bid missing siteId', () => { + it('should reject invalid bid missing siteId', function () { let invalidBid = { bidder: 'underdogmedia', params: {}, @@ -73,7 +73,7 @@ describe('UnderdogMedia adapter', () => { expect(isValid).to.equal(false); }); - it('request data should contain sid', () => { + it('request data should contain sid', function () { let bidRequests = [ { bidId: '3c9408cdbf2f68', @@ -91,7 +91,7 @@ describe('UnderdogMedia adapter', () => { expect(request.data.sid).to.equal('12143'); }); - it('request data should contain sizes', () => { + it('request data should contain sizes', function () { let bidRequests = [ { bidId: '3c9408cdbf2f68', @@ -109,7 +109,7 @@ describe('UnderdogMedia adapter', () => { expect(request.data.sizes).to.equal('300x250,728x90'); }); - it('request data should contain gdpr info', () => { + it('request data should contain gdpr info', function () { let bidRequests = [ { bidId: '3c9408cdbf2f68', @@ -129,7 +129,7 @@ describe('UnderdogMedia adapter', () => { expect(request.data.consentData).to.equal('consentDataString'); }); - it('should not build a request if no vendorConsent', () => { + it('should not build a request if no vendorConsent', function () { let bidRequests = [ { bidId: '3c9408cdbf2f68', @@ -160,7 +160,7 @@ describe('UnderdogMedia adapter', () => { expect(request).to.equal(undefined); }); - it('should properly build a request if no vendorConsent but no gdprApplies', () => { + it('should properly build a request if no vendorConsent but no gdprApplies', function () { let bidRequests = [ { bidId: '3c9408cdbf2f68', @@ -195,7 +195,7 @@ describe('UnderdogMedia adapter', () => { expect(request.data.consentData).to.equal('consentDataString'); }); - it('should properly build a request if gdprConsent empty', () => { + it('should properly build a request if gdprConsent empty', function () { let bidRequests = [ { bidId: '3c9408cdbf2f68', @@ -220,8 +220,8 @@ describe('UnderdogMedia adapter', () => { }); }); - describe('bid responses', () => { - it('should return complete bid response', () => { + describe('bid responses', function () { + it('should return complete bid response', function () { let serverResponse = { body: { mids: [ @@ -260,7 +260,7 @@ describe('UnderdogMedia adapter', () => { expect(bids[0].currency).to.equal('USD'); }); - it('should return empty bid response if mids empty', () => { + it('should return empty bid response if mids empty', function () { let serverResponse = { body: { mids: [] @@ -272,7 +272,7 @@ describe('UnderdogMedia adapter', () => { expect(bids).to.be.lengthOf(0); }); - it('should return empty bid response on incorrect size', () => { + it('should return empty bid response on incorrect size', function () { let serverResponse = { body: { mids: [ @@ -294,7 +294,7 @@ describe('UnderdogMedia adapter', () => { expect(bids).to.be.lengthOf(0); }); - it('should return empty bid response on 0 cpm', () => { + it('should return empty bid response on 0 cpm', function () { let serverResponse = { body: { mids: [ @@ -316,7 +316,7 @@ describe('UnderdogMedia adapter', () => { expect(bids).to.be.lengthOf(0); }); - it('should return empty bid response if no ad in response', () => { + it('should return empty bid response if no ad in response', function () { let serverResponse = { body: { mids: [ @@ -338,7 +338,7 @@ describe('UnderdogMedia adapter', () => { expect(bids).to.be.lengthOf(0); }); - it('ad html string should contain the notification urls', () => { + it('ad html string should contain the notification urls', function () { let serverResponse = { body: { mids: [ diff --git a/test/spec/modules/undertoneBidAdapter_spec.js b/test/spec/modules/undertoneBidAdapter_spec.js index 4a621fb4465..4b816d851d9 100644 --- a/test/spec/modules/undertoneBidAdapter_spec.js +++ b/test/spec/modules/undertoneBidAdapter_spec.js @@ -87,24 +87,24 @@ const bidResArray = [ } ]; -describe('Undertone Adapter', () => { - describe('request', () => { - it('should validate bid request', () => { +describe('Undertone Adapter', function () { + describe('request', function () { + it('should validate bid request', function () { expect(spec.isBidRequestValid(validBidReq)).to.equal(true); }); - it('should not validate incorrect bid request', () => { + it('should not validate incorrect bid request', function () { expect(spec.isBidRequestValid(invalidBidReq)).to.equal(undefined); }); }); - describe('build request', () => { - it('should send request to correct url via POST', () => { + describe('build request', function () { + it('should send request to correct url via POST', function () { const request = spec.buildRequests(bidReq); const domain = null; const REQ_URL = `${URL}?pid=${bidReq[0].params.publisherId}&domain=${domain}`; expect(request.url).to.equal(REQ_URL); expect(request.method).to.equal('POST'); }); - it('should have all relevant fields', () => { + it('should have all relevant fields', function () { const request = spec.buildRequests(bidReq); const bid1 = JSON.parse(request.data)['x-ut-hb-params'][0]; expect(bid1.bidRequestId).to.equal('263be71e91dd9d'); @@ -121,13 +121,13 @@ describe('Undertone Adapter', () => { }); }); - describe('interpretResponse', () => { - it('should build bid array', () => { + describe('interpretResponse', function () { + it('should build bid array', function () { let result = spec.interpretResponse({body: bidResponse}); expect(result.length).to.equal(1); }); - it('should have all relevant fields', () => { + it('should have all relevant fields', function () { const result = spec.interpretResponse({body: bidResponse}); const bid = result[0]; @@ -141,12 +141,12 @@ describe('Undertone Adapter', () => { expect(bid.ttl).to.equal(360); }); - it('should return empty array when response is incorrect', () => { + it('should return empty array when response is incorrect', function () { expect(spec.interpretResponse({body: {}}).length).to.equal(0); expect(spec.interpretResponse({body: []}).length).to.equal(0); }); - it('should only use valid bid responses', () => { + it('should only use valid bid responses', function () { expect(spec.interpretResponse({ body: bidResArray }).length).to.equal(1); }); }); diff --git a/test/spec/modules/unrulyBidAdapter_spec.js b/test/spec/modules/unrulyBidAdapter_spec.js index 3e39842bd0a..2c8fd9071d6 100644 --- a/test/spec/modules/unrulyBidAdapter_spec.js +++ b/test/spec/modules/unrulyBidAdapter_spec.js @@ -6,7 +6,7 @@ import { VIDEO } from 'src/mediaTypes' import { Renderer } from 'src/Renderer' import { adapter } from 'modules/unrulyBidAdapter' -describe('UnrulyAdapter', () => { +describe('UnrulyAdapter', function () { function createOutStreamExchangeBid({ adUnitCode = 'placement2', statusCode = 1, @@ -39,7 +39,7 @@ describe('UnrulyAdapter', () => { let sandbox; let fakeRenderer; - beforeEach(() => { + beforeEach(function () { sandbox = sinon.sandbox.create(); sandbox.stub(utils, 'logError'); sandbox.stub(Renderer, 'install'); @@ -50,12 +50,12 @@ describe('UnrulyAdapter', () => { Renderer.install.returns(fakeRenderer) }); - afterEach(() => { + afterEach(function () { sandbox.restore(); delete parent.window.unruly }); - it('should expose Unruly Bidder code', () => { + it('should expose Unruly Bidder code', function () { expect(adapter.code).to.equal('unruly') }); @@ -63,22 +63,22 @@ describe('UnrulyAdapter', () => { expect(adapter.supportedMediaTypes).to.deep.equal([ VIDEO ]) }); - describe('isBidRequestValid', () => { - it('should be a function', () => { + describe('isBidRequestValid', function () { + it('should be a function', function () { expect(typeof adapter.isBidRequestValid).to.equal('function') }); - it('should return false if bid is falsey', () => { + it('should return false if bid is falsey', function () { expect(adapter.isBidRequestValid()).to.be.false; }); - it('should return true if bid.mediaType is "video"', () => { + it('should return true if bid.mediaType is "video"', function () { const mockBid = { mediaType: 'video' }; expect(adapter.isBidRequestValid(mockBid)).to.be.true; }); - it('should return true if bid.mediaTypes.video.context is "outstream"', () => { + it('should return true if bid.mediaTypes.video.context is "outstream"', function () { const mockBid = { mediaTypes: { video: { @@ -91,19 +91,19 @@ describe('UnrulyAdapter', () => { }); }); - describe('buildRequests', () => { - it('should be a function', () => { + describe('buildRequests', function () { + it('should be a function', function () { expect(typeof adapter.buildRequests).to.equal('function'); }); - it('should return an object', () => { + it('should return an object', function () { const mockBidRequests = ['mockBid']; expect(typeof adapter.buildRequests(mockBidRequests)).to.equal('object') }); - it('should return a server request with a valid exchange url', () => { + it('should return a server request with a valid exchange url', function () { const mockBidRequests = ['mockBid']; expect(adapter.buildRequests(mockBidRequests).url).to.equal('https://targeting.unrulymedia.com/prebid') }); - it('should return a server request with method === POST', () => { + it('should return a server request with method === POST', function () { const mockBidRequests = ['mockBid']; expect(adapter.buildRequests(mockBidRequests).method).to.equal('POST'); }); @@ -113,7 +113,7 @@ describe('UnrulyAdapter', () => { contentType: 'application/json' }); }); - it('should return a server request with valid payload', () => { + it('should return a server request with valid payload', function () { const mockBidRequests = ['mockBid']; const mockBidderRequest = {bidderCode: 'mockBidder'}; expect(adapter.buildRequests(mockBidRequests, mockBidderRequest).data) @@ -121,18 +121,18 @@ describe('UnrulyAdapter', () => { }) }); - describe('interpretResponse', () => { - it('should be a function', () => { + describe('interpretResponse', function () { + it('should be a function', function () { expect(typeof adapter.interpretResponse).to.equal('function'); }); - it('should return empty array when serverResponse is undefined', () => { + it('should return empty array when serverResponse is undefined', function () { expect(adapter.interpretResponse()).to.deep.equal([]); }); - it('should return empty array when serverResponse has no bids', () => { + it('should return empty array when serverResponse has no bids', function () { const mockServerResponse = { body: { bids: [] } }; expect(adapter.interpretResponse(mockServerResponse)).to.deep.equal([]) }); - it('should return array of bids when receive a successful response from server', () => { + it('should return array of bids when receive a successful response from server', function () { const mockExchangeBid = createOutStreamExchangeBid({adUnitCode: 'video1', bidId: 'mockBidId'}); const mockServerResponse = createExchangeResponse(mockExchangeBid); expect(adapter.interpretResponse(mockServerResponse)).to.deep.equal([ @@ -151,7 +151,7 @@ describe('UnrulyAdapter', () => { ]) }); - it('should initialize and set the renderer', () => { + it('should initialize and set the renderer', function () { expect(Renderer.install).not.to.have.been.called; expect(fakeRenderer.setRender).not.to.have.been.called; @@ -172,7 +172,7 @@ describe('UnrulyAdapter', () => { sinon.assert.calledWithExactly(fakeRenderer.setRender, sinon.match.func) }); - it('bid is placed on the bid queue when render is called', () => { + it('bid is placed on the bid queue when render is called', function () { const exchangeBid = createOutStreamExchangeBid({ adUnitCode: 'video', vastUrl: 'value: vastUrl' }); const exchangeResponse = createExchangeResponse(exchangeBid); @@ -192,7 +192,7 @@ describe('UnrulyAdapter', () => { expect(sentRendererConfig.adUnitCode).to.equal('video') }) - it('should ensure that renderer is placed in Prebid supply mode', () => { + it('should ensure that renderer is placed in Prebid supply mode', function () { const mockExchangeBid = createOutStreamExchangeBid({adUnitCode: 'video1', bidId: 'mockBidId'}); const mockServerResponse = createExchangeResponse(mockExchangeBid); diff --git a/test/spec/modules/uolBidAdapter_spec.js b/test/spec/modules/uolBidAdapter_spec.js index 843f47682dc..1733afc91f9 100644 --- a/test/spec/modules/uolBidAdapter_spec.js +++ b/test/spec/modules/uolBidAdapter_spec.js @@ -4,10 +4,10 @@ import { newBidder } from 'src/adapters/bidderFactory'; const ENDPOINT = 'https://prebid.adilligo.com/v1/prebid.json'; -describe('UOL Bid Adapter', () => { +describe('UOL Bid Adapter', function () { const adapter = newBidder(spec); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { 'bidder': 'uol', 'params': { @@ -20,7 +20,7 @@ describe('UOL Bid Adapter', () => { 'auctionId': 'eb511c63-df7e-4240-9b65-2f8ae50303e4', }; - it('should return true for valid params', () => { + it('should return true for valid params', function () { let clonedBid = Object.assign({}, bid); expect(spec.isBidRequestValid(clonedBid)).to.equal(true); @@ -40,13 +40,13 @@ describe('UOL Bid Adapter', () => { expect(spec.isBidRequestValid(clonedBid)).to.equal(true); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let clonedBid = Object.assign({}, bid); delete clonedBid.params; expect(spec.isBidRequestValid(clonedBid)).to.equal(false); }); - it('should return false when params are invalid', () => { + it('should return false when params are invalid', function () { let clonedBid = Object.assign({}, bid); delete clonedBid.params; clonedBid.params = { @@ -69,7 +69,7 @@ describe('UOL Bid Adapter', () => { expect(spec.isBidRequestValid(clonedBid)).to.equal(false); }); - it('should return false when cpmFactor is passed and test flag isn\'t active', () => { + it('should return false when cpmFactor is passed and test flag isn\'t active', function () { let clonedBid = Object.assign({}, bid); delete clonedBid.params; clonedBid.params = { @@ -80,14 +80,14 @@ describe('UOL Bid Adapter', () => { expect(spec.isBidRequestValid(clonedBid)).to.equal(false); }); - it('should not allow empty size', () => { + it('should not allow empty size', function () { let clonedBid = Object.assign({}, bid); delete clonedBid.sizes; expect(spec.isBidRequestValid(clonedBid)).to.equal(false); }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let queryPermission; let cleanup = function() { navigator.permissions.query = queryPermission; @@ -148,32 +148,32 @@ describe('UOL Bid Adapter', () => { 'timeout': 3000 }; - describe('buildRequest basic params', () => { + describe('buildRequest basic params', function () { const requestObject = spec.buildRequests(bidRequests, bidderRequest); const payload = JSON.parse(requestObject.data); - it('should send bid requests to expected endpoint via POST method', () => { + it('should send bid requests to expected endpoint via POST method', function () { expect(requestObject.url).to.equal(ENDPOINT); expect(requestObject.method).to.equal('POST'); }); - it('should contain referrer URL', () => { + it('should contain referrer URL', function () { expect(payload.referrerURL).to.exist.and.to.match(/^http(s)?:\/\/.+$/) }); - it('should contain an array of requests with length equivalent to bid count', () => { + it('should contain an array of requests with length equivalent to bid count', function () { expect(payload.requests).to.have.length(bidRequests.length); }); - it('should return propper ad size if at least one entry is provided', () => { + it('should return propper ad size if at least one entry is provided', function () { expect(payload.requests[0].sizes).to.deep.equal(bidRequests[0].sizes); }); }); if (navigator.permissions && navigator.permissions.query && navigator.geolocation) { - describe('buildRequest geolocation param', () => { // shall only be tested if browser engine supports geolocation and permissions API. + describe('buildRequest geolocation param', function () { // shall only be tested if browser engine supports geolocation and permissions API. let geolocation = { lat: 4, long: 3, timestamp: 123121451 }; - it('should contain user coordinates if (i) DNT is off; (ii) browser supports implementation; (iii) localStorage contains geolocation history', () => { + it('should contain user coordinates if (i) DNT is off; (ii) browser supports implementation; (iii) localStorage contains geolocation history', function () { localStorage.setItem('uolLocationTracker', JSON.stringify(geolocation)); grantTriangulation(); const requestObject = spec.buildRequests(bidRequests, bidderRequest); @@ -182,7 +182,7 @@ describe('UOL Bid Adapter', () => { cleanup(); }) - it('should not contain user coordinates if localStorage is empty', () => { + it('should not contain user coordinates if localStorage is empty', function () { localStorage.removeItem('uolLocationTracker'); denyTriangulation(); const requestObject = spec.buildRequests(bidRequests, bidderRequest); @@ -191,7 +191,7 @@ describe('UOL Bid Adapter', () => { cleanup(); }) - it('should not contain user coordinates if browser doesnt support permission query', () => { + it('should not contain user coordinates if browser doesnt support permission query', function () { localStorage.setItem('uolLocationTracker', JSON.stringify(geolocation)); removeQuerySupport(); const requestObject = spec.buildRequests(bidRequests, bidderRequest); @@ -201,8 +201,8 @@ describe('UOL Bid Adapter', () => { }) }) } - describe('buildRequest test params', () => { - it('should return test and cpmFactor params if defined', () => { + describe('buildRequest test params', function () { + it('should return test and cpmFactor params if defined', function () { let clonedBid = JSON.parse(JSON.stringify(bidRequests)); delete clonedBid[0].params; clonedBid.splice(1, 1); @@ -229,7 +229,7 @@ describe('UOL Bid Adapter', () => { }) }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { let serverResponse = { 'body': { 'bidderRequestId': '2a21a2fc993ef9', @@ -261,7 +261,7 @@ describe('UOL Bid Adapter', () => { }; let bidRequest = {}; - it('should return the correct bid response structure', () => { + it('should return the correct bid response structure', function () { let expectedResponse = [ { 'requestId': '2a21a2fc993ef9', @@ -281,7 +281,7 @@ describe('UOL Bid Adapter', () => { expect(Object.keys(result[0])).to.have.members(Object.keys(expectedResponse[0])); }); - it('should corretly return an empty array of bidResponses if no ads were received', () => { + it('should corretly return an empty array of bidResponses if no ads were received', function () { let emptyResponse = Object.assign({}, serverResponse); emptyResponse.body.ads = []; let result = spec.interpretResponse(emptyResponse, {bidRequest}); @@ -289,15 +289,15 @@ describe('UOL Bid Adapter', () => { }); }); - describe('getUserSyncs', () => { + describe('getUserSyncs', function () { let syncOptions = { iframeEnabled: true }; let serverResponses = [{ body: { trackingPixel: 'https://www.uol.com.br' } }, { body: { trackingPixel: 'http://www.dynad.net/' } }]; - it('should return the two sync params for iframeEnabled bids with a trackingPixel response', () => { + it('should return the two sync params for iframeEnabled bids with a trackingPixel response', function () { expect(spec.getUserSyncs(syncOptions, serverResponses)).to.have.length(2); }) - it('should not return any sync params if iframe is disabled or no trackingPixel is received', () => { + it('should not return any sync params if iframe is disabled or no trackingPixel is received', function () { let cloneOptions = Object.assign({}, syncOptions); delete cloneOptions.iframeEnabled; expect(spec.getUserSyncs(cloneOptions, serverResponses)).to.have.length(0); diff --git a/test/spec/modules/vertamediaBidAdapter_spec.js b/test/spec/modules/vertamediaBidAdapter_spec.js index 271f1f2d04a..fefa8e446ed 100644 --- a/test/spec/modules/vertamediaBidAdapter_spec.js +++ b/test/spec/modules/vertamediaBidAdapter_spec.js @@ -96,45 +96,45 @@ const displayEqResponse = [{ cpm: 0.9 }]; -describe('vertamediaBidAdapter', () => { +describe('vertamediaBidAdapter', function () { const adapter = newBidder(spec); - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { - it('should return true when required params found', () => { + describe('isBidRequestValid', function () { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(VIDEO_REQUEST)).to.equal(12345); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let bid = Object.assign({}, VIDEO_REQUEST); delete bid.params; expect(spec.isBidRequestValid(bid)).to.equal(undefined); }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let videoBidRequests = [VIDEO_REQUEST]; let dispalyBidRequests = [DISPLAY_REQUEST]; const displayRequest = spec.buildRequests(dispalyBidRequests, {}); const videoRequest = spec.buildRequests(videoBidRequests, {}); - it('sends bid request to ENDPOINT via GET', () => { + it('sends bid request to ENDPOINT via GET', function () { expect(videoRequest.method).to.equal('GET'); expect(displayRequest.method).to.equal('GET'); }); - it('sends bid request to correct ENDPOINT', () => { + it('sends bid request to correct ENDPOINT', function () { expect(videoRequest.url).to.equal(ENDPOINT); expect(displayRequest.url).to.equal(ENDPOINT); }); - it('sends correct video bid parameters', () => { + it('sends correct video bid parameters', function () { const bid = Object.assign({}, videoRequest.data); delete bid.domain; @@ -148,7 +148,7 @@ describe('vertamediaBidAdapter', () => { expect(bid).to.deep.equal(eq); }); - it('sends correct display bid parameters', () => { + it('sends correct display bid parameters', function () { const bid = Object.assign({}, displayRequest.data); delete bid.domain; @@ -163,18 +163,18 @@ describe('vertamediaBidAdapter', () => { }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { let serverResponse; let bidderRequest; let eqResponse; - afterEach(() => { + afterEach(function () { serverResponse = null; bidderRequest = null; eqResponse = null; }); - it('should get correct video bid response', () => { + it('should get correct video bid response', function () { serverResponse = SERVER_VIDEO_RESPONSE; bidderRequest = videoBidderRequest; eqResponse = videoEqResponse; @@ -182,7 +182,7 @@ describe('vertamediaBidAdapter', () => { bidServerResponseCheck(); }); - it('should get correct display bid response', () => { + it('should get correct display bid response', function () { serverResponse = SERVER_DISPLAY_RESPONSE; bidderRequest = displayBidderRequest; eqResponse = displayEqResponse; @@ -203,13 +203,13 @@ describe('vertamediaBidAdapter', () => { expect(noBidResult.length).to.equal(0); } - it('handles video nobid responses', () => { + it('handles video nobid responses', function () { bidderRequest = videoBidderRequest; nobidServerResponseCheck(); }); - it('handles display nobid responses', () => { + it('handles display nobid responses', function () { bidderRequest = displayBidderRequest; nobidServerResponseCheck(); diff --git a/test/spec/modules/vertozBidAdapter_spec.js b/test/spec/modules/vertozBidAdapter_spec.js index a84fc4847f5..1eb85b6b566 100644 --- a/test/spec/modules/vertozBidAdapter_spec.js +++ b/test/spec/modules/vertozBidAdapter_spec.js @@ -4,16 +4,16 @@ import { newBidder } from 'src/adapters/bidderFactory'; const BASE_URI = '//hb.vrtzads.com/vzhbidder/bid?'; -describe('VertozAdapter', () => { +describe('VertozAdapter', function () { const adapter = newBidder(spec); - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { 'bidder': 'vertoz', 'params': { @@ -26,11 +26,11 @@ describe('VertozAdapter', () => { 'auctionId': '1d1a030790a475', }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -40,7 +40,7 @@ describe('VertozAdapter', () => { }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let bidRequests = [ { 'bidder': 'vertoz', @@ -55,14 +55,14 @@ describe('VertozAdapter', () => { } ]; - it('sends bid request to ENDPOINT via POST', () => { + it('sends bid request to ENDPOINT via POST', function () { const request = spec.buildRequests(bidRequests)[0]; expect(request.url).to.equal(BASE_URI); expect(request.method).to.equal('POST'); }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { let response = { 'vzhPlacementId': 'VZ-HB-B784382V6C6G3C', 'bid': '76021e56-adaf-4114-b68d-ccacd1b3e551_1', @@ -75,7 +75,7 @@ describe('VertozAdapter', () => { 'statusText': 'Vertoz:Success' }; - it('should get correct bid response', () => { + it('should get correct bid response', function () { let expectedResponse = [ { 'requestId': '44b3fcfd24aa93', @@ -97,7 +97,7 @@ describe('VertozAdapter', () => { expect(result[0].cpm).to.not.equal(null); }); - it('handles nobid responses', () => { + it('handles nobid responses', function () { let response = { 'vzhPlacementId': 'VZ-HB-I617046VBGE3EH', 'slotBidId': 'f00412ac86b79', diff --git a/test/spec/modules/viBidAdapter_spec.js b/test/spec/modules/viBidAdapter_spec.js index e8b0fbcc4b2..2468da0cfaf 100644 --- a/test/spec/modules/viBidAdapter_spec.js +++ b/test/spec/modules/viBidAdapter_spec.js @@ -7,7 +7,7 @@ const ENDPOINT = `//pb.vi-serve.com/prebid/bid`; describe('viBidAdapter', function() { newBidder(spec); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { 'bidder': 'vi', 'params': { @@ -27,17 +27,17 @@ describe('viBidAdapter', function() { 'transactionId': '474da635-9cf0-4188-a3d9-58961be8f905' }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when pubId not passed', () => { + it('should return false when pubId not passed', function () { bid.params.pubId = undefined; expect(spec.isBidRequestValid(bid)).to.equal(false); }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let bidRequests = [{ 'bidder': 'vi', 'params': { @@ -59,16 +59,16 @@ describe('viBidAdapter', function() { const request = spec.buildRequests(bidRequests); - it('POST bid request to vi', () => { + it('POST bid request to vi', function () { expect(request.method).to.equal('POST'); }); - it('check endpoint URL', () => { + it('check endpoint URL', function () { expect(request.url).to.equal(ENDPOINT) }); }); - describe('buildRequests can handle size in 1-dim array', () => { + describe('buildRequests can handle size in 1-dim array', function () { let bidRequests = [{ 'bidder': 'vi', 'params': { @@ -88,16 +88,16 @@ describe('viBidAdapter', function() { const request = spec.buildRequests(bidRequests); - it('POST bid request to vi', () => { + it('POST bid request to vi', function () { expect(request.method).to.equal('POST'); }); - it('check endpoint URL', () => { + it('check endpoint URL', function () { expect(request.url).to.equal(ENDPOINT) }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { let response = { body: [{ 'id': '29b891ad542377', @@ -109,7 +109,7 @@ describe('viBidAdapter', function() { }] }; - it('should get the correct bid response', () => { + it('should get the correct bid response', function () { let expectedResponse = [{ 'requestId': '29b891ad542377', 'cpm': 0.1, @@ -128,7 +128,7 @@ describe('viBidAdapter', function() { expect(Object.keys(result[0])).to.deep.equal(Object.keys(expectedResponse[0])); }); - it('handles empty bid response', () => { + it('handles empty bid response', function () { let response = { body: [] }; diff --git a/test/spec/modules/vidazooBidAdapter_spec.js b/test/spec/modules/vidazooBidAdapter_spec.js index b857967a44e..d9c08ad924c 100644 --- a/test/spec/modules/vidazooBidAdapter_spec.js +++ b/test/spec/modules/vidazooBidAdapter_spec.js @@ -54,31 +54,31 @@ const SYNC_OPTIONS = { 'pixelEnabled': true }; -describe('VidazooBidAdapter', () => { - describe('validtae spec', () => { - it('exists and is a function', () => { +describe('VidazooBidAdapter', function () { + describe('validtae spec', function () { + it('exists and is a function', function () { expect(adapter.isBidRequestValid).to.exist.and.to.be.a('function'); }); - it('exists and is a function', () => { + it('exists and is a function', function () { expect(adapter.buildRequests).to.exist.and.to.be.a('function'); }); - it('exists and is a function', () => { + it('exists and is a function', function () { expect(adapter.interpretResponse).to.exist.and.to.be.a('function'); }); - it('exists and is a function', () => { + it('exists and is a function', function () { expect(adapter.getUserSyncs).to.exist.and.to.be.a('function'); }); - it('exists and is a string', () => { + it('exists and is a string', function () { expect(adapter.code).to.exist.and.to.be.a('string'); }); }); - describe('validate bid requests', () => { - it('should require cId', () => { + describe('validate bid requests', function () { + it('should require cId', function () { const isValid = adapter.isBidRequestValid({ params: { pId: 'pid' @@ -87,7 +87,7 @@ describe('VidazooBidAdapter', () => { expect(isValid).to.be.false; }); - it('should require pId', () => { + it('should require pId', function () { const isValid = adapter.isBidRequestValid({ params: { cId: 'cid' @@ -96,7 +96,7 @@ describe('VidazooBidAdapter', () => { expect(isValid).to.be.false; }); - it('should validate correctly', () => { + it('should validate correctly', function () { const isValid = adapter.isBidRequestValid({ params: { cId: 'cid', @@ -107,15 +107,15 @@ describe('VidazooBidAdapter', () => { }); }); - describe('build requests', () => { + describe('build requests', function () { let sandbox; - before(() => { + before(function () { sandbox = sinon.sandbox.create(); sandbox.stub(utils, 'getTopWindowUrl').returns('http://www.greatsite.com'); sandbox.stub(Date, 'now').returns(1000); }); - it('should build request for each size', () => { + it('should build request for each size', function () { const requests = adapter.buildRequests([BID], BIDDER_REQUEST); expect(requests).to.have.length(2); expect(requests[0]).to.deep.equal({ @@ -152,28 +152,28 @@ describe('VidazooBidAdapter', () => { }); }); - after(() => { + after(function () { sandbox.restore(); }); }); - describe('interpret response', () => { - it('should return empty array when there is no response', () => { + describe('interpret response', function () { + it('should return empty array when there is no response', function () { const responses = adapter.interpretResponse(null); expect(responses).to.be.empty; }); - it('should return empty array when there is no ad', () => { + it('should return empty array when there is no ad', function () { const responses = adapter.interpretResponse({price: 1, ad: ''}); expect(responses).to.be.empty; }); - it('should return empty array when there is no price', () => { + it('should return empty array when there is no price', function () { const responses = adapter.interpretResponse({price: null, ad: 'great ad'}); expect(responses).to.be.empty; }); - it('should return an array of interpreted responses', () => { + it('should return an array of interpreted responses', function () { const responses = adapter.interpretResponse(SERVER_RESPONSE, REQUEST); expect(responses).to.have.length(1); expect(responses[0]).to.deep.equal({ @@ -189,7 +189,7 @@ describe('VidazooBidAdapter', () => { }); }); - it('should take default TTL', () => { + it('should take default TTL', function () { const serverResponse = utils.deepClone(SERVER_RESPONSE); delete serverResponse.body.exp; const responses = adapter.interpretResponse(serverResponse, REQUEST); diff --git a/test/spec/modules/visxBidAdapter_spec.js b/test/spec/modules/visxBidAdapter_spec.js index 67b747b5130..bf8d4cc7d13 100755 --- a/test/spec/modules/visxBidAdapter_spec.js +++ b/test/spec/modules/visxBidAdapter_spec.js @@ -6,13 +6,13 @@ import { newBidder } from 'src/adapters/bidderFactory'; describe('VisxAdapter', function () { const adapter = newBidder(spec); - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { 'bidder': 'visx', 'params': { @@ -25,11 +25,11 @@ describe('VisxAdapter', function () { 'auctionId': '1d1a030790a475', }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -39,7 +39,7 @@ describe('VisxAdapter', function () { }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let bidRequests = [ { 'bidder': 'visx', @@ -76,7 +76,7 @@ describe('VisxAdapter', function () { } ]; - it('should attach valid params to the tag', () => { + it('should attach valid params to the tag', function () { const request = spec.buildRequests([bidRequests[0]]); const payload = request.data; expect(payload).to.be.an('object'); @@ -87,7 +87,7 @@ describe('VisxAdapter', function () { expect(payload).to.have.property('cur', 'EUR'); }); - it('auids must not be duplicated', () => { + it('auids must not be duplicated', function () { const request = spec.buildRequests(bidRequests); const payload = request.data; expect(payload).to.be.an('object'); @@ -98,7 +98,7 @@ describe('VisxAdapter', function () { expect(payload).to.have.property('cur', 'EUR'); }); - it('pt parameter must be "gross" if params.priceType === "gross"', () => { + it('pt parameter must be "gross" if params.priceType === "gross"', function () { bidRequests[1].params.priceType = 'gross'; const request = spec.buildRequests(bidRequests); const payload = request.data; @@ -111,7 +111,7 @@ describe('VisxAdapter', function () { delete bidRequests[1].params.priceType; }); - it('pt parameter must be "net" or "gross"', () => { + it('pt parameter must be "net" or "gross"', function () { bidRequests[1].params.priceType = 'some'; const request = spec.buildRequests(bidRequests); const payload = request.data; @@ -123,7 +123,7 @@ describe('VisxAdapter', function () { expect(payload).to.have.property('cur', 'EUR'); delete bidRequests[1].params.priceType; }); - it('should add currency from currency.bidderCurrencyDefault', () => { + it('should add currency from currency.bidderCurrencyDefault', function () { const getConfigStub = sinon.stub(config, 'getConfig').callsFake( arg => arg === 'currency.bidderCurrencyDefault.visx' ? 'JPY' : 'USD'); const request = spec.buildRequests(bidRequests); @@ -136,7 +136,7 @@ describe('VisxAdapter', function () { expect(payload).to.have.property('cur', 'JPY'); getConfigStub.restore(); }); - it('should add currency from currency.adServerCurrency', () => { + it('should add currency from currency.adServerCurrency', function () { const getConfigStub = sinon.stub(config, 'getConfig').callsFake( arg => arg === 'currency.bidderCurrencyDefault.visx' ? '' : 'USD'); const request = spec.buildRequests(bidRequests); @@ -149,7 +149,7 @@ describe('VisxAdapter', function () { expect(payload).to.have.property('cur', 'USD'); getConfigStub.restore(); }); - it('if gdprConsent is present payload must have gdpr params', () => { + it('if gdprConsent is present payload must have gdpr params', function () { const request = spec.buildRequests(bidRequests, {gdprConsent: {consentString: 'AAA', gdprApplies: true}}); const payload = request.data; expect(payload).to.be.an('object'); @@ -157,7 +157,7 @@ describe('VisxAdapter', function () { expect(payload).to.have.property('gdpr_applies', 1); }); - it('if gdprApplies is false gdpr_applies must be 0', () => { + it('if gdprApplies is false gdpr_applies must be 0', function () { const request = spec.buildRequests(bidRequests, {gdprConsent: {consentString: 'AAA', gdprApplies: false}}); const payload = request.data; expect(payload).to.be.an('object'); @@ -165,7 +165,7 @@ describe('VisxAdapter', function () { expect(payload).to.have.property('gdpr_applies', 0); }); - it('if gdprApplies is undefined gdpr_applies must be 1', () => { + it('if gdprApplies is undefined gdpr_applies must be 1', function () { const request = spec.buildRequests(bidRequests, {gdprConsent: {consentString: 'AAA'}}); const payload = request.data; expect(payload).to.be.an('object'); @@ -174,7 +174,7 @@ describe('VisxAdapter', function () { }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { const responses = [ {'bid': [{'price': 1.15, 'adm': '
test content 1
', 'auid': 903535, 'h': 250, 'w': 300}], 'seat': '1'}, {'bid': [{'price': 0.5, 'adm': '
test content 2
', 'auid': 903536, 'h': 90, 'w': 728}], 'seat': '1'}, @@ -185,7 +185,7 @@ describe('VisxAdapter', function () { {'seat': '1'}, ]; - it('should get correct bid response', () => { + it('should get correct bid response', function () { const bidRequests = [ { 'bidder': 'visx', @@ -219,7 +219,7 @@ describe('VisxAdapter', function () { expect(result).to.deep.equal(expectedResponse); }); - it('should get correct multi bid response', () => { + it('should get correct multi bid response', function () { const bidRequests = [ { 'bidder': 'visx', @@ -299,7 +299,7 @@ describe('VisxAdapter', function () { expect(result).to.deep.equal(expectedResponse); }); - it('should return right currency', () => { + it('should return right currency', function () { const bidRequests = [ { 'bidder': 'visx', @@ -335,7 +335,7 @@ describe('VisxAdapter', function () { getConfigStub.restore(); }); - it('handles wrong and nobid responses', () => { + it('handles wrong and nobid responses', function () { const bidRequests = [ { 'bidder': 'visx', diff --git a/test/spec/modules/vubleAnalyticsAdapter_spec.js b/test/spec/modules/vubleAnalyticsAdapter_spec.js index 896f6e4ee87..fe84c0a6b04 100644 --- a/test/spec/modules/vubleAnalyticsAdapter_spec.js +++ b/test/spec/modules/vubleAnalyticsAdapter_spec.js @@ -6,21 +6,21 @@ let constants = require('src/constants.json'); describe('Vuble Prebid Analytic', function () { let xhr; - before(() => { + before(function () { xhr = sinon.useFakeXMLHttpRequest(); }); - after(() => { + after(function () { vubleAnalytics.disableAnalytics(); xhr.restore(); }); describe('enableAnalytics', function () { - beforeEach(() => { + beforeEach(function () { sinon.spy(vubleAnalytics, 'track'); sinon.stub(events, 'getEvents').returns([]); }); - afterEach(() => { + afterEach(function () { vubleAnalytics.track.restore(); events.getEvents.restore(); }); diff --git a/test/spec/modules/vubleBidAdapter_spec.js b/test/spec/modules/vubleBidAdapter_spec.js index 6d266ca465e..8996c1b4957 100644 --- a/test/spec/modules/vubleBidAdapter_spec.js +++ b/test/spec/modules/vubleBidAdapter_spec.js @@ -4,23 +4,23 @@ import {expect} from 'chai'; import {spec as adapter} from 'modules/vubleBidAdapter'; import * as utils from 'src/utils'; -describe('VubleAdapter', () => { - describe('Check methods existance', () => { - it('exists and is a function', () => { +describe('VubleAdapter', function () { + describe('Check methods existance', function () { + it('exists and is a function', function () { expect(adapter.isBidRequestValid).to.exist.and.to.be.a('function'); }); - it('exists and is a function', () => { + it('exists and is a function', function () { expect(adapter.buildRequests).to.exist.and.to.be.a('function'); }); - it('exists and is a function', () => { + it('exists and is a function', function () { expect(adapter.interpretResponse).to.exist.and.to.be.a('function'); }); - it('exists and is a function', () => { + it('exists and is a function', function () { expect(adapter.getUserSyncs).to.exist.and.to.be.a('function'); }); }); - describe('Check method isBidRequestValid return', () => { + describe('Check method isBidRequestValid return', function () { let bid = { bidder: 'vuble', params: { @@ -37,11 +37,11 @@ describe('VubleAdapter', () => { }, }; - it('should be true', () => { + it('should be true', function () { expect(adapter.isBidRequestValid(bid)).to.be.true; }); - it('should be false because the sizes are missing or in the wrong format', () => { + it('should be false because the sizes are missing or in the wrong format', function () { let wrongBid = utils.deepClone(bid); wrongBid.sizes = '640360'; expect(adapter.isBidRequestValid(wrongBid)).to.be.false; @@ -51,7 +51,7 @@ describe('VubleAdapter', () => { expect(adapter.isBidRequestValid(wrongBid)).to.be.false; }); - it('should be false because the mediaType is missing or wrong', () => { + it('should be false because the mediaType is missing or wrong', function () { let wrongBid = utils.deepClone(bid); wrongBid.mediaTypes = {}; expect(adapter.isBidRequestValid(wrongBid)).to.be.false; @@ -61,7 +61,7 @@ describe('VubleAdapter', () => { expect(adapter.isBidRequestValid(wrongBid)).to.be.false; }); - it('should be false because the env is missing or wrong', () => { + it('should be false because the env is missing or wrong', function () { let wrongBid = utils.deepClone(bid); wrongBid.params.env = 'us'; expect(adapter.isBidRequestValid(wrongBid)).to.be.false; @@ -71,22 +71,22 @@ describe('VubleAdapter', () => { expect(adapter.isBidRequestValid(wrongBid)).to.be.false; }); - it('should be false because params.pubId is missing', () => { + it('should be false because params.pubId is missing', function () { let wrongBid = utils.deepClone(bid); delete wrongBid.params.pubId; expect(adapter.isBidRequestValid(wrongBid)).to.be.false; }); - it('should be false because params.zoneId is missing', () => { + it('should be false because params.zoneId is missing', function () { let wrongBid = utils.deepClone(bid); delete wrongBid.params.zoneId; expect(adapter.isBidRequestValid(wrongBid)).to.be.false; }); }); - describe('Check buildRequests method', () => { + describe('Check buildRequests method', function () { let sandbox; - before(() => { + before(function () { sandbox = sinon.sandbox.create(); sandbox.stub(utils, 'getTopWindowUrl').returns('http://www.vuble.tv/'); }); @@ -161,17 +161,17 @@ describe('VubleAdapter', () => { } }; - it('must return the right formatted requests', () => { + it('must return the right formatted requests', function () { let rs = adapter.buildRequests([bid1, bid2]); expect(adapter.buildRequests([bid1, bid2])).to.deep.equal([request1, request2]); }); - after(() => { + after(function () { sandbox.restore(); }); }); - describe('Check interpretResponse method return', () => { + describe('Check interpretResponse method return', function () { // Server's response let response = { body: { @@ -213,11 +213,11 @@ describe('VubleAdapter', () => { mediaType: 'video' }; - it('should equal to the expected formatted result', () => { + it('should equal to the expected formatted result', function () { expect(adapter.interpretResponse(response, bid)).to.deep.equal([result]); }); - it('should be empty because the status is missing or wrong', () => { + it('should be empty because the status is missing or wrong', function () { let wrongResponse = utils.deepClone(response); wrongResponse.body.status = 'ko'; expect(adapter.interpretResponse(wrongResponse, bid)).to.be.empty; @@ -227,7 +227,7 @@ describe('VubleAdapter', () => { expect(adapter.interpretResponse(wrongResponse, bid)).to.be.empty; }); - it('should be empty because the body is missing or wrong', () => { + it('should be empty because the body is missing or wrong', function () { let wrongResponse = utils.deepClone(response); wrongResponse.body = [1, 2, 3]; expect(adapter.interpretResponse(wrongResponse, bid)).to.be.empty; @@ -237,7 +237,7 @@ describe('VubleAdapter', () => { expect(adapter.interpretResponse(wrongResponse, bid)).to.be.empty; }); - it('should equal to the expected formatted result', () => { + it('should equal to the expected formatted result', function () { response.body.renderer_url = 'vuble_renderer.js'; result.adUnitCode = 'code'; let formattedResponses = adapter.interpretResponse(response, bid); @@ -245,7 +245,7 @@ describe('VubleAdapter', () => { }); }); - describe('Check getUserSyncs method return', () => { + describe('Check getUserSyncs method return', function () { // Sync options let syncOptions = { iframeEnabled: false @@ -265,7 +265,7 @@ describe('VubleAdapter', () => { url: 'http://player.mediabong.net/csifr?1234' }; - it('should return an empty array', () => { + it('should return an empty array', function () { expect(adapter.getUserSyncs({}, [])).to.be.empty; expect(adapter.getUserSyncs({}, [])).to.be.empty; expect(adapter.getUserSyncs(syncOptions, [response])).to.be.empty; @@ -275,7 +275,7 @@ describe('VubleAdapter', () => { expect(adapter.getUserSyncs(syncOptions, [response])).to.be.empty; }); - it('should be equal to the expected result', () => { + it('should be equal to the expected result', function () { response.body.iframeSync = 'http://player.mediabong.net/csifr?1234'; expect(adapter.getUserSyncs(syncOptions, [response])).to.deep.equal([result]); }) diff --git a/test/spec/modules/weboramaBidAdapter_spec.js b/test/spec/modules/weboramaBidAdapter_spec.js index ef8414eb487..d0b119825a6 100644 --- a/test/spec/modules/weboramaBidAdapter_spec.js +++ b/test/spec/modules/weboramaBidAdapter_spec.js @@ -1,7 +1,7 @@ import {expect} from 'chai'; import {spec} from '../../../modules/weboramaBidAdapter'; -describe('WeboramaAdapter', () => { +describe('WeboramaAdapter', function () { let bid = { bidId: '2dd581a2b6281d', bidder: 'weborama', @@ -16,31 +16,31 @@ describe('WeboramaAdapter', () => { transactionId: '3bb2f6da-87a6-4029-aeb0-bfe951372e62' }; - describe('isBidRequestValid', () => { - it('Should return true when placementId can be cast to a number', () => { + describe('isBidRequestValid', function () { + it('Should return true when placementId can be cast to a number', function () { expect(spec.isBidRequestValid(bid)).to.be.true; }); - it('Should return false when placementId is not a number', () => { + it('Should return false when placementId is not a number', function () { bid.params.placementId = 'aaa'; expect(spec.isBidRequestValid(bid)).to.be.false; }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let serverRequest = spec.buildRequests([bid]); - it('Creates a ServerRequest object with method, URL and data', () => { + it('Creates a ServerRequest object with method, URL and data', function () { expect(serverRequest).to.exist; expect(serverRequest.method).to.exist; expect(serverRequest.url).to.exist; expect(serverRequest.data).to.exist; }); - it('Returns POST method', () => { + it('Returns POST method', function () { expect(serverRequest.method).to.equal('POST'); }); - it('Returns valid URL', () => { + it('Returns valid URL', function () { expect(serverRequest.url).to.equal('//supply.nl.weborama.fr/?c=o&m=multi'); }); - it('Returns valid data if array of bids is valid', () => { + it('Returns valid data if array of bids is valid', function () { let data = serverRequest.data; expect(data).to.be.an('object'); expect(data).to.have.all.keys('deviceWidth', 'deviceHeight', 'secure', 'host', 'page', 'placements'); @@ -59,13 +59,13 @@ describe('WeboramaAdapter', () => { expect(placement.sizes).to.be.an('array'); } }); - it('Returns empty data if no valid requests are passed', () => { + it('Returns empty data if no valid requests are passed', function () { serverRequest = spec.buildRequests([]); let data = serverRequest.data; expect(data.placements).to.be.an('array').that.is.empty; }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { let resObject = { body: [ { requestId: '123', @@ -81,7 +81,7 @@ describe('WeboramaAdapter', () => { } ] }; let serverResponses = spec.interpretResponse(resObject); - it('Returns an array of valid server responses if response object is valid', () => { + it('Returns an array of valid server responses if response object is valid', function () { expect(serverResponses).to.be.an('array').that.is.not.empty; for (let i = 0; i < serverResponses.length; i++) { let dataItem = serverResponses[i]; @@ -98,16 +98,16 @@ describe('WeboramaAdapter', () => { expect(dataItem.currency).to.be.a('string'); expect(dataItem.mediaType).to.be.a('string'); } - it('Returns an empty array if invalid response is passed', () => { + it('Returns an empty array if invalid response is passed', function () { serverResponses = spec.interpretResponse('invalid_response'); expect(serverResponses).to.be.an('array').that.is.empty; }); }); }); - describe('getUserSyncs', () => { + describe('getUserSyncs', function () { let userSync = spec.getUserSyncs(); - it('Returns valid URL and `', () => { + it('Returns valid URL and `', function () { expect(userSync).to.be.an('array').with.lengthOf(1); expect(userSync[0].type).to.exist; expect(userSync[0].url).to.exist; diff --git a/test/spec/modules/widespaceBidAdapter_spec.js b/test/spec/modules/widespaceBidAdapter_spec.js index 81d2528465e..dc0d547d47a 100644 --- a/test/spec/modules/widespaceBidAdapter_spec.js +++ b/test/spec/modules/widespaceBidAdapter_spec.js @@ -2,7 +2,7 @@ import { expect } from 'chai'; import { spec } from 'modules/widespaceBidAdapter'; import includes from 'core-js/library/fn/array/includes'; -describe('+widespaceAdatperTest', () => { +describe('+widespaceAdatperTest', function () { // Dummy bid request const bidRequest = [{ 'adUnitCode': 'div-gpt-ad-1460505748561-0', @@ -110,8 +110,8 @@ describe('+widespaceAdatperTest', () => { navigator.connection.type = 'wifi'; } - describe('+bidRequestValidity', () => { - it('bidRequest with sid and currency params', () => { + describe('+bidRequestValidity', function () { + it('bidRequest with sid and currency params', function () { expect(spec.isBidRequestValid({ bidder: 'widespace', params: { @@ -121,7 +121,7 @@ describe('+widespaceAdatperTest', () => { })).to.equal(true); }); - it('-bidRequest with missing sid', () => { + it('-bidRequest with missing sid', function () { expect(spec.isBidRequestValid({ bidder: 'widespace', params: { @@ -130,7 +130,7 @@ describe('+widespaceAdatperTest', () => { })).to.equal(false); }); - it('-bidRequest with missing currency', () => { + it('-bidRequest with missing currency', function () { expect(spec.isBidRequestValid({ bidder: 'widespace', params: { @@ -140,37 +140,37 @@ describe('+widespaceAdatperTest', () => { }); }); - describe('+bidRequest', () => { + describe('+bidRequest', function () { const request = spec.buildRequests(bidRequest, bidderRequest); const UrlRegExp = /^((ftp|http|https):)?\/\/[^ "]+$/; - it('-bidRequest method is POST', () => { + it('-bidRequest method is POST', function () { expect(request[0].method).to.equal('POST'); }); - it('-bidRequest url is valid', () => { + it('-bidRequest url is valid', function () { expect(UrlRegExp.test(request[0].url)).to.equal(true); }); - it('-bidRequest data exist', () => { + it('-bidRequest data exist', function () { expect(request[0].data).to.exists; }); - it('-bidRequest data is form data', () => { + it('-bidRequest data is form data', function () { expect(typeof request[0].data).to.equal('string'); }); - it('-bidRequest options have header type', () => { + it('-bidRequest options have header type', function () { expect(request[0].options.contentType).to.exists; }); - it('-cookie test for wsCustomData ', () => { + it('-cookie test for wsCustomData ', function () { expect(request[0].data.indexOf('hb.cd') > -1).to.equal(true); }); }); - describe('+interpretResponse', () => { - it('-required params available in response', () => { + describe('+interpretResponse', function () { + it('-required params available in response', function () { const result = spec.interpretResponse(bidResponse, bidRequest); let requiredKeys = [ 'requestId', @@ -201,19 +201,19 @@ describe('+widespaceAdatperTest', () => { }); }); - it('-empty result if noad responded', () => { + it('-empty result if noad responded', function () { const noAdResult = spec.interpretResponse(bidResponseNoAd, bidRequest); expect(noAdResult.length).to.equal(0); }); - it('-empty response should not breake anything in adapter', () => { + it('-empty response should not breake anything in adapter', function () { const noResponse = spec.interpretResponse({}, bidRequest); expect(noResponse.length).to.equal(0); }); }); - describe('+getUserSyncs', () => { - it('-always return an array', () => { + describe('+getUserSyncs', function () { + it('-always return an array', function () { const userSync_test1 = spec.getUserSyncs({}, [bidResponse]); expect(Array.isArray(userSync_test1)).to.equal(true); diff --git a/test/spec/modules/xendizBidAdapter_spec.js b/test/spec/modules/xendizBidAdapter_spec.js index 66b9dc62b88..4d1aa3c935f 100644 --- a/test/spec/modules/xendizBidAdapter_spec.js +++ b/test/spec/modules/xendizBidAdapter_spec.js @@ -34,39 +34,39 @@ const bidResponse = { const noBidResponse = { body: { id: '1d1a030790a475', bids: [] } }; -describe('xendizBidAdapter', () => { +describe('xendizBidAdapter', function () { const adapter = newBidder(spec); - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { - it('should return false', () => { + describe('isBidRequestValid', function () { + it('should return false', function () { let bid = Object.assign({}, bidRequest); bid.params = {}; expect(spec.isBidRequestValid(bid)).to.equal(false); }); - it('should return true', () => { + it('should return true', function () { expect(spec.isBidRequestValid(bidRequest)).to.equal(true); }); }); - describe('buildRequests', () => { - it('should format valid url', () => { + describe('buildRequests', function () { + it('should format valid url', function () { const request = spec.buildRequests([bidRequest]); expect(request.url).to.equal(VALID_ENDPOINT); }); - it('should format valid url', () => { + it('should format valid url', function () { const request = spec.buildRequests([bidRequest]); expect(request.url).to.equal(VALID_ENDPOINT); }); - it('should format valid request body', () => { + it('should format valid request body', function () { const request = spec.buildRequests([bidRequest]); const payload = JSON.parse(request.data); expect(payload.id).to.exist; @@ -74,7 +74,7 @@ describe('xendizBidAdapter', () => { expect(payload.device).to.exist; }); - it('should attach valid device info', () => { + it('should attach valid device info', function () { const request = spec.buildRequests([bidRequest]); const payload = JSON.parse(request.data); expect(payload.device).to.deep.equal([ @@ -84,7 +84,7 @@ describe('xendizBidAdapter', () => { ]); }); - it('should transform sizes', () => { + it('should transform sizes', function () { const request = spec.buildRequests([bidRequest]); const payload = JSON.parse(request.data); const item = payload.items[0]; @@ -92,8 +92,8 @@ describe('xendizBidAdapter', () => { }); }); - describe('interpretResponse', () => { - it('should get correct bid response', () => { + describe('interpretResponse', function () { + it('should get correct bid response', function () { const result = spec.interpretResponse(bidResponse); const validResponse = [{ requestId: '30b31c1838de1e', @@ -111,7 +111,7 @@ describe('xendizBidAdapter', () => { expect(result).to.deep.equal(validResponse); }); - it('handles nobid responses', () => { + it('handles nobid responses', function () { let result = spec.interpretResponse(noBidResponse); expect(result.length).to.equal(0); }); diff --git a/test/spec/modules/xhbBidAdapter_spec.js b/test/spec/modules/xhbBidAdapter_spec.js index 98bc744224c..e48d3011ed2 100644 --- a/test/spec/modules/xhbBidAdapter_spec.js +++ b/test/spec/modules/xhbBidAdapter_spec.js @@ -5,16 +5,16 @@ import { deepClone } from 'src/utils'; const ENDPOINT = '//ib.adnxs.com/ut/v3/prebid'; -describe('xhbAdapter', () => { +describe('xhbAdapter', function () { const adapter = newBidder(spec); - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function'); }); }); - describe('isBidRequestValid', () => { + describe('isBidRequestValid', function () { let bid = { 'bidder': 'xhb', 'params': { @@ -27,11 +27,11 @@ describe('xhbAdapter', () => { 'auctionId': '1d1a030790a475', }; - it('should return true when required params found', () => { + it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return true when required params found', () => { + it('should return true when required params found', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -42,7 +42,7 @@ describe('xhbAdapter', () => { expect(spec.isBidRequestValid(bid)).to.equal(true); }); - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { @@ -52,7 +52,7 @@ describe('xhbAdapter', () => { }); }); - describe('buildRequests', () => { + describe('buildRequests', function () { let bidRequests = [ { 'bidder': 'xhb', @@ -67,7 +67,7 @@ describe('xhbAdapter', () => { } ]; - it('should parse out private sizes', () => { + it('should parse out private sizes', function () { let bidRequest = Object.assign({}, bidRequests[0], { @@ -85,7 +85,7 @@ describe('xhbAdapter', () => { expect(payload.tags[0].private_sizes).to.deep.equal([{width: 300, height: 250}]); }); - it('should add source and verison to the tag', () => { + it('should add source and verison to the tag', function () { const request = spec.buildRequests(bidRequests); const payload = JSON.parse(request.data); expect(payload.sdk).to.exist; @@ -95,7 +95,7 @@ describe('xhbAdapter', () => { }); }); - it('should populate the ad_types array on all requests', () => { + it('should populate the ad_types array on all requests', function () { ['banner', 'video', 'native'].forEach(type => { const bidRequest = Object.assign({}, bidRequests[0]); bidRequest.mediaTypes = {}; @@ -108,7 +108,7 @@ describe('xhbAdapter', () => { }); }); - it('should populate the ad_types array on outstream requests', () => { + it('should populate the ad_types array on outstream requests', function () { const bidRequest = Object.assign({}, bidRequests[0]); bidRequest.mediaTypes = {}; bidRequest.mediaTypes.video = {context: 'outstream'}; @@ -119,13 +119,13 @@ describe('xhbAdapter', () => { expect(payload.tags[0].ad_types).to.deep.equal(['video']); }); - it('sends bid request to ENDPOINT via POST', () => { + it('sends bid request to ENDPOINT via POST', function () { const request = spec.buildRequests(bidRequests); expect(request.url).to.equal(ENDPOINT); expect(request.method).to.equal('POST'); }); - it('should attach valid video params to the tag', () => { + it('should attach valid video params to the tag', function () { let bidRequest = Object.assign({}, bidRequests[0], { @@ -148,7 +148,7 @@ describe('xhbAdapter', () => { }); }); - it('should attach valid user params to the tag', () => { + it('should attach valid user params to the tag', function () { let bidRequest = Object.assign({}, bidRequests[0], { @@ -171,7 +171,7 @@ describe('xhbAdapter', () => { }); }); - it('should attach native params to the request', () => { + it('should attach native params to the request', function () { let bidRequest = Object.assign({}, bidRequests[0], { @@ -198,7 +198,7 @@ describe('xhbAdapter', () => { }); }); - it('sets minimum native asset params when not provided on adunit', () => { + it('sets minimum native asset params when not provided on adunit', function () { let bidRequest = Object.assign({}, bidRequests[0], { @@ -217,7 +217,7 @@ describe('xhbAdapter', () => { }); }); - it('does not overwrite native ad unit params with mimimum params', () => { + it('does not overwrite native ad unit params with mimimum params', function () { let bidRequest = Object.assign({}, bidRequests[0], { @@ -249,7 +249,7 @@ describe('xhbAdapter', () => { }); }); - it('should convert keyword params to proper form and attaches to request', () => { + it('should convert keyword params to proper form and attaches to request', function () { let bidRequest = Object.assign({}, bidRequests[0], { @@ -288,7 +288,7 @@ describe('xhbAdapter', () => { }]); }); - it('should add payment rules to the request', () => { + it('should add payment rules to the request', function () { let bidRequest = Object.assign({}, bidRequests[0], { @@ -305,7 +305,7 @@ describe('xhbAdapter', () => { expect(payload.tags[0].use_pmt_rule).to.equal(true); }); - it('should add gdpr consent information to the request', () => { + it('should add gdpr consent information to the request', function () { let consentString = 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A=='; let bidderRequest = { 'bidderCode': 'xhb', @@ -328,7 +328,7 @@ describe('xhbAdapter', () => { }); }); - describe('interpretResponse', () => { + describe('interpretResponse', function () { let response = { 'version': '3.0.0', 'tags': [ @@ -373,7 +373,7 @@ describe('xhbAdapter', () => { ] }; - it('should get correct bid response', () => { + it('should get correct bid response', function () { let expectedResponse = [ { 'requestId': '3db3773286ee59', @@ -397,7 +397,7 @@ describe('xhbAdapter', () => { expect(Object.keys(result[0])).to.have.members(Object.keys(expectedResponse[0])); }); - it('handles nobid responses', () => { + it('handles nobid responses', function () { let response = { 'version': '0.0.1', 'tags': [{ @@ -413,7 +413,7 @@ describe('xhbAdapter', () => { expect(result.length).to.equal(0); }); - it('handles non-banner media responses', () => { + it('handles non-banner media responses', function () { let response = { 'tags': [{ 'uuid': '84ab500420319d', @@ -437,7 +437,7 @@ describe('xhbAdapter', () => { expect(result[0]).to.have.property('mediaType', 'video'); }); - it('handles native responses', () => { + it('handles native responses', function () { let response1 = deepClone(response); response1.tags[0].ads[0].ad_type = 'native'; response1.tags[0].ads[0].rtb.native = { @@ -471,7 +471,7 @@ describe('xhbAdapter', () => { expect(result[0].native.image.url).to.equal('http://cdn.adnxs.com/img.png'); }); - it('supports configuring outstream renderers', () => { + it('supports configuring outstream renderers', function () { const outstreamResponse = deepClone(response); outstreamResponse.tags[0].ads[0].rtb.video = {}; outstreamResponse.tags[0].ads[0].renderer_url = 'renderer.js'; diff --git a/test/spec/modules/yieldlabBidAdapter_spec.js b/test/spec/modules/yieldlabBidAdapter_spec.js index a58a10ae153..0e97910bbb7 100644 --- a/test/spec/modules/yieldlabBidAdapter_spec.js +++ b/test/spec/modules/yieldlabBidAdapter_spec.js @@ -29,17 +29,17 @@ const RESPONSE = { pid: 2222 } -describe('yieldlabBidAdapter', () => { +describe('yieldlabBidAdapter', function () { const adapter = newBidder(spec) - describe('inherited functions', () => { - it('exists and is a function', () => { + describe('inherited functions', function () { + it('exists and is a function', function () { expect(adapter.callBids).to.exist.and.to.be.a('function') }) }) - describe('isBidRequestValid', () => { - it('should return true when required params found', () => { + describe('isBidRequestValid', function () { + it('should return true when required params found', function () { const request = { 'params': { 'adslotId': '1111', @@ -50,24 +50,24 @@ describe('yieldlabBidAdapter', () => { expect(spec.isBidRequestValid(request)).to.equal(true) }) - it('should return false when required params are not passed', () => { + it('should return false when required params are not passed', function () { expect(spec.isBidRequestValid({})).to.equal(false) }) }) - describe('buildRequests', () => { + describe('buildRequests', function () { const bidRequests = [REQUEST] const request = spec.buildRequests(bidRequests) - it('sends bid request to ENDPOINT via GET', () => { + it('sends bid request to ENDPOINT via GET', function () { expect(request.method).to.equal('GET') }) - it('returns a list of valid requests', () => { + it('returns a list of valid requests', function () { expect(request.validBidRequests).to.eql([REQUEST]) }) - it('passes targeting to bid request', () => { + it('passes targeting to bid request', function () { expect(request.url).to.include('t=key1%3Dvalue1%26key2%3Dvalue2') }) @@ -78,23 +78,23 @@ describe('yieldlabBidAdapter', () => { } }) - it('passes gdpr flag and consent if present', () => { + it('passes gdpr flag and consent if present', function () { expect(gdprRequest.url).to.include('consent=BN5lERiOMYEdiAKAWXEND1AAAAE6DABACMA') expect(gdprRequest.url).to.include('gdpr=true') }) }) - describe('interpretResponse', () => { + describe('interpretResponse', function () { const validRequests = { validBidRequests: [REQUEST] } - it('handles nobid responses', () => { + it('handles nobid responses', function () { expect(spec.interpretResponse({body: {}}, {validBidRequests: []}).length).to.equal(0) expect(spec.interpretResponse({body: []}, {validBidRequests: []}).length).to.equal(0) }) - it('should get correct bid response', () => { + it('should get correct bid response', function () { const result = spec.interpretResponse({body: [RESPONSE]}, validRequests) expect(result[0].requestId).to.equal('2d925f27f5079f') @@ -110,7 +110,7 @@ describe('yieldlabBidAdapter', () => { expect(result[0].ad).to.include('" }); @@ -1034,7 +1034,7 @@ describe('Unit: Prebid Module', function () { assert.ok(spyLogError.calledWith(error), 'expected error was logged'); }); - it('should not render videos', () => { + it('should not render videos', function () { pushBidResponseToAuction({ mediatype: 'video' }); @@ -1070,7 +1070,7 @@ describe('Unit: Prebid Module', function () { assert.deepEqual($$PREBID_GLOBAL$$.getAllWinningBids()[0], adResponse); }); - it('fires billing url if present on s2s bid', () => { + it('fires billing url if present on s2s bid', function () { const burl = 'http://www.example.com/burl'; pushBidResponseToAuction({ ad: '
ad
', @@ -1085,7 +1085,7 @@ describe('Unit: Prebid Module', function () { }); }); - describe('requestBids', () => { + describe('requestBids', function () { let logMessageSpy; let makeRequestsStub; let xhr; @@ -1128,7 +1128,7 @@ describe('Unit: Prebid Module', function () { 'start': 1000 }]; - beforeEach(() => { + beforeEach(function () { logMessageSpy = sinon.spy(utils, 'logMessage'); makeRequestsStub = sinon.stub(adaptermanager, 'makeBidRequests'); makeRequestsStub.returns(bidRequests); @@ -1151,7 +1151,7 @@ describe('Unit: Prebid Module', function () { createAuctionStub.returns(auction); }); - afterEach(() => { + afterEach(function () { clock.restore(); adaptermanager.makeBidRequests.restore(); auctionModule.newAuction.restore(); @@ -1159,7 +1159,7 @@ describe('Unit: Prebid Module', function () { xhr.restore(); }); - it('should execute callback after timeout', () => { + it('should execute callback after timeout', function () { let spec = { code: BIDDER_CODE, isBidRequestValid: sinon.stub(), @@ -1193,17 +1193,19 @@ describe('Unit: Prebid Module', function () { }); }) - describe('requestBids', () => { + describe('requestBids', function () { let xhr; let requests; - beforeEach(() => { + beforeEach(function () { xhr = sinon.useFakeXMLHttpRequest(); requests = []; xhr.onCreate = request => requests.push(request); }); - afterEach(() => xhr.restore()); + afterEach(function () { + xhr.restore(); + }); var adUnitsBackup; var auctionManagerStub; let logMessageSpy @@ -1217,10 +1219,10 @@ describe('Unit: Prebid Module', function () { }; registerBidder(spec); - describe('part 1', () => { + describe('part 1', function () { let auctionArgs; - beforeEach(() => { + beforeEach(function () { adUnitsBackup = auction.getAdUnits auctionManagerStub = sinon.stub(auctionManager, 'createAuction').callsFake(function() { auctionArgs = arguments[0]; @@ -1229,14 +1231,14 @@ describe('Unit: Prebid Module', function () { logMessageSpy = sinon.spy(utils, 'logMessage'); }); - afterEach(() => { + afterEach(function () { auction.getAdUnits = adUnitsBackup; auctionManager.createAuction.restore(); utils.logMessage.restore(); resetAuction(); }); - it('should log message when adUnits not configured', () => { + it('should log message when adUnits not configured', function () { $$PREBID_GLOBAL$$.adUnits = []; try { $$PREBID_GLOBAL$$.requestBids({}); @@ -1246,7 +1248,7 @@ describe('Unit: Prebid Module', function () { assert.ok(logMessageSpy.calledWith('No adUnits configured. No bids requested.'), 'expected message was logged'); }); - it('should attach transactionIds to ads (or pass through transactionId if it already exists)', () => { + it('should attach transactionIds to ads (or pass through transactionId if it already exists)', function () { $$PREBID_GLOBAL$$.requestBids({ adUnits: [ { @@ -1266,7 +1268,7 @@ describe('Unit: Prebid Module', function () { .and.to.match(/[a-f0-9\-]{36}/i); }); - it('should execute callback immediately if adUnits is empty', () => { + it('should execute callback immediately if adUnits is empty', function () { var bidsBackHandler = function bidsBackHandlerCallback() {}; var spyExecuteCallback = sinon.spy(bidsBackHandler); @@ -1279,7 +1281,7 @@ describe('Unit: Prebid Module', function () { ' empty'); }); - it('should not propagate exceptions from bidsBackHandler', () => { + it('should not propagate exceptions from bidsBackHandler', function () { $$PREBID_GLOBAL$$.adUnits = []; var requestObj = { @@ -1295,12 +1297,12 @@ describe('Unit: Prebid Module', function () { }); }); - describe('multiformat requests', () => { + describe('multiformat requests', function () { let spyCallBids; let createAuctionStub; let adUnits; - beforeEach(() => { + beforeEach(function () { adUnits = [{ code: 'adUnit-code', mediaTypes: { @@ -1321,12 +1323,12 @@ describe('Unit: Prebid Module', function () { createAuctionStub.returns(auction); }) - afterEach(() => { + afterEach(function () { auctionModule.newAuction.restore(); adaptermanager.callBids.restore(); }); - it('bidders that support one of the declared formats are allowed to participate', () => { + it('bidders that support one of the declared formats are allowed to participate', function () { $$PREBID_GLOBAL$$.requestBids({adUnits}); sinon.assert.calledOnce(adaptermanager.callBids); @@ -1337,7 +1339,7 @@ describe('Unit: Prebid Module', function () { expect(biddersCalled.length).to.equal(2); }); - it('bidders that do not support one of the declared formats are dropped', () => { + it('bidders that do not support one of the declared formats are dropped', function () { delete adUnits[0].mediaTypes.banner; $$PREBID_GLOBAL$$.requestBids({adUnits}); @@ -1351,12 +1353,12 @@ describe('Unit: Prebid Module', function () { }); }); - describe('part 2', () => { + describe('part 2', function () { let spyCallBids; let createAuctionStub; let adUnits; - before(() => { + before(function () { adUnits = [{ code: 'adUnit-code', sizes: [[300, 250], [300, 600]], @@ -1387,24 +1389,24 @@ describe('Unit: Prebid Module', function () { createAuctionStub.returns(auction); }); - after(() => { + after(function () { auctionModule.newAuction.restore(); }); - beforeEach(() => { + beforeEach(function () { spyCallBids = sinon.spy(adaptermanager, 'callBids'); }) - afterEach(() => { + afterEach(function () { adaptermanager.callBids.restore(); }) - it('should callBids if a native adUnit has all native bidders', () => { + it('should callBids if a native adUnit has all native bidders', function () { $$PREBID_GLOBAL$$.requestBids({adUnits}); sinon.assert.calledOnce(adaptermanager.callBids); }); - it('should call callBids function on adaptermanager', () => { + it('should call callBids function on adaptermanager', function () { let adUnits = [{ code: 'adUnit-code', sizes: [[300, 250], [300, 600]], @@ -1416,7 +1418,7 @@ describe('Unit: Prebid Module', function () { assert.ok(spyCallBids.called, 'called adaptermanager.callBids'); }); - it('splits native type to individual native assets', () => { + it('splits native type to individual native assets', function () { let adUnits = [{ code: 'adUnit-code', nativeParams: {type: 'image'}, @@ -1440,7 +1442,7 @@ describe('Unit: Prebid Module', function () { }); }); - describe('part-3', () => { + describe('part-3', function () { let auctionManagerInstance = newAuctionManager(); let auctionManagerStub; let adUnits1 = getAdUnits().filter((adUnit) => { @@ -1500,7 +1502,7 @@ describe('Unit: Prebid Module', function () { adaptermanager.callBids.restore(); }); - it('should not queue bid requests when a previous bid request is in process', () => { + it('should not queue bid requests when a previous bid request is in process', function () { var requestObj1 = { bidsBackHandler: function bidsBackHandlerCallback() {}, timeout: 2000, @@ -1543,8 +1545,8 @@ describe('Unit: Prebid Module', function () { }); }); - describe('onEvent', () => { - it('should log an error when handler is not a function', () => { + describe('onEvent', function () { + it('should log an error when handler is not a function', function () { var spyLogError = sinon.spy(utils, 'logError'); var event = 'testEvent'; $$PREBID_GLOBAL$$.onEvent(event); @@ -1553,7 +1555,7 @@ describe('Unit: Prebid Module', function () { utils.logError.restore(); }); - it('should log an error when id provided is not valid for event', () => { + it('should log an error when id provided is not valid for event', function () { var spyLogError = sinon.spy(utils, 'logError'); var event = 'bidWon'; $$PREBID_GLOBAL$$.onEvent(event, Function, 'testId'); @@ -1562,7 +1564,7 @@ describe('Unit: Prebid Module', function () { utils.logError.restore(); }); - it('should call events.on with valid parameters', () => { + it('should call events.on with valid parameters', function () { var spyEventsOn = sinon.spy(events, 'on'); $$PREBID_GLOBAL$$.onEvent('bidWon', Function); assert.ok(spyEventsOn.calledWith('bidWon', Function)); @@ -1570,15 +1572,15 @@ describe('Unit: Prebid Module', function () { }); }); - describe('offEvent', () => { - it('should return when id provided is not valid for event', () => { + describe('offEvent', function () { + it('should return when id provided is not valid for event', function () { var spyEventsOff = sinon.spy(events, 'off'); $$PREBID_GLOBAL$$.offEvent('bidWon', Function, 'testId'); assert.ok(spyEventsOff.notCalled); events.off.restore(); }); - it('should call events.off with valid parameters', () => { + it('should call events.off with valid parameters', function () { var spyEventsOff = sinon.spy(events, 'off'); $$PREBID_GLOBAL$$.offEvent('bidWon', Function); assert.ok(spyEventsOff.calledWith('bidWon', Function)); @@ -1586,8 +1588,8 @@ describe('Unit: Prebid Module', function () { }); }); - describe('emit', () => { - it('should be able to emit event without arguments', () => { + describe('emit', function () { + it('should be able to emit event without arguments', function () { var spyEventsEmit = sinon.spy(events, 'emit'); events.emit(CONSTANTS.EVENTS.AUCTION_END); assert.ok(spyEventsEmit.calledWith('auctionEnd')); @@ -1595,15 +1597,15 @@ describe('Unit: Prebid Module', function () { }); }); - describe('registerBidAdapter', () => { - it('should register bidAdaptor with adaptermanager', () => { + describe('registerBidAdapter', function () { + it('should register bidAdaptor with adaptermanager', function () { var registerBidAdapterSpy = sinon.spy(adaptermanager, 'registerBidAdapter'); $$PREBID_GLOBAL$$.registerBidAdapter(Function, 'biddercode'); assert.ok(registerBidAdapterSpy.called, 'called adaptermanager.registerBidAdapter'); adaptermanager.registerBidAdapter.restore(); }); - it('should catch thrown errors', () => { + it('should catch thrown errors', function () { var spyLogError = sinon.spy(utils, 'logError'); var errorObject = { message: 'bidderAdaptor error' }; var bidderAdaptor = sinon.stub().throws(errorObject); @@ -1616,8 +1618,8 @@ describe('Unit: Prebid Module', function () { }); }); - describe('createBid', () => { - it('should return a bid object', () => { + describe('createBid', function () { + it('should return a bid object', function () { const statusCode = 1; const bid = $$PREBID_GLOBAL$$.createBid(statusCode); assert.isObject(bid, 'bid is an object'); @@ -1629,8 +1631,8 @@ describe('Unit: Prebid Module', function () { }); }); - describe('loadScript', () => { - it('should call adloader.loadScript', () => { + describe('loadScript', function () { + it('should call adloader.loadScript', function () { const loadScriptSpy = sinon.spy(adloader, 'loadScript'); const tagSrc = ''; const callback = Function; @@ -1642,8 +1644,8 @@ describe('Unit: Prebid Module', function () { }); }); - describe('aliasBidder', () => { - it('should call adaptermanager.aliasBidder', () => { + describe('aliasBidder', function () { + it('should call adaptermanager.aliasBidder', function () { const aliasBidAdapterSpy = sinon.spy(adaptermanager, 'aliasBidAdapter'); const bidderCode = 'testcode'; const alias = 'testalias'; @@ -1653,7 +1655,7 @@ describe('Unit: Prebid Module', function () { adaptermanager.aliasBidAdapter.restore(); }); - it('should log error when not passed correct arguments', () => { + it('should log error when not passed correct arguments', function () { const logErrorSpy = sinon.spy(utils, 'logError'); const error = 'bidderCode and alias must be passed as arguments'; @@ -1663,8 +1665,8 @@ describe('Unit: Prebid Module', function () { }); }); - describe('setPriceGranularity', () => { - it('should log error when not passed granularity', () => { + describe('setPriceGranularity', function () { + it('should log error when not passed granularity', function () { const logErrorSpy = sinon.spy(utils, 'logError'); const error = 'Prebid Error: no value passed to `setPriceGranularity()`'; @@ -1673,7 +1675,7 @@ describe('Unit: Prebid Module', function () { utils.logError.restore(); }); - it('should log error when not passed a valid config object', () => { + it('should log error when not passed a valid config object', function () { const logErrorSpy = sinon.spy(utils, 'logError'); const error = 'Invalid custom price value passed to `setPriceGranularity()`'; const badConfig = { @@ -1696,7 +1698,7 @@ describe('Unit: Prebid Module', function () { utils.logError.restore(); }); - it('should set customPriceBucket with custom config buckets', () => { + it('should set customPriceBucket with custom config buckets', function () { let customPriceBucket = configObj.getConfig('customPriceBucket'); const goodConfig = { 'buckets': [{ @@ -1715,21 +1717,21 @@ describe('Unit: Prebid Module', function () { }); }); - describe('emit event', () => { + describe('emit event', function () { let auctionManagerStub; - beforeEach(() => { + beforeEach(function () { auctionManagerStub = sinon.stub(auctionManager, 'createAuction').callsFake(function() { return auction; }); }); - afterEach(() => { + afterEach(function () { auctionManager.createAuction.restore(); }); }); - describe('removeAdUnit', () => { - it('should remove given adUnit in adUnits array', () => { + describe('removeAdUnit', function () { + it('should remove given adUnit in adUnits array', function () { const adUnit1 = { code: 'adUnit1', bids: [{ @@ -1757,16 +1759,16 @@ describe('Unit: Prebid Module', function () { }); }); - describe('getDealTargeting', () => { - beforeEach(() => { + describe('getDealTargeting', function () { + beforeEach(function () { resetAuction(); }); - afterEach(() => { + afterEach(function () { resetAuction(); }); - it('should truncate deal keys', () => { + it('should truncate deal keys', function () { $$PREBID_GLOBAL$$._bidsReceived = [ { 'bidderCode': 'appnexusDummyName', @@ -1808,23 +1810,23 @@ describe('Unit: Prebid Module', function () { }); }); - describe('getHighestCpm', () => { - after(() => { + describe('getHighestCpm', function () { + after(function () { resetAuction(); }); - it('returns an array containing the highest bid object for the given adUnitCode', () => { + it('returns an array containing the highest bid object for the given adUnitCode', function () { const highestCpmBids = $$PREBID_GLOBAL$$.getHighestCpmBids('/19968336/header-bid-tag-0'); expect(highestCpmBids.length).to.equal(1); expect(highestCpmBids[0]).to.deep.equal(auctionManager.getBidsReceived()[1]); }); - it('returns an empty array when the given adUnit is not found', () => { + it('returns an empty array when the given adUnit is not found', function () { const highestCpmBids = $$PREBID_GLOBAL$$.getHighestCpmBids('/stallone'); expect(highestCpmBids.length).to.equal(0); }); - it('returns an empty array when the given adUnit has no bids', () => { + it('returns an empty array when the given adUnit has no bids', function () { let _bidsReceived = getBidResponses()[0]; _bidsReceived.cpm = 0; auction.getBidsReceived = function() { return _bidsReceived }; @@ -1851,8 +1853,8 @@ describe('Unit: Prebid Module', function () { }); }); - describe('markWinningBidAsUsed', () => { - it('marks the bid object as used for the given adUnitCode/adId combination', () => { + describe('markWinningBidAsUsed', function () { + it('marks the bid object as used for the given adUnitCode/adId combination', function () { // make sure the auction has "state" and does not reload the fixtures const adUnitCode = '/19968336/header-bid-tag-0'; const bidsReceived = $$PREBID_GLOBAL$$.getBidResponsesForAdUnitCode(adUnitCode); @@ -1869,7 +1871,7 @@ describe('Unit: Prebid Module', function () { resetAuction(); }); - it('try and mark the bid object, but fail because we supplied the wrong adId', () => { + it('try and mark the bid object, but fail because we supplied the wrong adId', function () { const adUnitCode = '/19968336/header-bid-tag-0'; const bidsReceived = $$PREBID_GLOBAL$$.getBidResponsesForAdUnitCode(adUnitCode); auction.getBidsReceived = function() { return bidsReceived.bids }; @@ -1884,7 +1886,7 @@ describe('Unit: Prebid Module', function () { resetAuction(); }); - it('marks the winning bid object as used for the given adUnitCode', () => { + it('marks the winning bid object as used for the given adUnitCode', function () { // make sure the auction has "state" and does not reload the fixtures const adUnitCode = '/19968336/header-bid-tag-0'; const bidsReceived = $$PREBID_GLOBAL$$.getBidResponsesForAdUnitCode(adUnitCode); @@ -1901,7 +1903,7 @@ describe('Unit: Prebid Module', function () { resetAuction(); }); - it('marks a bid object as used for the given adId', () => { + it('marks a bid object as used for the given adId', function () { // make sure the auction has "state" and does not reload the fixtures const adUnitCode = '/19968336/header-bid-tag-0'; const bidsReceived = $$PREBID_GLOBAL$$.getBidResponsesForAdUnitCode(adUnitCode); @@ -1919,11 +1921,11 @@ describe('Unit: Prebid Module', function () { }); }); - describe('setTargetingForAst', () => { + describe('setTargetingForAst', function () { let targeting; let auctionManagerInstance; - beforeEach(() => { + beforeEach(function () { resetAuction(); auctionManagerInstance = newAuctionManager(); sinon.stub(auctionManagerInstance, 'getBidsReceived').callsFake(function() { @@ -1938,13 +1940,13 @@ describe('Unit: Prebid Module', function () { targeting = newTargeting(auctionManagerInstance); }); - afterEach(() => { + afterEach(function () { auctionManagerInstance.getBidsReceived.restore(); auctionManagerInstance.getAdUnitCodes.restore(); resetAuction(); }); - it('should set targeting for appnexus apntag object', () => { + it('should set targeting for appnexus apntag object', function () { const bids = auctionManagerInstance.getBidsReceived(); const adUnitCode = '/19968336/header-bid-tag-0'; @@ -1963,7 +1965,7 @@ describe('Unit: Prebid Module', function () { expect(newAdserverTargeting).to.deep.equal(window.apntag.tags[adUnitCode].keywords); }); - it('should not find hb_adid key in lowercase for all bidders', () => { + it('should not find hb_adid key in lowercase for all bidders', function () { const adUnitCode = '/19968336/header-bid-tag-0'; $$PREBID_GLOBAL$$.setConfig({ enableSendAllBids: true }); targeting.setTargetingForAst(); @@ -2006,17 +2008,17 @@ describe('Unit: Prebid Module', function () { }); }); - describe('getAllPrebidWinningBids', () => { + describe('getAllPrebidWinningBids', function () { let auctionManagerStub; - beforeEach(() => { + beforeEach(function () { auctionManagerStub = sinon.stub(auctionManager, 'getBidsReceived'); }); - afterEach(() => { + afterEach(function () { auctionManagerStub.restore(); }); - it('should return prebid auction winning bids', () => { + it('should return prebid auction winning bids', function () { let bidsReceived = [ createBidReceived({bidder: 'appnexus', cpm: 7, auctionId: 1, responseTimestamp: 100, adUnitCode: 'code-0', adId: 'adid-1', status: 'targetingSet'}), createBidReceived({bidder: 'rubicon', cpm: 6, auctionId: 1, responseTimestamp: 101, adUnitCode: 'code-1', adId: 'adid-2'}), diff --git a/test/spec/url_spec.js b/test/spec/url_spec.js index cfa1b0c80b4..90047273043 100644 --- a/test/spec/url_spec.js +++ b/test/spec/url_spec.js @@ -1,31 +1,31 @@ import {format, parse} from '../../src/url'; import { expect } from 'chai'; -describe('helpers.url', () => { - describe('parse()', () => { +describe('helpers.url', function () { + describe('parse()', function () { let parsed; - beforeEach(() => { + beforeEach(function () { parsed = parse('http://example.com:3000/pathname/?search=test&foo=bar&bar=foo%26foo%3Dxxx#hash'); }); - it('extracts the protocol', () => { + it('extracts the protocol', function () { expect(parsed).to.have.property('protocol', 'http'); }); - it('extracts the hostname', () => { + it('extracts the hostname', function () { expect(parsed).to.have.property('hostname', 'example.com'); }); - it('extracts the port', () => { + it('extracts the port', function () { expect(parsed).to.have.property('port', 3000); }); - it('extracts the pathname', () => { + it('extracts the pathname', function () { expect(parsed).to.have.property('pathname', '/pathname/'); }); - it('extracts the search query', () => { + it('extracts the search query', function () { expect(parsed).to.have.property('search'); expect(parsed.search).to.eql({ foo: 'xxx', @@ -34,23 +34,23 @@ describe('helpers.url', () => { }); }); - it('extracts the hash', () => { + it('extracts the hash', function () { expect(parsed).to.have.property('hash', 'hash'); }); - it('extracts the host', () => { + it('extracts the host', function () { expect(parsed).to.have.property('host', 'example.com:3000'); }); }); - describe('parse(url, {noDecodeWholeURL: true})', () => { + describe('parse(url, {noDecodeWholeURL: true})', function () { let parsed; - beforeEach(() => { + beforeEach(function () { parsed = parse('http://example.com:3000/pathname/?search=test&foo=bar&bar=foo%26foo%3Dxxx#hash', {noDecodeWholeURL: true}); }); - it('extracts the search query', () => { + it('extracts the search query', function () { expect(parsed).to.have.property('search'); expect(parsed.search).to.eql({ foo: 'bar', @@ -60,8 +60,8 @@ describe('helpers.url', () => { }); }); - describe('format()', () => { - it('formats an object in to a URL', () => { + describe('format()', function () { + it('formats an object in to a URL', function () { expect(format({ protocol: 'http', hostname: 'example.com', @@ -72,21 +72,21 @@ describe('helpers.url', () => { })).to.equal('http://example.com:3000/pathname/?foo=bar&search=test&bar=foo%26foo%3Dxxx#hash'); }); - it('will use defaults for missing properties', () => { + it('will use defaults for missing properties', function () { expect(format({ hostname: 'example.com' })).to.equal('http://example.com'); }); }); - describe('parse(url, {decodeSearchAsString: true})', () => { + describe('parse(url, {decodeSearchAsString: true})', function () { let parsed; - beforeEach(() => { + beforeEach(function () { parsed = parse('http://example.com:3000/pathname/?search=test&foo=bar&bar=foo%26foo%3Dxxx#hash', {decodeSearchAsString: true}); }); - it('extracts the search query', () => { + it('extracts the search query', function () { expect(parsed).to.have.property('search'); expect(parsed.search).to.equal('?search=test&foo=bar&bar=foo&foo=xxx'); }); diff --git a/test/spec/userSync_spec.js b/test/spec/userSync_spec.js index 60e07441e0c..7040256ccd6 100644 --- a/test/spec/userSync_spec.js +++ b/test/spec/userSync_spec.js @@ -4,7 +4,7 @@ import { config } from 'src/config'; const utils = require('../../src/utils'); let { newUserSync } = require('../../src/userSync'); -describe('user sync', () => { +describe('user sync', function () { let triggerPixelStub; let logWarnStub; let timeoutStub; @@ -25,15 +25,15 @@ describe('user sync', () => { }) } let clock; - before(() => { + before(function () { clock = sinon.useFakeTimers(); }); - after(() => { + after(function () { clock.restore(); }); - beforeEach(() => { + beforeEach(function () { triggerPixelStub = sinon.stub(utils, 'triggerPixel'); logWarnStub = sinon.stub(utils, 'logWarn'); shuffleStub = sinon.stub(utils, 'shuffle').callsFake((array) => array.reverse()); @@ -41,7 +41,7 @@ describe('user sync', () => { insertUserSyncIframeStub = sinon.stub(utils, 'insertUserSyncIframe'); }); - afterEach(() => { + afterEach(function () { triggerPixelStub.restore(); logWarnStub.restore(); shuffleStub.restore(); @@ -49,7 +49,7 @@ describe('user sync', () => { insertUserSyncIframeStub.restore(); }); - it('should register and fire a pixel URL', () => { + it('should register and fire a pixel URL', function () { const userSync = newTestUserSync(); userSync.registerSync('image', 'testBidder', 'http://example.com'); userSync.syncUsers(); @@ -57,13 +57,13 @@ describe('user sync', () => { expect(triggerPixelStub.getCall(0).args[0]).to.exist.and.to.equal('http://example.com'); }); - it('should clear queue after sync', () => { + it('should clear queue after sync', function () { const userSync = newTestUserSync(); userSync.syncUsers(); expect(triggerPixelStub.callCount).to.equal(0); }); - it('should delay firing a pixel by the expected amount', () => { + it('should delay firing a pixel by the expected amount', function () { const userSync = newTestUserSync(); userSync.registerSync('image', 'testBidder', 'http://example.com'); // This implicitly tests cookie and browser support @@ -72,7 +72,7 @@ describe('user sync', () => { expect(triggerPixelStub.getCall(0)).to.not.be.null; }); - it('should register and fires multiple pixel URLs', () => { + it('should register and fires multiple pixel URLs', function () { const userSync = newTestUserSync(); userSync.registerSync('image', 'testBidder', 'http://example.com/1'); userSync.registerSync('image', 'testBidder', 'http://example.com/2'); @@ -84,21 +84,21 @@ describe('user sync', () => { expect(triggerPixelStub.getCall(2)).to.be.null; }); - it('should not register pixel URL since it is not supported', () => { + it('should not register pixel URL since it is not supported', function () { const userSync = newTestUserSync({pixelEnabled: false}); userSync.registerSync('image', 'testBidder', 'http://example.com'); userSync.syncUsers(); expect(triggerPixelStub.getCall(0)).to.be.null; }); - it('should register and load an iframe', () => { + it('should register and load an iframe', function () { const userSync = newTestUserSync({iframeEnabled: true}); userSync.registerSync('iframe', 'testBidder', 'http://example.com/iframe'); userSync.syncUsers(); expect(insertUserSyncIframeStub.getCall(0).args[0]).to.equal('http://example.com/iframe'); }); - it('should only trigger syncs once per page', () => { + it('should only trigger syncs once per page', function () { const userSync = newTestUserSync({pixelEnabled: true}); userSync.registerSync('image', 'testBidder', 'http://example.com/1'); userSync.syncUsers(); @@ -109,20 +109,20 @@ describe('user sync', () => { expect(triggerPixelStub.getCall(1)).to.be.null; }); - it('should not fire syncs if cookies are not supported', () => { + it('should not fire syncs if cookies are not supported', function () { const userSync = newTestUserSync({pixelEnabled: true}, true); userSync.registerSync('image', 'testBidder', 'http://example.com'); userSync.syncUsers(); expect(triggerPixelStub.getCall(0)).to.be.null; }); - it('should prevent registering invalid type', () => { + it('should prevent registering invalid type', function () { const userSync = newTestUserSync(); userSync.registerSync('invalid', 'testBidder', 'http://example.com'); expect(logWarnStub.getCall(0).args[0]).to.exist; }); - it('should expose the syncUsers method for the publisher to manually trigger syncs', () => { + it('should expose the syncUsers method for the publisher to manually trigger syncs', function () { // triggerUserSyncs should do nothing by default let userSync = newTestUserSync(); let syncUsersSpy = sinon.spy(userSync, 'syncUsers'); @@ -135,7 +135,7 @@ describe('user sync', () => { expect(syncUsersSpy.called).to.be.true; }); - it('should limit the sync per bidder', () => { + it('should limit the sync per bidder', function () { const userSync = newTestUserSync({syncsPerBidder: 2}); userSync.registerSync('image', 'testBidder', 'http://example.com/1'); userSync.registerSync('image', 'testBidder', 'http://example.com/2'); @@ -148,7 +148,7 @@ describe('user sync', () => { expect(triggerPixelStub.getCall(2)).to.be.null; }); - it('should balance out bidder requests', () => { + it('should balance out bidder requests', function () { const userSync = newTestUserSync(); userSync.registerSync('image', 'atestBidder', 'http://example.com/1'); userSync.registerSync('image', 'atestBidder', 'http://example.com/3'); @@ -164,7 +164,7 @@ describe('user sync', () => { expect(triggerPixelStub.getCall(3)).to.be.null; }); - it('should disable user sync', () => { + it('should disable user sync', function () { const userSync = newTestUserSync({syncEnabled: false}); userSync.registerSync('pixel', 'testBidder', 'http://example.com'); expect(logWarnStub.getCall(0).args[0]).to.exist; @@ -172,7 +172,7 @@ describe('user sync', () => { expect(triggerPixelStub.getCall(0)).to.be.null; }); - it('should only sync enabled bidders', () => { + it('should only sync enabled bidders', function () { const userSync = newTestUserSync({enabledBidders: ['testBidderA']}); userSync.registerSync('image', 'testBidderA', 'http://example.com/1'); userSync.registerSync('image', 'testBidderB', 'http://example.com/2'); @@ -182,7 +182,7 @@ describe('user sync', () => { expect(triggerPixelStub.getCall(1)).to.be.null; }); - it('should register config set after instantiation', () => { + it('should register config set after instantiation', function () { // start with userSync off const userSync = newTestUserSync({syncEnabled: false}); // turn it on with setConfig() @@ -193,7 +193,7 @@ describe('user sync', () => { expect(triggerPixelStub.getCall(0).args[0]).to.exist.and.to.equal('http://example.com'); }); - it('should register both image and iframe pixels with filterSettings.all config', () => { + it('should register both image and iframe pixels with filterSettings.all config', function () { const userSync = newTestUserSync({ filterSettings: { all: { @@ -211,7 +211,7 @@ describe('user sync', () => { expect(insertUserSyncIframeStub.getCall(0).args[0]).to.equal('http://example.com/iframe'); }); - it('should register iframe and not register image pixels based on filterSettings config', () => { + it('should register iframe and not register image pixels based on filterSettings config', function () { const userSync = newTestUserSync({ filterSettings: { image: { @@ -231,7 +231,7 @@ describe('user sync', () => { expect(insertUserSyncIframeStub.getCall(0).args[0]).to.equal('http://example.com/iframe'); }); - it('should throw a warning and default to basic resgistration rules when filterSettings config is invalid', () => { + it('should throw a warning and default to basic resgistration rules when filterSettings config is invalid', function () { // invalid config - passed invalid filter option const userSync1 = newTestUserSync({ filterSettings: { @@ -317,7 +317,7 @@ describe('user sync', () => { expect(insertUserSyncIframeStub.getCall(0)).to.be.null; }); - it('should overwrite logic of deprecated fields when filterSettings is defined', () => { + it('should overwrite logic of deprecated fields when filterSettings is defined', function () { const userSync = newTestUserSync({ pixelsEnabled: false, iframeEnabled: true, diff --git a/test/spec/utils_spec.js b/test/spec/utils_spec.js index 454d6ed4136..7891eff5f33 100755 --- a/test/spec/utils_spec.js +++ b/test/spec/utils_spec.js @@ -639,8 +639,8 @@ describe('Utils', function () { }); }); - describe('getDefinedParams', () => { - it('builds an object consisting of defined params', () => { + describe('getDefinedParams', function () { + it('builds an object consisting of defined params', function () { const adUnit = { mediaType: 'video', comeWithMe: 'ifuwant2live', @@ -658,8 +658,8 @@ describe('Utils', function () { }); }); - describe('deepClone', () => { - it('deep copies objects', () => { + describe('deepClone', function () { + it('deep copies objects', function () { const adUnit = [{ code: 'swan', mediaTypes: {video: {context: 'outstream'}}, @@ -679,7 +679,7 @@ describe('Utils', function () { }); }); - describe('getUserConfiguredParams', () => { + describe('getUserConfiguredParams', function () { const adUnits = [{ code: 'adUnit1', bids: [{ @@ -692,7 +692,7 @@ describe('Utils', function () { }] }]; - it('should return params configured', () => { + it('should return params configured', function () { const output = utils.getUserConfiguredParams(adUnits, 'adUnit1', 'bidder1'); const expected = [{ key1: 'value1' @@ -700,37 +700,37 @@ describe('Utils', function () { assert.deepEqual(output, expected); }); - it('should return array containting empty object, if bidder present and no params are configured', () => { + it('should return array containting empty object, if bidder present and no params are configured', function () { const output = utils.getUserConfiguredParams(adUnits, 'adUnit1', 'bidder2'); const expected = [{}]; assert.deepEqual(output, expected); }); - it('should return empty array, if bidder is not present', () => { + it('should return empty array, if bidder is not present', function () { const output = utils.getUserConfiguredParams(adUnits, 'adUnit1', 'bidder3'); const expected = []; assert.deepEqual(output, expected); }); - it('should return empty array, if adUnit is not present', () => { + it('should return empty array, if adUnit is not present', function () { const output = utils.getUserConfiguredParams(adUnits, 'adUnit2', 'bidder3'); const expected = []; assert.deepEqual(output, expected); }); }); - describe('getTopWindowLocation', () => { + describe('getTopWindowLocation', function () { let sandbox; - beforeEach(() => { + beforeEach(function () { sandbox = sinon.sandbox.create(); }); - afterEach(() => { + afterEach(function () { sandbox.restore(); }); - it('returns window.location if not in iFrame', () => { + it('returns window.location if not in iFrame', function () { sandbox.stub(utils, 'getWindowLocation').returns({ href: 'https://www.google.com/', ancestorOrigins: {}, @@ -762,7 +762,7 @@ describe('Utils', function () { expect(topWindowLocation.host).to.equal('www.google.com'); }); - it('returns parsed dom string from ancestorOrigins if in iFrame & ancestorOrigins is populated', () => { + it('returns parsed dom string from ancestorOrigins if in iFrame & ancestorOrigins is populated', function () { sandbox.stub(utils, 'getWindowSelf').returns( { self: 'is not same as top' } ); @@ -783,7 +783,7 @@ describe('Utils', function () { expect(topWindowLocation.host).to.be.oneOf(['www.google.com', 'www.google.com:443']); }); - it('returns parsed referrer string if in iFrame but no ancestorOrigins', () => { + it('returns parsed referrer string if in iFrame but no ancestorOrigins', function () { sandbox.stub(utils, 'getWindowSelf').returns( { self: 'is not same as top' } ); @@ -806,8 +806,8 @@ describe('Utils', function () { }); }); - describe('convertCamelToUnderscore', () => { - it('returns converted string value using underscore syntax instead of camelCase', () => { + describe('convertCamelToUnderscore', function () { + it('returns converted string value using underscore syntax instead of camelCase', function () { let var1 = 'placementIdTest'; let test1 = utils.convertCamelToUnderscore(var1); expect(test1).to.equal('placement_id_test'); @@ -818,18 +818,18 @@ describe('Utils', function () { }); }); - describe('getAdUnitSizes', () => { - it('returns an empty response when adUnits is undefined', () => { + describe('getAdUnitSizes', function () { + it('returns an empty response when adUnits is undefined', function () { let sizes = utils.getAdUnitSizes(); expect(sizes).to.be.undefined; }); - it('returns an empty array when invalid data is present in adUnit object', () => { + it('returns an empty array when invalid data is present in adUnit object', function () { let sizes = utils.getAdUnitSizes({ sizes: 300 }); expect(sizes).to.deep.equal([]); }); - it('retuns an array of arrays when reading from adUnit.sizes', () => { + it('retuns an array of arrays when reading from adUnit.sizes', function () { let sizes = utils.getAdUnitSizes({ sizes: [300, 250] }); expect(sizes).to.deep.equal([[300, 250]]); @@ -837,7 +837,7 @@ describe('Utils', function () { expect(sizes).to.deep.equal([[300, 250], [300, 600]]); }); - it('returns an array of arrays when reading from adUnit.mediaTypes.banner.sizes', () => { + it('returns an array of arrays when reading from adUnit.mediaTypes.banner.sizes', function () { let sizes = utils.getAdUnitSizes({ mediaTypes: { banner: { sizes: [300, 250] } } }); expect(sizes).to.deep.equal([[300, 250]]); diff --git a/test/spec/videoCache_spec.js b/test/spec/videoCache_spec.js index b853da708fc..c9052fbbf9d 100644 --- a/test/spec/videoCache_spec.js +++ b/test/spec/videoCache_spec.js @@ -5,7 +5,7 @@ import { config } from 'src/config'; const should = chai.should(); -describe('The video cache', () => { +describe('The video cache', function () { function assertError(callbackSpy) { callbackSpy.calledOnce.should.equal(true); callbackSpy.firstCall.args[0].should.be.an('error'); @@ -16,19 +16,21 @@ describe('The video cache', () => { should.not.exist(callbackSpy.firstCall.args[0]); } - describe('when the cache server is unreachable', () => { + describe('when the cache server is unreachable', function () { let xhr; let requests; - beforeEach(() => { + beforeEach(function () { xhr = sinon.useFakeXMLHttpRequest(); requests = []; xhr.onCreate = (request) => requests.push(request); }); - afterEach(() => xhr.restore()); + afterEach(function () { + xhr.restore(); + }); - it('should execute the callback with an error when store() is called', () => { + it('should execute the callback with an error when store() is called', function () { const callback = sinon.spy(); store([ { vastUrl: 'my-mock-url.com' } ], callback); @@ -41,11 +43,11 @@ describe('The video cache', () => { }); }); - describe('when the cache server is available', () => { + describe('when the cache server is available', function () { let xhr; let requests; - beforeEach(() => { + beforeEach(function () { xhr = sinon.useFakeXMLHttpRequest(); requests = []; xhr.onCreate = (request) => requests.push(request); @@ -56,12 +58,12 @@ describe('The video cache', () => { }) }); - afterEach(() => { + afterEach(function () { xhr.restore(); config.resetConfig(); }); - it('should execute the callback with a successful result when store() is called', () => { + it('should execute the callback with a successful result when store() is called', function () { const uuid = 'c488b101-af3e-4a99-b538-00423e5a3371'; const callback = fakeServerCall( { vastUrl: 'my-mock-url.com' }, @@ -71,7 +73,7 @@ describe('The video cache', () => { callback.firstCall.args[1].should.deep.equal([{ uuid: uuid }]); }); - it('should execute the callback with an error if the cache server response has no responses property', () => { + it('should execute the callback with an error if the cache server response has no responses property', function () { const callback = fakeServerCall( { vastUrl: 'my-mock-url.com' }, '{"broken":[{"uuid":"c488b101-af3e-4a99-b538-00423e5a3371"}]}'); @@ -79,7 +81,7 @@ describe('The video cache', () => { callback.firstCall.args[1].should.deep.equal([]); }); - it('should execute the callback with an error if the cache server responds with malformed JSON', () => { + it('should execute the callback with an error if the cache server responds with malformed JSON', function () { const callback = fakeServerCall( { vastUrl: 'my-mock-url.com' }, 'Not JSON here'); @@ -87,7 +89,7 @@ describe('The video cache', () => { callback.firstCall.args[1].should.deep.equal([]); }); - it('should make the expected request when store() is called on an ad with a vastUrl', () => { + it('should make the expected request when store() is called on an ad with a vastUrl', function () { const expectedValue = ` @@ -101,7 +103,7 @@ describe('The video cache', () => { assertRequestMade({ vastUrl: 'my-mock-url.com' }, expectedValue) }); - it('should make the expected request when store() is called on an ad with a vastUrl and a vastImpUrl', () => { + it('should make the expected request when store() is called on an ad with a vastUrl and a vastImpUrl', function () { const expectedValue = ` @@ -115,7 +117,7 @@ describe('The video cache', () => { assertRequestMade({ vastUrl: 'my-mock-url.com', vastImpUrl: 'imptracker.com' }, expectedValue) }); - it('should make the expected request when store() is called on an ad with vastXml', () => { + it('should make the expected request when store() is called on an ad with vastXml', function () { const vastXml = ''; assertRequestMade({ vastXml: vastXml }, vastXml); }); @@ -150,8 +152,8 @@ describe('The video cache', () => { }); }); -describe('The getCache function', () => { - beforeEach(() => { +describe('The getCache function', function () { + beforeEach(function () { config.setConfig({ cache: { url: 'https://prebid.adnxs.com/pbc/v1/cache' @@ -159,11 +161,11 @@ describe('The getCache function', () => { }) }); - afterEach(() => { + afterEach(function () { config.resetConfig(); }); - it('should return the expected URL', () => { + it('should return the expected URL', function () { const uuid = 'c488b101-af3e-4a99-b538-00423e5a3371'; const url = getCacheUrl(uuid); url.should.equal(`https://prebid.adnxs.com/pbc/v1/cache?uuid=${uuid}`); diff --git a/test/spec/video_spec.js b/test/spec/video_spec.js index 06cd653f444..3d6ed04ffae 100644 --- a/test/spec/video_spec.js +++ b/test/spec/video_spec.js @@ -1,7 +1,7 @@ import { isValidVideoBid } from 'src/video'; -describe('video.js', () => { - it('validates valid instream bids', () => { +describe('video.js', function () { + it('validates valid instream bids', function () { const bid = { adId: '123abc', vastUrl: 'http://www.example.com/vastUrl' @@ -19,7 +19,7 @@ describe('video.js', () => { expect(valid).to.equal(true); }); - it('catches invalid instream bids', () => { + it('catches invalid instream bids', function () { const bid = { adId: '123abc' }; @@ -36,7 +36,7 @@ describe('video.js', () => { expect(valid).to.equal(false); }); - it('catches invalid bids when prebid-cache is disabled', () => { + it('catches invalid bids when prebid-cache is disabled', function () { const bidRequests = [{ bids: [{ bidder: 'vastOnlyVideoBidder', @@ -49,7 +49,7 @@ describe('video.js', () => { expect(valid).to.equal(false); }); - it('validates valid outstream bids', () => { + it('validates valid outstream bids', function () { const bid = { adId: '123abc', renderer: { @@ -70,7 +70,7 @@ describe('video.js', () => { expect(valid).to.equal(true); }); - it('catches invalid outstream bids', () => { + it('catches invalid outstream bids', function () { const bid = { adId: '123abc' }; From 890315bfa9a463ab52867e580d2fabc5261ff625 Mon Sep 17 00:00:00 2001 From: rachelrj Date: Fri, 31 Aug 2018 10:32:54 -0600 Subject: [PATCH 59/83] Sovrn add user sync (#3029) --- modules/sovrnBidAdapter.js | 22 +++++++- test/spec/modules/sovrnBidAdapter_spec.js | 62 +++++++++++++++++++++++ 2 files changed, 82 insertions(+), 2 deletions(-) diff --git a/modules/sovrnBidAdapter.js b/modules/sovrnBidAdapter.js index 337f2ec2d00..4f1eb298794 100644 --- a/modules/sovrnBidAdapter.js +++ b/modules/sovrnBidAdapter.js @@ -55,7 +55,7 @@ export const spec = { } let url = `//ap.lijit.com/rtb/bid?` + - `src=${REPO_AND_VERSION}`; + `src=${REPO_AND_VERSION}`; if (iv) url += `&iv=${iv}`; return { @@ -95,7 +95,25 @@ export const spec = { }); } return sovrnBidResponses; - } + }, + + getUserSyncs: function(syncOptions, serverResponses, gdprConsent) { + if (serverResponses && serverResponses.length !== 0 && syncOptions.iframeEnabled) { + let iidArr = serverResponses.filter(rsp => rsp.body && rsp.body.ext && rsp.body.ext.iid) + .map(rsp => { return rsp.body.ext.iid }); + let consentString = ''; + if (gdprConsent && gdprConsent.gdprApplies && typeof gdprConsent.consentString === 'string') { + consentString = gdprConsent.consentString + } + if (iidArr[0]) { + return [{ + type: 'iframe', + url: '//ap.lijit.com/beacon?informer=' + iidArr[0] + '&gdpr_consent=' + consentString, + }]; + } + } + return []; + }, }; registerBidder(spec); diff --git a/test/spec/modules/sovrnBidAdapter_spec.js b/test/spec/modules/sovrnBidAdapter_spec.js index 0f1c0d43396..22c93505ecf 100644 --- a/test/spec/modules/sovrnBidAdapter_spec.js +++ b/test/spec/modules/sovrnBidAdapter_spec.js @@ -221,4 +221,66 @@ describe('sovrnBidAdapter', function() { expect(result.length).to.equal(0); }); }); + + describe('getUserSyncs ', () => { + let syncOptions = {iframeEnabled: true, pixelEnabled: true}; + let iframeDisabledSyncOptions = {iframeEnabled: false, pixelEnabled: true}; + let serverResponse = [ + { + 'body': { + 'id': '546956d68c757f', + 'seatbid': [ + { + 'bid': [ + { + 'id': 'a_448326_16c2ada014224bee815a90d2248322f5', + 'impid': '2a3826aae345f4', + 'price': 1.0099999904632568, + 'nurl': 'http://localhost/rtb/impression?bannerid=220958&campaignid=3890&rtb_tid=15588614-75d2-40ab-b27e-13d2127b3c2e&rpid=1295&seatid=seat1&zoneid=448326&cb=26900712&tid=a_448326_16c2ada014224bee815a90d2248322f5', + 'adm': 'yo a creative', + 'crid': 'cridprebidrtb', + 'w': 160, + 'h': 600 + }, + { + 'id': 'a_430392_beac4c1515da4576acf6cb9c5340b40c', + 'impid': '3cf96fd26ed4c5', + 'price': 1.0099999904632568, + 'nurl': 'http://localhost/rtb/impression?bannerid=220957&campaignid=3890&rtb_tid=5bc0e68b-3492-448d-a6f9-26fa3fd0b646&rpid=1295&seatid=seat1&zoneid=430392&cb=62735099&tid=a_430392_beac4c1515da4576acf6cb9c5340b40c', + 'adm': 'yo a creative', + 'crid': 'cridprebidrtb', + 'w': 300, + 'h': 250 + }, + ] + } + ], + 'ext': { + 'iid': 13487408 + } + }, + 'headers': {} + } + ]; + it('should return if iid present on server response & iframe syncs enabled', () => { + let expectedReturnStatement = [ + { + 'type': 'iframe', + 'url': '//ap.lijit.com/beacon?informer=13487408&gdpr_consent=', + } + ]; + let returnStatement = spec.getUserSyncs(syncOptions, serverResponse); + expect(returnStatement[0]).to.deep.equal(expectedReturnStatement[0]); + }); + + it('should not return if iid missing on server response', () => { + let returnStatement = spec.getUserSyncs(syncOptions, []); + expect(returnStatement).to.be.empty; + }); + + it('should not return if iframe syncs disabled', () => { + let returnStatement = spec.getUserSyncs(iframeDisabledSyncOptions, serverResponse); + expect(returnStatement).to.be.empty; + }); + }); }); From edc9d436542116c11dbab04fd4334d02a1a7aef1 Mon Sep 17 00:00:00 2001 From: Eric <41298164+ericyld@users.noreply.github.com> Date: Tue, 4 Sep 2018 21:19:04 +0300 Subject: [PATCH 60/83] YieldNexus Bid Adapter v1 (#2855) * YieldNexus Bid Adapter v1 * Apply code-review changes requested by @jsneker Removed redundant decration of 'onTik which does nothing. Import banner & video constants instead of hard-coding them. Remove usage of "config.getConfig('pageurl')". Also updated the "spid" to 1249. * Remove unused 'config' import * Update demo account IDs for both banner & video * Add video renderer support * Fix unit test checking url * Fix code linting errors * Add missing import statement --- modules/yieldNexusBidAdapter.js | 193 +++++++++++ modules/yieldNexusBidAdapter.md | 53 +++ .../spec/modules/yieldNexusBidAdapter_spec.js | 310 ++++++++++++++++++ 3 files changed, 556 insertions(+) create mode 100644 modules/yieldNexusBidAdapter.js create mode 100644 modules/yieldNexusBidAdapter.md create mode 100644 test/spec/modules/yieldNexusBidAdapter_spec.js diff --git a/modules/yieldNexusBidAdapter.js b/modules/yieldNexusBidAdapter.js new file mode 100644 index 00000000000..975f335b9a7 --- /dev/null +++ b/modules/yieldNexusBidAdapter.js @@ -0,0 +1,193 @@ +import * as utils from 'src/utils'; +import { registerBidder } from 'src/adapters/bidderFactory'; +import { BANNER, VIDEO } from 'src/mediaTypes'; +import { Renderer } from 'src/Renderer'; + +const pixKey = 'utrk'; + +function startsWith(str, search) { + return str.substr(0, search.length) === search; +} + +export const spec = { + code: 'yieldnexus', + aliases: [], + supportedMediaTypes: [BANNER, VIDEO], + + isBidRequestValid: function(bid) { + if (!bid.params.spid) { + return false; + } else if (typeof bid.params.spid !== 'string') { + return false; + } + return (typeof bid.params.instl === 'undefined' || bid.params.instl === 0 || bid.params.instl === 1) && + (typeof bid.params.bidfloor === 'undefined' || typeof bid.params.bidfloor === 'number') && + (typeof bid.params['protocols'] === 'undefined' || Array.isArray(bid.params['protocols'])) && + (typeof bid.params['adpos'] === 'undefined' || typeof bid.params['adpos'] === 'number'); + }, + + buildRequests: function(validBidRequests, bidderRequest) { + return validBidRequests.map(bidRequest => { + let referrer = ''; + try { + referrer = window.top.document.referrer; + } catch (e) { + try { + referrer = window.document.referrer; + } catch (e) { + } + } + const url = utils.getTopWindowUrl(); + const domainStart = url.indexOf('://') + 3; + const req = { + id: bidRequest.auctionId, + site: { + domain: url.substring(domainStart, url.indexOf('/', domainStart) < 0 ? url.length : url.indexOf('/', domainStart)), + page: url, + ref: referrer + }, + device: { + ua: navigator.userAgent + }, + imp: [], + ext: {} + }; + if (bidderRequest && bidderRequest.gdprConsent) { + req.ext.gdpr_consent = { + consent_string: bidderRequest.gdprConsent.consentString, + consent_required: bidderRequest.gdprConsent.gdprApplies + }; + } + let topFrame; + try { + topFrame = window.top === window ? 1 : 0; + } catch (e) { + topFrame = 0; + } + const imp = { + id: bidRequest.transactionId, + instl: bidRequest.params.instl === 1 ? 1 : 0, + tagid: bidRequest.adUnitCode, + bidfloor: bidRequest.params.bidfloor || 0, + bidfloorcur: 'USD', + secure: startsWith(utils.getTopWindowUrl().toLowerCase(), 'http://') ? 0 : 1 + }; + if (!bidRequest.mediaTypes || bidRequest.mediaTypes.banner) { + imp.banner = { + w: bidRequest.sizes.length ? bidRequest.sizes[0][0] : 300, + h: bidRequest.sizes.length ? bidRequest.sizes[0][1] : 250, + pos: bidRequest.params.pos || 0, + topframe: topFrame + }; + } else if (bidRequest.mediaTypes.video) { + imp.video = { + w: bidRequest.sizes.length ? bidRequest.sizes[0][0] : 300, + h: bidRequest.sizes.length ? bidRequest.sizes[0][1] : 250, + protocols: bidRequest.params.protocols || [1, 2, 3, 4, 5, 6], + pos: bidRequest.params.pos || 0, + topframe: topFrame + }; + } else { + return; + } + req.imp.push(imp); + return { + method: 'POST', + url: `https://ssp.ynxs.io/r/${bidRequest.params.spid}/bidr?bidder=prebid&rformat=open_rtb&reqformat=rtb_json` + (bidRequest.params.query ? '&' + bidRequest.params.query : ''), + data: req, + bidRequest + }; + }); + }, + + interpretResponse: function(serverResponse, bidRequest) { + const outBids = []; + if (serverResponse && serverResponse.body) { + const bids = serverResponse.body.seatbid.reduce((acc, seatBid) => acc.concat(seatBid.bid), []); + bids.forEach(bid => { + const outBid = { + requestId: bidRequest.bidRequest.bidId, + cpm: bid.price, + width: bid.w, + height: bid.h, + ttl: 15 * 60, + creativeId: bid.crid, + netRevenue: true, + currency: bid.cur || serverResponse.body.cur + }; + if (!bidRequest.bidRequest.mediaTypes || bidRequest.bidRequest.mediaTypes.banner) { + outBids.push(Object.assign({}, outBid, { mediaType: 'banner', ad: bid.adm })); + } else if (bidRequest.bidRequest.mediaTypes.video) { + const context = utils.deepAccess(bidRequest.bidRequest, 'mediaTypes.video.context'); + outBids.push(Object.assign({}, outBid, { + mediaType: 'video', + vastUrl: bid.ext.vast_url, + vastXml: bid.adm, + renderer: context === 'outstream' ? newRenderer(bidRequest.bidRequest, bid) : undefined + })); + } + }); + } + return outBids; + }, + + getUserSyncs: function(syncOptions, serverResponses, gdprConsent) { + const syncs = []; + const gdprApplies = gdprConsent && (typeof gdprConsent.gdprApplies === 'boolean') ? gdprConsent.gdprApplies : false; + const suffix = gdprApplies ? 'gc=' + encodeURIComponent(gdprConsent.consentString) : 'gc=missing'; + serverResponses.forEach(resp => { + if (resp.body) { + const bidResponse = resp.body; + if (bidResponse.ext && Array.isArray(bidResponse.ext[pixKey])) { + bidResponse.ext[pixKey].forEach(pixel => syncs.push({ type: pixel.type, url: pixel.url + (pixel.url.indexOf('?') > 0 ? '&' + suffix : '?' + suffix) })); + } + if (Array.isArray(bidResponse.seatbid)) { + bidResponse.seatbid.forEach(seatBid => { + if (Array.isArray(seatBid.bid)) { + seatBid.bid.forEach(bid => { + if (bid.ext && Array.isArray(bid.ext[pixKey])) { + bid.ext[pixKey].forEach(pixel => syncs.push({ type: pixel.type, url: pixel.url + (pixel.url.indexOf('?') > 0 ? '&' + suffix : '?' + suffix) })); + } + }); + } + }); + } + } + }); + return syncs; + } +}; + +function newRenderer(bidRequest, bid, rendererOptions = {}) { + let rendererUrl = '//s.gambid.io/video/latest/renderer.js'; + if (bid.ext && bid.ext.renderer_url) { + rendererUrl = bid.ext.renderer_url; + } + if (bidRequest.params && bidRequest.params.rendererUrl) { + rendererUrl = bidRequest.params.rendererUrl; + } + const renderer = Renderer.install({ url: rendererUrl, config: rendererOptions, loaded: false }); + renderer.setRender(renderOutstream); + return renderer; +} + +function renderOutstream(bid) { + bid.renderer.push(() => { + window[ 'GambidPlayer' ].renderAd({ + id: bid.adUnitCode + '/' + bid.adId, + debug: window.location.href.indexOf('pbjsDebug') >= 0, + placement: document.getElementById(bid.adUnitCode), + width: bid.width, + height: bid.height, + events: { + ALL_ADS_COMPLETED: () => window.setTimeout(() => { + window[ 'GambidPlayer' ].removeAd(bid.adUnitCode + '/' + bid.adId); + }, 300) + }, + vastUrl: bid.vastUrl, + vastXml: bid.vastXml + }); + }); +} + +registerBidder(spec); diff --git a/modules/yieldNexusBidAdapter.md b/modules/yieldNexusBidAdapter.md new file mode 100644 index 00000000000..675e8948a3e --- /dev/null +++ b/modules/yieldNexusBidAdapter.md @@ -0,0 +1,53 @@ +# Overview + +``` +Module Name: YieldNexus Bid Adapter +Module Type: Bidder Adapter +Maintainer: rtbops@yieldnexus.com +``` + +# Description + +Adds support to query the YieldNexus platform for bids. The YieldNexus platform supports banners & video. + +Only one parameter is required: `spid`, which provides your YieldNexus account number. + +# Test Parameters +``` +var adUnits = [ + // Banner: + { + code: 'banner-ad-unit', + sizes: [[300, 250]], + bids: [{ + bidder: 'yieldnexus', + params: { + spid: '1253', // your supply ID in your YieldNexus dashboard + bidfloor: 0.03, // an optional custom bid floor + adpos: 1, // ad position on the page (optional) + instl: 0 // interstitial placement? (0 or 1, optional) + } + }] + }, + // Outstream video: + { + code: 'video-ad-unit', + sizes: [[640, 480]], + mediaTypes: { + video: { + context: 'outstream', + playerSize: [640, 480] + } + }, + bids: [ { + bidder: 'yieldnexus', + params: { + spid: '1254', // your supply ID in your YieldNexus dashboard + bidfloor: 0.03, // an optional custom bid floor + adpos: 1, // ad position on the page (optional) + instl: 0 // interstitial placement? (0 or 1, optional) + } + }] + } +]; +``` diff --git a/test/spec/modules/yieldNexusBidAdapter_spec.js b/test/spec/modules/yieldNexusBidAdapter_spec.js new file mode 100644 index 00000000000..b966d890e7a --- /dev/null +++ b/test/spec/modules/yieldNexusBidAdapter_spec.js @@ -0,0 +1,310 @@ +import { expect } from 'chai'; +import { spec } from 'modules/yieldNexusBidAdapter'; +import * as utils from 'src/utils'; + +const spid = '123'; + +describe('YieldNexusAdapter', () => { + describe('isBidRequestValid', () => { + it('should validate supply', () => { + expect(spec.isBidRequestValid({ params: {} })).to.equal(false); + expect(spec.isBidRequestValid({ params: { spid: 123 } })).to.equal(false); + expect(spec.isBidRequestValid({ params: { spid: '123' } })).to.equal(true); + }); + it('should validate bid floor', () => { + expect(spec.isBidRequestValid({ params: { spid: '123' } })).to.equal(true); // bidfloor has a default + expect(spec.isBidRequestValid({ params: { spid: '123', bidfloor: '123' } })).to.equal(false); + expect(spec.isBidRequestValid({ params: { spid: '123', bidfloor: 0.1 } })).to.equal(true); + }); + it('should validate adpos', () => { + expect(spec.isBidRequestValid({ params: { spid: '123' } })).to.equal(true); // adpos has a default + expect(spec.isBidRequestValid({ params: { spid: '123', adpos: '123' } })).to.equal(false); + expect(spec.isBidRequestValid({ params: { spid: '123', adpos: 0.1 } })).to.equal(true); + }); + it('should validate instl', () => { + expect(spec.isBidRequestValid({ params: { spid: '123' } })).to.equal(true); // adpos has a default + expect(spec.isBidRequestValid({ params: { spid: '123', instl: '123' } })).to.equal(false); + expect(spec.isBidRequestValid({ params: { spid: '123', instl: -1 } })).to.equal(false); + expect(spec.isBidRequestValid({ params: { spid: '123', instl: 0 } })).to.equal(true); + expect(spec.isBidRequestValid({ params: { spid: '123', instl: 1 } })).to.equal(true); + expect(spec.isBidRequestValid({ params: { spid: '123', instl: 2 } })).to.equal(false); + }); + }); + describe('buildRequests', () => { + const bidRequest = { + 'adUnitCode': 'adunit-code', + 'auctionId': 'fdkhjg3s7ahjja', + 'mediaTypes': { + banner: {} + }, + 'params': { spid }, + 'sizes': [ [ 300, 250 ], [ 300, 600 ] ] + }; + + it('returns an array', () => { + let response; + + response = spec.buildRequests([]); + expect(Array.isArray(response)).to.equal(true); + expect(response.length).to.equal(0); + + response = spec.buildRequests([ bidRequest ]); + expect(Array.isArray(response)).to.equal(true); + expect(response.length).to.equal(1); + + const adUnit1 = Object.assign({}, utils.deepClone(bidRequest), { auctionId: '1', adUnitCode: 'a' }); + const adUnit2 = Object.assign({}, utils.deepClone(bidRequest), { auctionId: '1', adUnitCode: 'b' }); + response = spec.buildRequests([adUnit1, adUnit2]); + expect(Array.isArray(response)).to.equal(true); + expect(response.length).to.equal(2); + }); + + it('uses yieldnexus dns', () => { + const response = spec.buildRequests([ bidRequest ])[ 0 ]; + expect(response.method).to.equal('POST'); + expect(response.url).to.match(new RegExp(`^https://ssp\\.ynxs\\.io/r/${spid}/bidr\\?bidder=prebid&rformat=open_rtb&reqformat=rtb_json$`, 'g')); + expect(response.data.id).to.equal(bidRequest.auctionId); + }); + + it('builds request correctly', () => { + let stub = sinon.stub(utils, 'getTopWindowUrl').returns('http://www.test.com/page.html'); + + let response; + response = spec.buildRequests([ bidRequest ])[ 0 ]; + expect(response.data.site.domain).to.equal('www.test.com'); + expect(response.data.site.page).to.equal('http://www.test.com/page.html'); + expect(response.data.site.ref).to.equal(''); + expect(response.data.imp.length).to.equal(1); + expect(response.data.imp[ 0 ].id).to.equal(bidRequest.transactionId); + expect(response.data.imp[ 0 ].instl).to.equal(0); + expect(response.data.imp[ 0 ].tagid).to.equal(bidRequest.adUnitCode); + expect(response.data.imp[ 0 ].bidfloor).to.equal(0); + expect(response.data.imp[ 0 ].bidfloorcur).to.equal('USD'); + + const bidRequestWithInstlEquals1 = utils.deepClone(bidRequest); + bidRequestWithInstlEquals1.params.instl = 1; + response = spec.buildRequests([ bidRequestWithInstlEquals1 ])[ 0 ]; + expect(response.data.imp[ 0 ].instl).to.equal(bidRequestWithInstlEquals1.params.instl); + + const bidRequestWithInstlEquals0 = utils.deepClone(bidRequest); + bidRequestWithInstlEquals0.params.instl = 1; + response = spec.buildRequests([ bidRequestWithInstlEquals0 ])[ 0 ]; + expect(response.data.imp[ 0 ].instl).to.equal(bidRequestWithInstlEquals0.params.instl); + + const bidRequestWithBidfloorEquals1 = utils.deepClone(bidRequest); + bidRequestWithBidfloorEquals1.params.bidfloor = 1; + response = spec.buildRequests([ bidRequestWithBidfloorEquals1 ])[ 0 ]; + expect(response.data.imp[ 0 ].bidfloor).to.equal(bidRequestWithBidfloorEquals1.params.bidfloor); + + stub.restore(); + }); + + it('builds request banner object correctly', () => { + let response; + + const bidRequestWithBanner = utils.deepClone(bidRequest); + bidRequestWithBanner.mediaTypes = { + banner: { + sizes: [ [ 300, 250 ], [ 120, 600 ] ] + } + }; + + response = spec.buildRequests([ bidRequestWithBanner ])[ 0 ]; + expect(response.data.imp[ 0 ].banner.w).to.equal(bidRequestWithBanner.mediaTypes.banner.sizes[ 0 ][ 0 ]); + expect(response.data.imp[ 0 ].banner.h).to.equal(bidRequestWithBanner.mediaTypes.banner.sizes[ 0 ][ 1 ]); + expect(response.data.imp[ 0 ].banner.pos).to.equal(0); + expect(response.data.imp[ 0 ].banner.topframe).to.equal(0); + + const bidRequestWithPosEquals1 = utils.deepClone(bidRequestWithBanner); + bidRequestWithPosEquals1.params.pos = 1; + response = spec.buildRequests([ bidRequestWithPosEquals1 ])[ 0 ]; + expect(response.data.imp[ 0 ].banner.pos).to.equal(bidRequestWithPosEquals1.params.pos); + }); + + it('builds request video object correctly', () => { + let response; + + const bidRequestWithVideo = utils.deepClone(bidRequest); + bidRequestWithVideo.mediaTypes = { + video: { + sizes: [ [ 300, 250 ], [ 120, 600 ] ] + } + }; + + response = spec.buildRequests([ bidRequestWithVideo ])[ 0 ]; + expect(response.data.imp[ 0 ].video.w).to.equal(bidRequestWithVideo.mediaTypes.video.sizes[ 0 ][ 0 ]); + expect(response.data.imp[ 0 ].video.h).to.equal(bidRequestWithVideo.mediaTypes.video.sizes[ 0 ][ 1 ]); + expect(response.data.imp[ 0 ].video.pos).to.equal(0); + expect(response.data.imp[ 0 ].video.topframe).to.equal(0); + + const bidRequestWithPosEquals1 = utils.deepClone(bidRequestWithVideo); + bidRequestWithPosEquals1.params.pos = 1; + response = spec.buildRequests([ bidRequestWithPosEquals1 ])[ 0 ]; + expect(response.data.imp[ 0 ].video.pos).to.equal(bidRequestWithPosEquals1.params.pos); + }); + }); + describe('interpretResponse', () => { + const bannerBidRequest = { + 'adUnitCode': 'adunit-code', + 'auctionId': 'fdkhjg3s7ahjja', + 'mediaTypes': { + banner: {} + }, + 'params': { + 'spid': spid + }, + 'sizes': [ [ 300, 250 ], [ 300, 600 ] ], + 'bidId': '111' + }; + const videoBidRequest = { + 'adUnitCode': 'adunit-code', + 'auctionId': 'fdkhjg3s7ahjja', + 'mediaTypes': { + video: {} + }, + 'params': { + 'spid': spid + }, + 'sizes': [ [ 300, 250 ], [ 300, 600 ] ], + 'bidId': '111' + }; + const rtbResponse = { + 'id': 'imp_5b05b9fde4b09084267a556f', + 'bidid': 'imp_5b05b9fde4b09084267a556f', + 'cur': 'USD', + 'ext': { + 'utrk': [ + { 'type': 'iframe', 'url': '//ssp.ynxs.io/user/sync/1' }, + { 'type': 'image', 'url': '//ssp.ynxs.io/user/sync/2' } + ] + }, + 'seatbid': [ + { + 'seat': 'testSeatBidA', + 'bid': [ + { + 'id': '0', + 'impid': '1', + 'price': 2.016, + 'adm': '', + 'adomain': [ 'nike.com' ], + 'h': 600, + 'w': 120, + 'ext': { + 'vast_url': 'http://vast.tag.com', + 'utrk': [ + { 'type': 'iframe', 'url': '//pix.usersync.io/user-sync' } + ] + } + } + ] + }, + { + 'seat': 'testSeatBidB', + 'bid': [ + { + 'id': '1', + 'impid': '1', + 'price': 3, + 'adid': '542jlhdfd2112jnjf3x', + 'adm': '', + 'adomain': [ 'adidas.com' ], + 'h': 250, + 'w': 300, + 'ext': { + 'utrk': [ + { 'type': 'image', 'url': '//pix.usersync.io/user-sync' } + ] + } + } + ] + } + ] + }; + it('fails gracefully on empty response body', () => { + let response; + + response = spec.interpretResponse(undefined, { bidRequest: bannerBidRequest }); + expect(Array.isArray(response)).to.equal(true); + expect(response.length).to.equal(0); + + response = spec.interpretResponse({}, { bidRequest: bannerBidRequest }); + expect(Array.isArray(response)).to.equal(true); + expect(response.length).to.equal(0); + }); + it('collects banner bids', () => { + const response = spec.interpretResponse({ body: rtbResponse }, { bidRequest: bannerBidRequest }); + expect(Array.isArray(response)).to.equal(true); + expect(response.length).to.equal(2); + + const ad0 = response[ 0 ], ad1 = response[ 1 ]; + expect(ad0.requestId).to.equal(bannerBidRequest.bidId); + expect(ad0.cpm).to.equal(rtbResponse.seatbid[ 0 ].bid[ 0 ].price); + expect(ad0.width).to.equal(rtbResponse.seatbid[ 0 ].bid[ 0 ].w); + expect(ad0.height).to.equal(rtbResponse.seatbid[ 0 ].bid[ 0 ].h); + expect(ad0.ttl).to.equal(15 * 60); + expect(ad0.creativeId).to.equal(rtbResponse.seatbid[ 0 ].bid[ 0 ].crid); + expect(ad0.netRevenue).to.equal(true); + expect(ad0.currency).to.equal(rtbResponse.seatbid[ 0 ].bid[ 0 ].cur || rtbResponse.cur || 'USD'); + expect(ad0.ad).to.equal(rtbResponse.seatbid[ 0 ].bid[ 0 ].adm); + expect(ad0.vastXml).to.be.an('undefined'); + + expect(ad1.requestId).to.equal(bannerBidRequest.bidId); + expect(ad1.cpm).to.equal(rtbResponse.seatbid[ 1 ].bid[ 0 ].price); + expect(ad1.width).to.equal(rtbResponse.seatbid[ 1 ].bid[ 0 ].w); + expect(ad1.height).to.equal(rtbResponse.seatbid[ 1 ].bid[ 0 ].h); + expect(ad1.ttl).to.equal(15 * 60); + expect(ad1.creativeId).to.equal(rtbResponse.seatbid[ 1 ].bid[ 0 ].crid); + expect(ad1.netRevenue).to.equal(true); + expect(ad1.currency).to.equal(rtbResponse.seatbid[ 1 ].bid[ 0 ].cur || rtbResponse.cur || 'USD'); + expect(ad1.ad).to.equal(rtbResponse.seatbid[ 1 ].bid[ 0 ].adm); + expect(ad1.vastXml).to.be.an('undefined'); + + // expect(ad1.ad).to.be.an('undefined'); + // expect(ad1.vastXml).to.equal(rtbResponse.seatbid[ 1 ].bid[ 0 ].adm); + }); + it('collects video bids', () => { + const response = spec.interpretResponse({ body: rtbResponse }, { bidRequest: videoBidRequest }); + expect(Array.isArray(response)).to.equal(true); + expect(response.length).to.equal(2); + + const ad0 = response[ 0 ], ad1 = response[ 1 ]; + expect(ad0.requestId).to.equal(videoBidRequest.bidId); + expect(ad0.cpm).to.equal(rtbResponse.seatbid[ 0 ].bid[ 0 ].price); + expect(ad0.width).to.equal(rtbResponse.seatbid[ 0 ].bid[ 0 ].w); + expect(ad0.height).to.equal(rtbResponse.seatbid[ 0 ].bid[ 0 ].h); + expect(ad0.ttl).to.equal(15 * 60); + expect(ad0.creativeId).to.equal(rtbResponse.seatbid[ 0 ].bid[ 0 ].crid); + expect(ad0.netRevenue).to.equal(true); + expect(ad0.currency).to.equal(rtbResponse.seatbid[ 0 ].bid[ 0 ].cur || rtbResponse.cur || 'USD'); + expect(ad0.ad).to.be.an('undefined'); + expect(ad0.vastXml).to.equal(rtbResponse.seatbid[ 0 ].bid[ 0 ].adm); + expect(ad0.vastUrl).to.equal(rtbResponse.seatbid[ 0 ].bid[ 0 ].ext.vast_url); + + expect(ad1.requestId).to.equal(videoBidRequest.bidId); + expect(ad1.cpm).to.equal(rtbResponse.seatbid[ 1 ].bid[ 0 ].price); + expect(ad1.width).to.equal(rtbResponse.seatbid[ 1 ].bid[ 0 ].w); + expect(ad1.height).to.equal(rtbResponse.seatbid[ 1 ].bid[ 0 ].h); + expect(ad1.ttl).to.equal(15 * 60); + expect(ad1.creativeId).to.equal(rtbResponse.seatbid[ 1 ].bid[ 0 ].crid); + expect(ad1.netRevenue).to.equal(true); + expect(ad1.currency).to.equal(rtbResponse.seatbid[ 1 ].bid[ 0 ].cur || rtbResponse.cur || 'USD'); + expect(ad1.ad).to.be.an('undefined'); + expect(ad1.vastXml).to.equal(rtbResponse.seatbid[ 1 ].bid[ 0 ].adm); + expect(ad1.vastUrl).to.equal(rtbResponse.seatbid[ 1 ].bid[ 0 ].ext.vast_url); + }); + it('applies user-syncs', () => { + const response = spec.getUserSyncs({}, [ { body: rtbResponse } ]); + expect(Array.isArray(response)).to.equal(true); + expect(response.length).to.equal(4); + expect(response[ 0 ].type).to.equal(rtbResponse.ext.utrk[ 0 ].type); + expect(response[ 0 ].url).to.equal(rtbResponse.ext.utrk[ 0 ].url + '?gc=missing'); + expect(response[ 1 ].type).to.equal(rtbResponse.ext.utrk[ 1 ].type); + expect(response[ 1 ].url).to.equal(rtbResponse.ext.utrk[ 1 ].url + '?gc=missing'); + expect(response[ 2 ].type).to.equal(rtbResponse.seatbid[ 0 ].bid[ 0 ].ext.utrk[ 0 ].type); + expect(response[ 2 ].url).to.equal(rtbResponse.seatbid[ 0 ].bid[ 0 ].ext.utrk[ 0 ].url + '?gc=missing'); + expect(response[ 3 ].type).to.equal(rtbResponse.seatbid[ 1 ].bid[ 0 ].ext.utrk[ 0 ].type); + expect(response[ 3 ].url).to.equal(rtbResponse.seatbid[ 1 ].bid[ 0 ].ext.utrk[ 0 ].url + '?gc=missing'); + }); + }); +}); From ce3fe7dbc1dda8392eebacb861f230dad6798d15 Mon Sep 17 00:00:00 2001 From: Nick Le Mouton Date: Wed, 5 Sep 2018 07:17:59 +1200 Subject: [PATCH 61/83] Fix utils problem with convertTypes (#3033) --- modules/pulsepointBidAdapter.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/pulsepointBidAdapter.js b/modules/pulsepointBidAdapter.js index 7a05253e339..1a1abfb2fdd 100644 --- a/modules/pulsepointBidAdapter.js +++ b/modules/pulsepointBidAdapter.js @@ -1,5 +1,5 @@ /* eslint dot-notation:0, quote-props:0 */ -import {logError, getTopWindowLocation} from 'src/utils'; +import * as utils from 'src/utils'; import { registerBidder } from 'src/adapters/bidderFactory'; const NATIVE_DEFAULTS = { @@ -237,7 +237,7 @@ function site(bidderRequest) { id: pubId.toString(), }, ref: referrer(), - page: getTopWindowLocation().href, + page: utils.getTopWindowLocation().href, } } return null; @@ -293,7 +293,7 @@ function parse(rawResponse) { return JSON.parse(rawResponse); } } catch (ex) { - logError('pulsepointLite.safeParse', 'ERROR', ex); + utils.logError('pulsepointLite.safeParse', 'ERROR', ex); } return null; } From ba5ea0a7dc23492bf1f203e4bc71335989ea1ffc Mon Sep 17 00:00:00 2001 From: dkharton Date: Tue, 4 Sep 2018 12:24:57 -0700 Subject: [PATCH 62/83] Explicitly set ajax() XHR to asynchronous. (#3038) --- src/ajax.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ajax.js b/src/ajax.js index 1916f4ea080..d8b0712594d 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -66,7 +66,7 @@ export function ajaxBuilder(timeout = 3000, {request, done} = {}) { url = formatURL(urlInfo); } - x.open(method, url); + x.open(method, url, true); // IE needs timoeut to be set after open - see #1410 // Disabled timeout temporarily to avoid xhr failed requests. https://github.com/prebid/Prebid.js/issues/2648 if (!config.getConfig('disableAjaxTimeout')) { From 0bdeb45abfa20e5daaeaa5a51061344d750ba786 Mon Sep 17 00:00:00 2001 From: Steve Alliance Date: Tue, 4 Sep 2018 15:33:48 -0400 Subject: [PATCH 63/83] update user consent object that was send to DMX (#3023) * adding DMX test @97%, two files added one updated * Update districtm_spec.js * Update districtmDMX.js * adding all districtm needed file * remove legacy file * remove typo || 0 in the test method * force default to return a valid width and height * update unit test code for failing test * changed class for an object * remove package-lock.json * change file name for dmx adapter * renamed files * restaure package-lock.json * update to last package-lock state * update gdpr user consent * fix sizes issue * Documentation updates Adding the readme.md info * update file name and update unit testing import file location --- ...idAdapter.js => districtmDMXBidAdapter.js} | 8 +- modules/districtmDmxBidAdapter.md | 102 ++++++++++++++++-- .../modules/districtmDmxBidAdapter_spec.js | 2 +- 3 files changed, 99 insertions(+), 13 deletions(-) rename modules/{districtmDmxBidAdapter.js => districtmDMXBidAdapter.js} (94%) diff --git a/modules/districtmDmxBidAdapter.js b/modules/districtmDMXBidAdapter.js similarity index 94% rename from modules/districtmDmxBidAdapter.js rename to modules/districtmDMXBidAdapter.js index 3ec0b72649e..51ceedfc470 100644 --- a/modules/districtmDmxBidAdapter.js +++ b/modules/districtmDMXBidAdapter.js @@ -76,9 +76,9 @@ export const spec = { dmxRequest.regs = {}; dmxRequest.regs.ext = {}; dmxRequest.regs.ext.gdpr = bidderRequest.gdprConsent.gdprApplies === true ? 1 : 0; - if (dmxRequest.regs.ext.gdpr) { - dmxRequest.regs.ext.consent = bidderRequest.gdprConsent.consentString; - } + dmxRequest.user = {}; + dmxRequest.user.ext = {}; + dmxRequest.user.ext.consent = bidderRequest.gdprConsent.consentString; } let tosendtags = bidRequest.map(dmx => { var obj = {}; @@ -91,7 +91,7 @@ export const spec = { h: dmx.sizes[0][1] || 0, format: dmx.sizes.map(s => { return {w: s[0], h: s[1]}; - }) + }).filter(obj => typeof obj.w === 'number' && typeof obj.h === 'number') }; return obj; }); diff --git a/modules/districtmDmxBidAdapter.md b/modules/districtmDmxBidAdapter.md index a096029963c..2859bcfa19d 100644 --- a/modules/districtmDmxBidAdapter.md +++ b/modules/districtmDmxBidAdapter.md @@ -1,23 +1,105 @@ +``` +Module Name: district m Bid Adapter +Module Type: Bidder Adapter +Maintainer: Steve Alliance (steve@districtm.net) +``` + # Overview +The `districtmDmxAdapter` module allows publishers to include DMX Exchange demand using Prebid 1.0+. + +## Attributes + +* Single Request +* Multi-Size Support +* GDPR Compliant +* Bids returned in **NET** + + ## Media Types + +* Banner + +## Bidder Parameters + +| Key | Scope | Type | Description +| --- | --- | --- | --- +| dmxid | Mandatory | Integer | Unique identifier of the placement, dmxid can be obtained in the district m Boost platform. +| memberid | Mandatory | Integer | Unique identifier for your account, memberid can be obtained in the district m Boost platform. + +# Ad Unit Configuration Example + +```javascript + var adUnits = [{ + code: 'div-gpt-ad-1460505748561-0', + mediaTypes: { + banner: { + sizes: [[300, 250], [300,600]], + } + }, + bids: [{ + bidder: 'districtmDMX', + params: { + dmxid: 100001, + memberid: 100003 + } + }] + }]; +``` + + +# Quick Start Guide + +###### 1. Including the `districtmDmxAdapter` in your build process. + +Add the adapter as an argument to gulp build. + +``` +gulp build --modules=districtmDmxAdapter,ixBidAdapter,appnexusBidAdapter +``` + +*Adding `"districtmDmxAdapter"` as an entry in a JSON file with your bidders is also acceptable.* + +``` +[ + "districtmDmxAdapter", + "ixBidAdapter", + "appnexusBidAdapter" +] +``` + +*Proceed to build with the JSON file.* + ``` -Module Name: DistrictM Bid Adapter -Module Type: Bidder Adapter -Maintainer: steve@districtm.net +gulp build --modules=bidderModules.json ``` -# Description +###### 2. Configure the ad unit object -Adapter that connects to DistrictM's demand sources. -This version only support banner +Once Prebid is ready you may use the below example to create the adUnits object and begin building the configuration. -# Test Parameters +```javascript +var adUnits = [{ + code: 'div-gpt-ad-1460505748561-0', + mediaTypes: { + banner: { + sizes: [[300, 250], [300, 600], [728, 90]], + } + }, + bids: [] + } +]; ``` + +###### 3. Add the bidder + +Our demand and adapter supports multiple sizes per placement, as such a single dmxid may be used for all sizes of a single domain. + +```javascript var adUnits = [{ code: 'div-gpt-ad-1460505748561-0', mediaTypes: { banner: { - sizes: [[300, 250], [300,600]], + sizes: [[300, 250], [300, 600], [728, 90]], } }, bids: [{ @@ -29,3 +111,7 @@ This version only support banner }] }]; ``` + +###### 4. Implementation Checking + +Once the bidder is live in your Prebid configuration you may confirm it is making requests to our end point by looking for requests to `https://dmx.districtm.io/b/v1`. diff --git a/test/spec/modules/districtmDmxBidAdapter_spec.js b/test/spec/modules/districtmDmxBidAdapter_spec.js index a0bd76f9591..64f76eb026d 100644 --- a/test/spec/modules/districtmDmxBidAdapter_spec.js +++ b/test/spec/modules/districtmDmxBidAdapter_spec.js @@ -1,6 +1,6 @@ import {expect} from 'chai'; import * as _ from 'lodash'; -import {spec, matchRequest, checkDeepArray, defaultSize} from '../../../modules/districtmDmxBidAdapter'; +import {spec, matchRequest, checkDeepArray, defaultSize} from '../../../modules/districtmDMXBidAdapter'; const bidRequest = [{ 'bidder': 'districtmDMX', From 25d214a0e6ee1ea2141f8a6dc93c443b72f84e3d Mon Sep 17 00:00:00 2001 From: Jason Snellbaker Date: Tue, 4 Sep 2018 15:41:01 -0400 Subject: [PATCH 64/83] Prebid 1.23.0 release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a71e6309103..2449b005f53 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "prebid.js", - "version": "1.23.0-pre", + "version": "1.23.0", "description": "Header Bidding Management Library", "main": "src/prebid.js", "scripts": { From 794509892e30a53b50aee32e474554caa7740ad4 Mon Sep 17 00:00:00 2001 From: Jason Snellbaker Date: Tue, 4 Sep 2018 15:48:24 -0400 Subject: [PATCH 65/83] increment pre version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2449b005f53..77181edc6a5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "prebid.js", - "version": "1.23.0", + "version": "1.24.0-pre", "description": "Header Bidding Management Library", "main": "src/prebid.js", "scripts": { From ac207c582416a3517c6cfe1abaa589bf986fc3a8 Mon Sep 17 00:00:00 2001 From: jsnellbaker <31102355+jsnellbaker@users.noreply.github.com> Date: Wed, 5 Sep 2018 12:10:49 -0400 Subject: [PATCH 66/83] upgrade to gulp 4 (#2930) * upgrade to gulp 4 * update circleci config * removed some tasks and added notest flag * update lint dependency for test task --- .circleci/config.yml | 2 +- README.md | 2 + gulpfile.js | 318 +++++----- package-lock.json | 1405 ++++++++++++++++++++++++------------------ package.json | 4 +- 5 files changed, 1001 insertions(+), 730 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 62c23390666..fbf7e77e10f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -33,7 +33,7 @@ jobs: - node_modules key: v1-dependencies-{{ checksum "package.json" }} - - run: sudo npm install -g gulp + - run: sudo npm install -g gulp-cli # Download and run BrowserStack local - run: name : Download BrowserStack Local binary and start it. diff --git a/README.md b/README.md index e43833fd4d2..137374ebaa7 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,8 @@ Working examples can be found in [the developer docs](http://prebid.org/dev-docs $ npm install *Note:* You need to have `NodeJS` 4.x or greater installed. +*Note:* Because we have transitioned to using gulp 4.0 - you need to have `gulp-cli` installed globally prior to running the general `npm install`. Run the following command to perform the install: `npm install gulp-cli -g` +If you have a previous version of `gulp` installed globally, you'll need to remove it before installing `gulp-cli`. This removal can be done with the command: `npm rm gulp -g`
diff --git a/gulpfile.js b/gulpfile.js index 92dd2a7c1f1..b373e6299c6 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -5,18 +5,15 @@ var argv = require('yargs').argv; var gulp = require('gulp'); var gutil = require('gulp-util'); var connect = require('gulp-connect'); -var path = require('path'); var webpack = require('webpack'); var webpackStream = require('webpack-stream'); var uglify = require('gulp-uglify'); -var clean = require('gulp-clean'); +var gulpClean = require('gulp-clean'); var KarmaServer = require('karma').Server; var karmaConfMaker = require('./karma.conf.maker'); var opens = require('open'); var webpackConfig = require('./webpack.conf'); var helpers = require('./gulpHelpers'); -var del = require('del'); -var gulpDocumentation = require('gulp-documentation'); var concat = require('gulp-concat'); var header = require('gulp-header'); var footer = require('gulp-footer'); @@ -36,23 +33,131 @@ var banner = '/* <%= prebid.name %> v<%= prebid.version %>\n' + dateString + ' * var analyticsDirectory = '../analytics'; var port = 9999; -// Tasks -gulp.task('default', ['webpack']); +// these modules must be explicitly listed in --modules to be included in the build, won't be part of "all" modules +var explicitModules = [ + 'pre1api' +]; -gulp.task('serve', ['build-bundle-dev', 'watch', 'test']); +// all the following functions are task functions +function bundleToStdout() { + nodeBundle().then(file => console.log(file)); +} +bundleToStdout.displayName = 'bundle-to-stdout'; -gulp.task('serve-nw', ['lint', 'watch', 'e2etest']); +function clean() { + return gulp.src(['build'], { + read: false, + allowEmpty: true + }) + .pipe(gulpClean()); +} -gulp.task('run-tests', ['lint', 'test-coverage']); +function e2etestReport() { + var reportPort = 9010; + var targetDestinationDir = './e2etest-report'; + helpers.createEnd2EndTestReport(targetDestinationDir); + connect.server({ + port: reportPort, + root: './', + livereload: true + }); -gulp.task('build', ['build-bundle-prod']); + setTimeout(function() { + opens('http://localhost:' + reportPort + '/' + targetDestinationDir.slice(2) + '/results.html'); + }, 5000); +}; +e2etestReport.displayName = 'e2etest-report'; -gulp.task('clean', function () { - return gulp.src(['build'], { - read: false - }) - .pipe(clean()); -}); +// Dependant task for building postbid. It escapes postbid-config file. +function escapePostbidConfig() { + gulp.src('./integrationExamples/postbid/oas/postbid-config.js') + .pipe(jsEscape()) + .pipe(gulp.dest('build/postbid/')); +}; +escapePostbidConfig.displayName = 'escape-postbid-config'; + +function lint() { + return gulp.src(['src/**/*.js', 'modules/**/*.js', 'test/**/*.js']) + .pipe(eslint()) + .pipe(eslint.format('stylish')) + .pipe(eslint.failAfterError()); +}; + +// View the code coverage report in the browser. +function viewCoverage(done) { + var coveragePort = 1999; + + connect.server({ + port: coveragePort, + root: 'build/coverage/karma_html', + livereload: false + }); + opens('http://localhost:' + coveragePort); + done(); +}; +viewCoverage.displayName = 'view-coverage'; + +// Watch Task with Live Reload +function watch(done) { + var mainWatcher = gulp.watch([ + 'src/**/*.js', + 'modules/**/*.js', + 'test/spec/**/*.js', + '!test/spec/loaders/**/*.js' + ]); + var loaderWatcher = gulp.watch([ + 'loaders/**/*.js', + 'test/spec/loaders/**/*.js' + ]); + + connect.server({ + https: argv.https, + port: port, + root: './', + livereload: true + }); + + mainWatcher.on('all', gulp.series(clean, gulp.parallel(lint, 'build-bundle-dev', test))); + loaderWatcher.on('all', gulp.series(lint)); + done(); +}; + +function makeDevpackPkg() { + var cloned = _.cloneDeep(webpackConfig); + cloned.devtool = 'source-map'; + var externalModules = helpers.getArgModules(); + + const analyticsSources = helpers.getAnalyticsSources(analyticsDirectory); + const moduleSources = helpers.getModulePaths(externalModules); + + return gulp.src([].concat(moduleSources, analyticsSources, 'src/prebid.js')) + .pipe(helpers.nameModules(externalModules)) + .pipe(webpackStream(cloned, webpack)) + .pipe(replace('$prebid.version$', prebid.version)) + .pipe(gulp.dest('build/dev')) + .pipe(connect.reload()); +} + +function makeWebpackPkg() { + var cloned = _.cloneDeep(webpackConfig); + + delete cloned.devtool; + + var externalModules = helpers.getArgModules(); + + const analyticsSources = helpers.getAnalyticsSources(analyticsDirectory); + const moduleSources = helpers.getModulePaths(externalModules); + + return gulp.src([].concat(moduleSources, analyticsSources, 'src/prebid.js')) + .pipe(helpers.nameModules(externalModules)) + .pipe(webpackStream(cloned, webpack)) + .pipe(replace('$prebid.version$', prebid.version)) + .pipe(uglify()) + .pipe(gulpif(file => file.basename === 'prebid-core.js', header(banner, { prebid: prebid }))) + .pipe(optimizejs()) + .pipe(gulp.dest('build/dist')) + .pipe(connect.reload()); +} function gulpBundle(dev) { return bundle(dev).pipe(gulp.dest('build/' + (dev ? 'dev' : 'dist'))); @@ -71,14 +176,9 @@ function nodeBundle(modules) { }); } -// these modules must be explicitly listed in --modules to be included in the build, won't be part of "all" modules -var explicitModules = [ - 'pre1api' -]; - function bundle(dev, moduleArr) { - var modules = moduleArr || helpers.getArgModules(), - allModules = helpers.getModuleNames(modules); + var modules = moduleArr || helpers.getArgModules(); + var allModules = helpers.getModuleNames(modules); if (modules.length === 0) { modules = allModules.filter(module => !explicitModules.includes(module)); @@ -125,7 +225,8 @@ function newKarmaCallback(done) { done(new Error('Karma tests failed with exit code ' + exitCode)); } else { if (argv.browserstack) { - process.exit(0); + // process.exit(0); + done(); // test this with travis (or circleci) } else { done(); } @@ -133,51 +234,6 @@ function newKarmaCallback(done) { } } -gulp.task('build-bundle-dev', ['devpack'], gulpBundle.bind(null, true)); -gulp.task('build-bundle-prod', ['webpack'], gulpBundle.bind(null, false)); -gulp.task('bundle', gulpBundle.bind(null, false)); // used for just concatenating pre-built files with no build step - -gulp.task('bundle-to-stdout', function() { - nodeBundle().then(file => console.log(file)); -}); - -gulp.task('devpack', ['clean'], function () { - var cloned = _.cloneDeep(webpackConfig); - cloned.devtool = 'source-map'; - var externalModules = helpers.getArgModules(); - - const analyticsSources = helpers.getAnalyticsSources(analyticsDirectory); - const moduleSources = helpers.getModulePaths(externalModules); - - return gulp.src([].concat(moduleSources, analyticsSources, 'src/prebid.js')) - .pipe(helpers.nameModules(externalModules)) - .pipe(webpackStream(cloned, webpack)) - .pipe(replace('$prebid.version$', prebid.version)) - .pipe(gulp.dest('build/dev')) - .pipe(connect.reload()); -}); - -gulp.task('webpack', ['clean'], function () { - var cloned = _.cloneDeep(webpackConfig); - - delete cloned.devtool; - - var externalModules = helpers.getArgModules(); - - const analyticsSources = helpers.getAnalyticsSources(analyticsDirectory); - const moduleSources = helpers.getModulePaths(externalModules); - - return gulp.src([].concat(moduleSources, analyticsSources, 'src/prebid.js')) - .pipe(helpers.nameModules(externalModules)) - .pipe(webpackStream(cloned, webpack)) - .pipe(replace('$prebid.version$', prebid.version)) - .pipe(uglify()) - .pipe(gulpif(file => file.basename === 'prebid-core.js', header(banner, { prebid: prebid }))) - .pipe(optimizejs()) - .pipe(gulp.dest('build/dist')) - .pipe(connect.reload()); -}); - // Run the unit tests. // // By default, this runs in headless chrome. @@ -186,41 +242,33 @@ gulp.task('webpack', ['clean'], function () { // If --file "" is given, the task will only run tests in the specified file. // If --browserstack is given, it will run the full suite of currently supported browsers. // If --browsers is given, browsers can be chosen explicitly. e.g. --browsers=chrome,firefox,ie9 -gulp.task('test', ['clean', 'lint'], function (done) { - var karmaConf = karmaConfMaker(false, argv.browserstack, argv.watch, argv.file); +// If --notest is given, it will immediately skip the test task (useful for developing changes with `gulp serve --notest`) +function test(done) { + if (argv.notest) { + done(); + } else { + var karmaConf = karmaConfMaker(false, argv.browserstack, argv.watch, argv.file); - var browserOverride = helpers.parseBrowserArgs(argv).map(helpers.toCapitalCase); - if (browserOverride.length > 0) { - karmaConf.browsers = browserOverride; - } + var browserOverride = helpers.parseBrowserArgs(argv).map(helpers.toCapitalCase); + if (browserOverride.length > 0) { + karmaConf.browsers = browserOverride; + } - new KarmaServer(karmaConf, newKarmaCallback(done)).start(); -}); + new KarmaServer(karmaConf, newKarmaCallback(done)).start(); + } +} // If --file "" is given, the task will only run tests in the specified file. -gulp.task('test-coverage', ['clean'], function(done) { +function testCoverage(done) { new KarmaServer(karmaConfMaker(true, false, false, argv.file), newKarmaCallback(done)).start(); -}); - -// View the code coverage report in the browser. -gulp.task('view-coverage', function (done) { - var coveragePort = 1999; - - connect.server({ - port: coveragePort, - root: 'build/coverage/karma_html', - livereload: false - }); - opens('http://localhost:' + coveragePort); - done(); -}); +} -gulp.task('coveralls', ['test-coverage'], function() { // 2nd arg is a dependency: 'test' must be finished +function coveralls() { // 2nd arg is a dependency: 'test' must be finished // first send results of istanbul's test coverage to coveralls.io. return gulp.src('gulpfile.js', { read: false }) // You have to give it a file, but you don't // have to read it. .pipe(shell('cat build/coverage/lcov.info | node_modules/coveralls/bin/coveralls.js')); -}); +} // Watch Task with Live Reload gulp.task('watch', function () { @@ -242,27 +290,7 @@ gulp.task('watch', function () { }); }); -gulp.task('lint', () => { - return gulp.src(['src/**/*.js', 'modules/**/*.js', 'test/**/*.js']) - .pipe(eslint()) - .pipe(eslint.format('stylish')) - .pipe(eslint.failAfterError()); -}); - -gulp.task('clean-docs', function () { - del(['docs']); -}); - -gulp.task('docs', ['clean-docs'], function () { - return gulp.src('src/prebid.js') - .pipe(gulpDocumentation('md')) - .on('error', function (err) { - gutil.log('`gulp-documentation` failed:', err.message); - }) - .pipe(gulp.dest('docs')); -}); - -gulp.task('e2etest', ['devpack', 'webpack'], function() { +function e2eTest() { var cmdQueue = []; if (argv.browserstack) { var browsers = require('./browsers.json'); @@ -289,38 +317,50 @@ gulp.task('e2etest', ['devpack', 'webpack'], function() { return gulp.src('') .pipe(shell(cmdQueue.join(';'))); -}); - -gulp.task('e2etest-report', function() { - var reportPort = 9010; - var targetDestinationDir = './e2etest-report'; - helpers.createEnd2EndTestReport(targetDestinationDir); - connect.server({ - port: reportPort, - root: './', - livereload: true - }); - - setTimeout(function() { - opens('http://localhost:' + reportPort + '/' + targetDestinationDir.slice(2) + '/results.html'); - }, 5000); -}); +} // This task creates postbid.js. Postbid setup is different from prebid.js // More info can be found here http://prebid.org/overview/what-is-post-bid.html -gulp.task('build-postbid', ['escape-postbid-config'], function() { + +function buildPostbid() { var fileContent = fs.readFileSync('./build/postbid/postbid-config.js', 'utf8'); return gulp.src('./integrationExamples/postbid/oas/postbid.js') .pipe(replace('\[%%postbid%%\]', fileContent)) .pipe(gulp.dest('build/postbid/')); -}); +} -// Dependant task for building postbid. It escapes postbid-config file. -gulp.task('escape-postbid-config', function() { - gulp.src('./integrationExamples/postbid/oas/postbid-config.js') - .pipe(jsEscape()) - .pipe(gulp.dest('build/postbid/')); -}); +// support tasks +gulp.task(lint); +gulp.task(watch); + +gulp.task(clean); + +gulp.task(escapePostbidConfig); + +gulp.task('build-bundle-dev', gulp.series(makeDevpackPkg, gulpBundle.bind(null, true))); +gulp.task('build-bundle-prod', gulp.series(makeWebpackPkg, gulpBundle.bind(null, false))); + +// public tasks (dependencies are needed for each task since they can be ran on their own) +gulp.task('test', gulp.series(clean, lint, test)); + +gulp.task('test-coverage', gulp.series(clean, testCoverage)); +gulp.task(viewCoverage); + +gulp.task('coveralls', gulp.series('test-coverage', coveralls)); + +gulp.task('build', gulp.series(clean, 'build-bundle-prod')); +gulp.task('build-postbid', gulp.series(escapePostbidConfig, buildPostbid)); + +gulp.task('serve', gulp.series(clean, lint, gulp.parallel('build-bundle-dev', watch, test))); +gulp.task('default', gulp.series(clean, makeWebpackPkg)); + +gulp.task(e2etestReport); +gulp.task('e2etest', gulp.series(clean, gulp.parallel(makeDevpackPkg, makeWebpackPkg), e2eTest)); + +// other tasks +gulp.task(bundleToStdout); +gulp.task('bundle', gulpBundle.bind(null, false)); // used for just concatenating pre-built files with no build step +gulp.task('serve-nw', gulp.parallel(lint, watch, 'e2etest')); module.exports = nodeBundle; diff --git a/package-lock.json b/package-lock.json index 4366f57423a..58d408a6be4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "prebid.js", - "version": "1.17.0-pre", + "version": "1.19.0-pre", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -41,9 +41,9 @@ } }, "JSONStream": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.3.tgz", - "integrity": "sha512-3Sp6WZZ/lXl+nTDoGpGWHEpTnnC6X5fnkolYZR6nwIfzbxxvA8utPWe1gCt7i0m9uVGsSz2IS8K8mJ7HmlduMg==", + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.4.tgz", + "integrity": "sha512-Y7vfi3I5oMOYIr+WxV8NZxDSwcbNgzdKYsTNInmycOq9bUYwGg9ryu57Wg5NLmCjqdFPNUmpMBo3kSJN9tCbXg==", "dev": true, "requires": { "jsonparse": "^1.2.0", @@ -311,12 +311,30 @@ "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", "dev": true }, + "arr-filter": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/arr-filter/-/arr-filter-1.1.2.tgz", + "integrity": "sha1-Q/3d0JHo7xGqTEXZzcGOLf8XEe4=", + "dev": true, + "requires": { + "make-iterator": "^1.0.0" + } + }, "arr-flatten": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", "dev": true }, + "arr-map": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/arr-map/-/arr-map-2.0.2.tgz", + "integrity": "sha1-Onc0X/wc814qkYJWAfnljy4kysQ=", + "dev": true, + "requires": { + "make-iterator": "^1.0.0" + } + }, "arr-union": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", @@ -341,18 +359,72 @@ "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", "dev": true }, + "array-initial": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/array-initial/-/array-initial-1.1.0.tgz", + "integrity": "sha1-L6dLJnOTccOUe9enrcc74zSz15U=", + "dev": true, + "requires": { + "array-slice": "^1.0.0", + "is-number": "^4.0.0" + }, + "dependencies": { + "is-number": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", + "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", + "dev": true + } + } + }, "array-iterate": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/array-iterate/-/array-iterate-1.1.2.tgz", "integrity": "sha512-1hWSHTIlG/8wtYD+PPX5AOBtKWngpDFjrsrHgZpe+JdgNGz0udYu6ZIkAa/xuenIUEqFv7DvE2Yr60jxweJSrQ==", "dev": true }, + "array-last": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/array-last/-/array-last-1.3.0.tgz", + "integrity": "sha512-eOCut5rXlI6aCOS7Z7kCplKRKyiFQ6dHFBem4PwlwKeNFk2/XxTrhRh5T9PyaEWGy/NHTZWbY+nsZlNFJu9rYg==", + "dev": true, + "requires": { + "is-number": "^4.0.0" + }, + "dependencies": { + "is-number": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", + "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", + "dev": true + } + } + }, "array-slice": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-1.1.0.tgz", "integrity": "sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w==", "dev": true }, + "array-sort": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-sort/-/array-sort-1.0.0.tgz", + "integrity": "sha512-ihLeJkonmdiAsD7vpgN3CRcx2J2S0TiYW+IS/5zHBI7mKUq3ySvBdzzBfD236ubDBQFiiyG3SWCPc+msQ9KoYg==", + "dev": true, + "requires": { + "default-compare": "^1.0.0", + "get-value": "^2.0.6", + "kind-of": "^5.0.2" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, "array-union": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", @@ -387,10 +459,13 @@ "dev": true }, "asn1": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", - "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=", - "dev": true + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "dev": true, + "requires": { + "safer-buffer": "~2.1.0" + } }, "asn1.js": { "version": "4.10.1", @@ -459,6 +534,26 @@ "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", "dev": true }, + "async-done": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/async-done/-/async-done-1.3.1.tgz", + "integrity": "sha512-R1BaUeJ4PMoLNJuk+0tLJgjmEqVsdN118+Z8O+alhnQDQgy0kmD5Mqi0DNEmMx2LM0Ed5yekKu+ZXYvIHceicg==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.2", + "process-nextick-args": "^1.0.7", + "stream-exhaust": "^1.0.1" + }, + "dependencies": { + "process-nextick-args": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", + "dev": true + } + } + }, "async-each": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz", @@ -471,6 +566,15 @@ "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==", "dev": true }, + "async-settle": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-settle/-/async-settle-1.0.0.tgz", + "integrity": "sha1-HQqRS7Aldb7IqPOnTlCA9yssDGs=", + "dev": true, + "requires": { + "async-done": "^1.2.2" + } + }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -489,9 +593,9 @@ "dev": true }, "aws4": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.7.0.tgz", - "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==", "dev": true }, "axios": { @@ -1570,6 +1674,23 @@ "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", "dev": true }, + "bach": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/bach/-/bach-1.2.0.tgz", + "integrity": "sha1-Szzpa/JxNPeaG0FKUcFONMO9mIA=", + "dev": true, + "requires": { + "arr-filter": "^1.1.1", + "arr-flatten": "^1.0.1", + "arr-map": "^2.0.0", + "array-each": "^1.0.0", + "array-initial": "^1.0.0", + "array-last": "^1.1.1", + "async-done": "^1.2.2", + "async-settle": "^1.0.0", + "now-and-later": "^2.0.0" + } + }, "backo2": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz", @@ -2099,16 +2220,38 @@ "isarray": "^1.0.0" } }, + "buffer-alloc": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", + "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", + "dev": true, + "requires": { + "buffer-alloc-unsafe": "^1.1.0", + "buffer-fill": "^1.0.0" + } + }, + "buffer-alloc-unsafe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", + "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==", + "dev": true + }, "buffer-equal": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-1.0.0.tgz", "integrity": "sha1-WWFrSYME1Var1GaWayLu2j7KX74=", "dev": true }, + "buffer-fill": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", + "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=", + "dev": true + }, "buffer-from": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.0.tgz", - "integrity": "sha512-c5mRlguI/Pe2dSZmpER62rSCu0ryKmWddzRYsuXc50U2/g8jMOulc31VZMa4mYx31U5xsmSOpDCgH88Vl9cDGQ==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", "dev": true }, "buffer-more-ints": { @@ -2255,9 +2398,9 @@ } }, "caniuse-lite": { - "version": "1.0.30000865", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000865.tgz", - "integrity": "sha512-vs79o1mOSKRGv/1pSkp4EXgl4ZviWeYReXw60XfacPU64uQWZwJT6vZNmxRF9O+6zu71sJwMxLK5JXxbzuVrLw==", + "version": "1.0.30000876", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000876.tgz", + "integrity": "sha512-v+Q2afhJJ1oydQnEB4iHhxDz5x9lWPbRnQBQlM3FgtZxqLO8KDSdu4txUrFwC1Ws9I2kQi/QImkvj17NbVpNAg==", "dev": true }, "caseless": { @@ -2456,9 +2599,9 @@ } }, "clone": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.1.tgz", - "integrity": "sha1-0hfR6WERjjrJpLi7oyhVU79kfNs=", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", "dev": true }, "clone-buffer": { @@ -2511,6 +2654,17 @@ "integrity": "sha512-YfQ1tAUZm561vpYD+5eyWN8+UsceQbSrqqlc/6zDY2gtAE+uZLSdkkovhnGpmCThsvKBFakq4EdY/FF93E8XIw==", "dev": true }, + "collection-map": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/collection-map/-/collection-map-1.0.0.tgz", + "integrity": "sha1-rqDwb40mx4DCt1SUOFVEsiVa8Yw=", + "dev": true, + "requires": { + "arr-map": "^2.0.2", + "for-own": "^1.0.0", + "make-iterator": "^1.0.0" + } + }, "collection-visit": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", @@ -2543,9 +2697,9 @@ "dev": true }, "colors": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.3.0.tgz", - "integrity": "sha512-EDpX3a7wHMWFA7PUHWPHNWqOxIIRSJetuwl0AS5Oi/5FMV8kWm69RTlgm00GKjBO1xFHMtBbL49yRtMMdticBw==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.3.1.tgz", + "integrity": "sha512-jg/vxRmv430jixZrC+La5kMbUWqIg32/JsYNZb94+JEmzceYbWKTsv1OuTp+7EaqiaWRR2tPcykibwCRgclIsw==", "dev": true }, "combine-lists": { @@ -2717,6 +2871,16 @@ "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", "dev": true }, + "copy-props": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/copy-props/-/copy-props-2.0.4.tgz", + "integrity": "sha512-7cjuUME+p+S3HZlbllgsn2CDwS+5eCCX16qBgNC4jgSTf49qR1VKy/Zhl400m0IQXl/bPGEVqncgUUMjrr4s8A==", + "dev": true, + "requires": { + "each-props": "^1.3.0", + "is-plain-object": "^2.0.1" + } + }, "core-js": { "version": "2.5.7", "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", @@ -2942,10 +3106,14 @@ "dev": true }, "dateformat": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-2.2.0.tgz", - "integrity": "sha1-QGXiATz5+5Ft39gu+1Bq1MZ2kGI=", - "dev": true + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.12.tgz", + "integrity": "sha1-nxJLZ1lMk3/3BpMuSmQsyo27/uk=", + "dev": true, + "requires": { + "get-stdin": "^4.0.1", + "meow": "^3.3.0" + } }, "debug": { "version": "3.1.0", @@ -3008,6 +3176,23 @@ "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", "dev": true }, + "default-compare": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/default-compare/-/default-compare-1.0.0.tgz", + "integrity": "sha512-QWfXlM0EkAbqOCbD/6HjdwT19j7WCkMyiRhWilc4H9/5h/RzTF9gv5LYh1+CmDV5d1rki6KAWLtQale0xt20eQ==", + "dev": true, + "requires": { + "kind-of": "^5.0.2" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, "default-require-extensions": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-2.0.0.tgz", @@ -3017,22 +3202,11 @@ "strip-bom": "^3.0.0" } }, - "defaults": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", - "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", - "dev": true, - "requires": { - "clone": "^1.0.2" - }, - "dependencies": { - "clone": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", - "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", - "dev": true - } - } + "default-resolution": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/default-resolution/-/default-resolution-2.0.0.tgz", + "integrity": "sha1-vLgrqnKtebQmp2cy8aga1t8m1oQ=", + "dev": true }, "define-properties": { "version": "1.1.2", @@ -3145,12 +3319,6 @@ "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", "dev": true }, - "deprecated": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/deprecated/-/deprecated-0.0.1.tgz", - "integrity": "sha1-+cmvVGSvoeepcUWKi97yqpTVuxk=", - "dev": true - }, "des.js": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.0.tgz", @@ -3568,14 +3736,25 @@ "stream-shift": "^1.0.0" } }, + "each-props": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/each-props/-/each-props-1.3.2.tgz", + "integrity": "sha512-vV0Hem3zAGkJAyU7JSjixeU66rwdynTAa1vofCrSA5fEln+m67Az9CcnkVD776/fsN/UjIWmBDoNRS6t6G9RfA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.1", + "object.defaults": "^1.1.0" + } + }, "ecc-jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", - "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", "dev": true, "optional": true, "requires": { - "jsbn": "~0.1.0" + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" } }, "ee-first": { @@ -3591,15 +3770,15 @@ "dev": true }, "electron-to-chromium": { - "version": "1.3.52", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.52.tgz", - "integrity": "sha1-0tnxJwuko7lnuDHEDvcftNmrXOA=", + "version": "1.3.57", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.57.tgz", + "integrity": "sha512-YYpZlr6mzR8cK5VRmTZydEt5Mp+WMg1/syrO40PoQzl76vJ+oQchL2d3FmEcWzw3FYqJVYJP/kYYSzTa7FLXwg==", "dev": true }, "elliptic": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz", - "integrity": "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=", + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz", + "integrity": "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==", "dev": true, "requires": { "bn.js": "^4.4.0", @@ -3732,9 +3911,9 @@ } }, "es5-ext": { - "version": "0.10.45", - "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.45.tgz", - "integrity": "sha512-FkfM6Vxxfmztilbxxz5UKSD4ICMf5tSpRFtDNtkAhOxZ0EKtX6qwmXNyH/sFyIbX2P/nU5AMiA9jilWsUGJzCQ==", + "version": "0.10.46", + "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.46.tgz", + "integrity": "sha512-24XxRvJXNFwEMpJb3nOkiRJKRoupmjYmOPVlI65Qy2SrtxwOTB+g6ODjBKOtwEHbYrhWRty9xxOWLNdClT2djw==", "requires": { "es6-iterator": "~2.0.3", "es6-symbol": "~3.1.1", @@ -4076,9 +4255,9 @@ } }, "eslint-plugin-import": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.13.0.tgz", - "integrity": "sha512-t6hGKQDMIt9N8R7vLepsYXgDfeuhp6ZJSgtrLEDxonpSubyxUZHjhm6LsAaZX8q6GYVxkbT3kTsV9G5mBCFR6A==", + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.14.0.tgz", + "integrity": "sha512-FpuRtniD/AY6sXByma2Wr0TXvXJ4nA/2/04VPlfpmUDPOpOY264x+ILiwnrk/k4RINgDAyFZByxqPUbSQ5YE7g==", "dev": true, "requires": { "contains-path": "^0.1.0", @@ -4440,9 +4619,9 @@ } }, "extend": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", - "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", "dev": true }, "extend-shallow": { @@ -4739,12 +4918,6 @@ "pkg-dir": "^2.0.0" } }, - "find-index": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/find-index/-/find-index-0.1.1.tgz", - "integrity": "sha1-Z101iyyjiS15Whq0cjL4tuLg3eQ=", - "dev": true - }, "find-up": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", @@ -4790,12 +4963,6 @@ "parse-filepath": "^1.0.1" } }, - "first-chunk-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-1.0.0.tgz", - "integrity": "sha1-Wb+1DNkF9g18OUzT2ayqtOatk04=", - "dev": true - }, "flagged-respawn": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/flagged-respawn/-/flagged-respawn-1.0.0.tgz", @@ -4825,9 +4992,9 @@ } }, "follow-redirects": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.1.tgz", - "integrity": "sha512-v9GI1hpaqq1ZZR6pBD1+kI7O24PhDvNGNodjS3MdcEqyrahCp8zbtpv+2B/krUnSmUH80lbAS7MrdeK5IylgKg==", + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.5.tgz", + "integrity": "sha512-GHjtHDlY/ehslqv0Gr5N0PUJppgg/q0rOBvX0na1s7y1A3LWxPqCYU76s3Z1bM4+UZB4QF0usaXLT5wFpof5PA==", "dev": true, "requires": { "debug": "^3.1.0" @@ -4946,12 +5113,6 @@ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz", "integrity": "sha1-3j5fiWHIjHh+4TaN+EmsRBPsqNc=", "dev": true - }, - "rimraf": { - "version": "2.2.8", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz", - "integrity": "sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI=", - "dev": true } } }, @@ -5590,15 +5751,6 @@ "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", "dev": true }, - "gaze": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/gaze/-/gaze-0.5.2.tgz", - "integrity": "sha1-QLcJU30k0dRXZ9takIaJ3+aaxE8=", - "dev": true, - "requires": { - "globule": "~0.1.0" - } - }, "generate-function": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", @@ -5805,21 +5957,15 @@ } }, "glob-watcher": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/glob-watcher/-/glob-watcher-0.0.6.tgz", - "integrity": "sha1-uVtKjfdLOcgymLDAXJeLTZo7cQs=", - "dev": true, - "requires": { - "gaze": "^0.5.1" - } - }, - "glob2base": { - "version": "0.0.12", - "resolved": "https://registry.npmjs.org/glob2base/-/glob2base-0.0.12.tgz", - "integrity": "sha1-nUGbPijxLoOjYhZKJ3BVkiycDVY=", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/glob-watcher/-/glob-watcher-5.0.1.tgz", + "integrity": "sha512-fK92r2COMC199WCyGUblrZKhjra3cyVMDiypDdqg1vsSDmexnbYivK1kNR4QItiNXLKmGlqan469ks67RtNa2g==", "dev": true, "requires": { - "find-index": "^0.1.1" + "async-done": "^1.2.0", + "chokidar": "^2.0.0", + "just-debounce": "^1.0.0", + "object.defaults": "^1.1.0" } }, "global-modules": { @@ -5880,64 +6026,6 @@ } } }, - "globule": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/globule/-/globule-0.1.0.tgz", - "integrity": "sha1-2cjt3h2nnRJaFRt5UzuXhnY0auU=", - "dev": true, - "requires": { - "glob": "~3.1.21", - "lodash": "~1.0.1", - "minimatch": "~0.2.11" - }, - "dependencies": { - "glob": { - "version": "3.1.21", - "resolved": "https://registry.npmjs.org/glob/-/glob-3.1.21.tgz", - "integrity": "sha1-0p4KBV3qUTj00H7UDomC6DwgZs0=", - "dev": true, - "requires": { - "graceful-fs": "~1.2.0", - "inherits": "1", - "minimatch": "~0.2.11" - } - }, - "graceful-fs": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-1.2.3.tgz", - "integrity": "sha1-FaSAaldUfLLS2/J/QuiajDRRs2Q=", - "dev": true - }, - "inherits": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-1.0.2.tgz", - "integrity": "sha1-ykMJ2t7mtUzAuNJH6NfHoJdb3Js=", - "dev": true - }, - "lodash": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-1.0.2.tgz", - "integrity": "sha1-j1dWDIO1n8JwvT1WG2kAQ0MOJVE=", - "dev": true - }, - "lru-cache": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz", - "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=", - "dev": true - }, - "minimatch": { - "version": "0.2.14", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", - "integrity": "sha1-x054BXT2PG+aCQ6Q775u9TpqdWo=", - "dev": true, - "requires": { - "lru-cache": "2", - "sigmund": "~1.0.0" - } - } - } - }, "glogg": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/glogg/-/glogg-1.0.1.tgz", @@ -5984,174 +6072,180 @@ "dev": true }, "gulp": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/gulp/-/gulp-3.9.1.tgz", - "integrity": "sha1-VxzkWSjdQK9lFPxAEYZgFsE4RbQ=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/gulp/-/gulp-4.0.0.tgz", + "integrity": "sha1-lXZsYB2t5Kd+0+eyttwDiBtZY2Y=", "dev": true, "requires": { - "archy": "^1.0.0", - "chalk": "^1.0.0", - "deprecated": "^0.0.1", - "gulp-util": "^3.0.0", - "interpret": "^1.0.0", - "liftoff": "^2.1.0", - "minimist": "^1.1.0", - "orchestrator": "^0.3.0", - "pretty-hrtime": "^1.0.0", - "semver": "^4.1.0", - "tildify": "^1.0.0", - "v8flags": "^2.0.2", - "vinyl-fs": "^0.3.0" + "glob-watcher": "^5.0.0", + "gulp-cli": "^2.0.0", + "undertaker": "^1.0.0", + "vinyl-fs": "^3.0.0" }, "dependencies": { - "clone": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/clone/-/clone-0.2.0.tgz", - "integrity": "sha1-xhJqkK1Pctv1rNskPMN3JP6T/B8=", - "dev": true - }, - "clone-stats": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz", - "integrity": "sha1-uI+UqCzzi4eR1YBG6kAprYjKmdE=", + "camelcase": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", + "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", "dev": true }, - "glob": { - "version": "4.5.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-4.5.3.tgz", - "integrity": "sha1-xstz0yJsHv7wTePFbQEvAzd+4V8=", + "find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", "dev": true, "requires": { - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^2.0.1", - "once": "^1.3.0" + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "gulp-cli": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/gulp-cli/-/gulp-cli-2.0.1.tgz", + "integrity": "sha512-RxujJJdN8/O6IW2nPugl7YazhmrIEjmiVfPKrWt68r71UCaLKS71Hp0gpKT+F6qOUFtr7KqtifDKaAJPRVvMYQ==", + "dev": true, + "requires": { + "ansi-colors": "^1.0.1", + "archy": "^1.0.0", + "array-sort": "^1.0.0", + "color-support": "^1.1.3", + "concat-stream": "^1.6.0", + "copy-props": "^2.0.1", + "fancy-log": "^1.3.2", + "gulplog": "^1.0.0", + "interpret": "^1.1.0", + "isobject": "^3.0.1", + "liftoff": "^2.5.0", + "matchdep": "^2.0.0", + "mute-stdout": "^1.0.0", + "pretty-hrtime": "^1.0.0", + "replace-homedir": "^1.0.0", + "semver-greatest-satisfied-range": "^1.1.0", + "v8flags": "^3.0.1", + "yargs": "^7.1.0" } }, - "glob-stream": { - "version": "3.1.18", - "resolved": "https://registry.npmjs.org/glob-stream/-/glob-stream-3.1.18.tgz", - "integrity": "sha1-kXCl8St5Awb9/lmPMT+PeVT9FDs=", + "load-json-file": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { - "glob": "^4.3.1", - "glob2base": "^0.0.12", - "minimatch": "^2.0.1", - "ordered-read-streams": "^0.1.0", - "through2": "^0.6.1", - "unique-stream": "^1.0.0" + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" } }, - "graceful-fs": { - "version": "3.0.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.11.tgz", - "integrity": "sha1-dhPHeKGv6mLyXGMKCG1/Osu92Bg=", + "os-locale": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", "dev": true, "requires": { - "natives": "^1.1.0" + "lcid": "^1.0.0" } }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", - "dev": true - }, - "minimatch": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.10.tgz", - "integrity": "sha1-jQh8OcazjAAbl/ynzm0OHoCvusc=", + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", "dev": true, "requires": { - "brace-expansion": "^1.0.0" + "error-ex": "^1.2.0" } }, - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true - }, - "ordered-read-streams": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/ordered-read-streams/-/ordered-read-streams-0.1.0.tgz", - "integrity": "sha1-/VZamvjrRHO6abbtijQ1LLVS8SY=", - "dev": true + "path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "dev": true, + "requires": { + "pinkie-promise": "^2.0.0" + } }, - "readable-stream": { - "version": "1.0.34", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", - "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "path-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", "dev": true, "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" } }, - "semver": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/semver/-/semver-4.3.6.tgz", - "integrity": "sha1-MAvG4OhjdPe6YQaLWx7NV/xlMto=", + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", - "dev": true + "read-pkg": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", + "dev": true, + "requires": { + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" + } }, - "strip-bom": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-1.0.0.tgz", - "integrity": "sha1-hbiGLzhEtabV7IRnqTWYFzo295Q=", + "read-pkg-up": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", "dev": true, "requires": { - "first-chunk-stream": "^1.0.0", - "is-utf8": "^0.2.0" + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" } }, - "through2": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", - "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", + "strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", "dev": true, "requires": { - "readable-stream": ">=1.0.33-1 <1.1.0-0", - "xtend": ">=4.0.0 <4.1.0-0" + "is-utf8": "^0.2.0" } }, - "unique-stream": { + "which-module": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unique-stream/-/unique-stream-1.0.0.tgz", - "integrity": "sha1-1ZpKdUJ0R9mqbJHnAmP40mpLEEs=", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz", + "integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8=", "dev": true }, - "vinyl": { - "version": "0.4.6", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.4.6.tgz", - "integrity": "sha1-LzVsh6VQolVGHza76ypbqL94SEc=", + "yargs": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-7.1.0.tgz", + "integrity": "sha1-a6MY6xaWFyf10oT46gA+jWFU0Mg=", "dev": true, "requires": { - "clone": "^0.2.0", - "clone-stats": "^0.0.1" + "camelcase": "^3.0.0", + "cliui": "^3.2.0", + "decamelize": "^1.1.1", + "get-caller-file": "^1.0.1", + "os-locale": "^1.4.0", + "read-pkg-up": "^1.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^1.0.2", + "which-module": "^1.0.0", + "y18n": "^3.2.1", + "yargs-parser": "^5.0.0" } }, - "vinyl-fs": { - "version": "0.3.14", - "resolved": "https://registry.npmjs.org/vinyl-fs/-/vinyl-fs-0.3.14.tgz", - "integrity": "sha1-mmhRzhysHBzqX+hsCTHWIMLPqeY=", + "yargs-parser": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-5.0.0.tgz", + "integrity": "sha1-J17PDX/+Bcd+ZOfIbkzZS/DhIoo=", "dev": true, "requires": { - "defaults": "^1.0.0", - "glob-stream": "^3.1.5", - "glob-watcher": "^0.0.6", - "graceful-fs": "^3.0.0", - "mkdirp": "^0.5.0", - "strip-bom": "^1.0.0", - "through2": "^0.6.1", - "vinyl": "^0.4.0" + "camelcase": "^3.0.0" } } } @@ -6262,16 +6356,6 @@ "integrity": "sha1-uI+UqCzzi4eR1YBG6kAprYjKmdE=", "dev": true }, - "dateformat": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.12.tgz", - "integrity": "sha1-nxJLZ1lMk3/3BpMuSmQsyo27/uk=", - "dev": true, - "requires": { - "get-stdin": "^4.0.1", - "meow": "^3.3.0" - } - }, "gulp-util": { "version": "2.2.20", "resolved": "https://registry.npmjs.org/gulp-util/-/gulp-util-2.2.20.tgz", @@ -6315,59 +6399,6 @@ "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", "dev": true }, - "lodash._reinterpolate": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-2.4.1.tgz", - "integrity": "sha1-TxInqlqHEfxjL1sHofRgequLMiI=", - "dev": true - }, - "lodash.escape": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-2.4.1.tgz", - "integrity": "sha1-LOEsXghNsKV92l5dHu659dF1o7Q=", - "dev": true, - "requires": { - "lodash._escapehtmlchar": "~2.4.1", - "lodash._reunescapedhtml": "~2.4.1", - "lodash.keys": "~2.4.1" - } - }, - "lodash.keys": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-2.4.1.tgz", - "integrity": "sha1-SN6kbfj/djKxDXBrissmWR4rNyc=", - "dev": true, - "requires": { - "lodash._isnative": "~2.4.1", - "lodash._shimkeys": "~2.4.1", - "lodash.isobject": "~2.4.1" - } - }, - "lodash.template": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-2.4.1.tgz", - "integrity": "sha1-nmEQB+32KRKal0qzxIuBez4c8g0=", - "dev": true, - "requires": { - "lodash._escapestringchar": "~2.4.1", - "lodash._reinterpolate": "~2.4.1", - "lodash.defaults": "~2.4.1", - "lodash.escape": "~2.4.1", - "lodash.keys": "~2.4.1", - "lodash.templatesettings": "~2.4.1", - "lodash.values": "~2.4.1" - } - }, - "lodash.templatesettings": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-2.4.1.tgz", - "integrity": "sha1-6nbHXRHrhtTb6JqDiTu4YZKaxpk=", - "dev": true, - "requires": { - "lodash._reinterpolate": "~2.4.1", - "lodash.escape": "~2.4.1" - } - }, "minimist": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.2.0.tgz", @@ -6516,16 +6547,6 @@ } } }, - "gulp-documentation": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/gulp-documentation/-/gulp-documentation-3.2.1.tgz", - "integrity": "sha1-r1JKv9cuI+cVXwCyoYoHo2QqjdU=", - "dev": true, - "requires": { - "through2": "^2.0.3", - "vinyl": "^2.1.0" - } - }, "gulp-eslint": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/gulp-eslint/-/gulp-eslint-4.0.2.tgz", @@ -6548,6 +6569,61 @@ "lodash._reevaluate": "^3.0.0", "lodash._reinterpolate": "^3.0.0", "lodash.template": "^3.6.2" + }, + "dependencies": { + "lodash._reinterpolate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", + "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=", + "dev": true + }, + "lodash.escape": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-3.2.0.tgz", + "integrity": "sha1-mV7g3BjBtIzJLv+ucaEKq1tIdpg=", + "dev": true, + "requires": { + "lodash._root": "^3.0.0" + } + }, + "lodash.keys": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", + "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", + "dev": true, + "requires": { + "lodash._getnative": "^3.0.0", + "lodash.isarguments": "^3.0.0", + "lodash.isarray": "^3.0.0" + } + }, + "lodash.template": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-3.6.2.tgz", + "integrity": "sha1-+M3sxhaaJVvpCYrosMU9N4kx0U8=", + "dev": true, + "requires": { + "lodash._basecopy": "^3.0.0", + "lodash._basetostring": "^3.0.0", + "lodash._basevalues": "^3.0.0", + "lodash._isiterateecall": "^3.0.0", + "lodash._reinterpolate": "^3.0.0", + "lodash.escape": "^3.0.0", + "lodash.keys": "^3.0.0", + "lodash.restparam": "^3.0.0", + "lodash.templatesettings": "^3.0.0" + } + }, + "lodash.templatesettings": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-3.1.1.tgz", + "integrity": "sha1-+zB4RHU7Zrnxr6VOJix0UwfbqOU=", + "dev": true, + "requires": { + "lodash._reinterpolate": "^3.0.0", + "lodash.escape": "^3.0.0" + } + } } }, "gulp-header": { @@ -6561,6 +6637,12 @@ "through2": "^2.0.0" }, "dependencies": { + "lodash._reinterpolate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", + "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=", + "dev": true + }, "lodash.template": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.4.0.tgz", @@ -6660,9 +6742,9 @@ } }, "gulp-rename": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/gulp-rename/-/gulp-rename-1.3.0.tgz", - "integrity": "sha512-nEuZB7/9i0IZ8AXORTizl2QLP9tcC9uWc/s329zElBLJw1CfOhmMXBxwVlCRKjDyrWuhVP0uBKl61KeQ32TiCg==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/gulp-rename/-/gulp-rename-1.4.0.tgz", + "integrity": "sha512-swzbIGb/arEoFK89tPY58vg3Ok1bw+d35PfUNwWqdo7KM4jkmuGA78JiDNqR+JeZFaeeHnRg9N7aihX3YPmsyg==", "dev": true }, "gulp-replace": { @@ -6739,15 +6821,16 @@ } }, "gulp-uglify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/gulp-uglify/-/gulp-uglify-3.0.0.tgz", - "integrity": "sha1-DfAzHXKg0wLj434QlIXd3zPG0co=", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/gulp-uglify/-/gulp-uglify-3.0.1.tgz", + "integrity": "sha512-KVffbGY9d4Wv90bW/B1KZJyunLMyfHTBbilpDvmcrj5Go0/a1G3uVpt+1gRBWSw/11dqR3coJ1oWNTt1AiXuWQ==", "dev": true, "requires": { "gulplog": "^1.0.0", "has-gulplog": "^0.1.0", "lodash": "^4.13.1", "make-error-cause": "^1.1.1", + "safe-buffer": "^5.1.2", "through2": "^2.0.0", "uglify-js": "^3.0.5", "vinyl-sourcemaps-apply": "^0.2.0" @@ -6760,9 +6843,9 @@ "dev": true }, "uglify-js": { - "version": "3.4.5", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.5.tgz", - "integrity": "sha512-Fm52gLqJqFBnT+Sn411NPDnsgaWiYeRLw42x7Va/mS8TKgaepwoGY7JLXHSEef3d3PmdFXSz1Zx7KMLL89E2QA==", + "version": "3.4.7", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.7.tgz", + "integrity": "sha512-J0M2i1mQA+ze3EdN9SBi751DNdAXmeFLfJrd/MDIkRc3G3Gbb9OPVSx7GIQvVwfWxQARcYV2DTxIkMyDAk3o9Q==", "dev": true, "requires": { "commander": "~2.16.0", @@ -6809,6 +6892,65 @@ "integrity": "sha1-uI+UqCzzi4eR1YBG6kAprYjKmdE=", "dev": true }, + "dateformat": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-2.2.0.tgz", + "integrity": "sha1-QGXiATz5+5Ft39gu+1Bq1MZ2kGI=", + "dev": true + }, + "lodash._reinterpolate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", + "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=", + "dev": true + }, + "lodash.escape": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-3.2.0.tgz", + "integrity": "sha1-mV7g3BjBtIzJLv+ucaEKq1tIdpg=", + "dev": true, + "requires": { + "lodash._root": "^3.0.0" + } + }, + "lodash.keys": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", + "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", + "dev": true, + "requires": { + "lodash._getnative": "^3.0.0", + "lodash.isarguments": "^3.0.0", + "lodash.isarray": "^3.0.0" + } + }, + "lodash.template": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-3.6.2.tgz", + "integrity": "sha1-+M3sxhaaJVvpCYrosMU9N4kx0U8=", + "dev": true, + "requires": { + "lodash._basecopy": "^3.0.0", + "lodash._basetostring": "^3.0.0", + "lodash._basevalues": "^3.0.0", + "lodash._isiterateecall": "^3.0.0", + "lodash._reinterpolate": "^3.0.0", + "lodash.escape": "^3.0.0", + "lodash.keys": "^3.0.0", + "lodash.restparam": "^3.0.0", + "lodash.templatesettings": "^3.0.0" + } + }, + "lodash.templatesettings": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-3.1.1.tgz", + "integrity": "sha1-+zB4RHU7Zrnxr6VOJix0UwfbqOU=", + "dev": true, + "requires": { + "lodash._reinterpolate": "^3.0.0", + "lodash.escape": "^3.0.0" + } + }, "minimist": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", @@ -6879,12 +7021,12 @@ "dev": true }, "har-validator": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", - "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", + "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", "dev": true, "requires": { - "ajv": "^5.1.0", + "ajv": "^5.3.0", "har-schema": "^2.0.0" }, "dependencies": { @@ -7630,9 +7772,9 @@ "optional": true }, "is-my-json-valid": { - "version": "2.17.2", - "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.17.2.tgz", - "integrity": "sha512-IBhBslgngMQN8DDSppmgDv7RNrlFotuuDsKcrCP3+HbFaVivIBU7u9oiiErw8sH4ynx3+gOGQ3q2otkgiSi6kg==", + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.19.0.tgz", + "integrity": "sha512-mG0f/unGX1HZ5ep4uhRaPOS8EkAY8/j6mDRMJrutq4CqhoJWYp7qAlonIPy3TV7p3ju4TK9fo/PbnoksWmsp5Q==", "dev": true, "optional": true, "requires": { @@ -7825,10 +7967,13 @@ "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, "isbinaryfile": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-3.0.2.tgz", - "integrity": "sha1-Sj6XTsDLqQBNP8bN5yCeppNopiE=", - "dev": true + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-3.0.3.tgz", + "integrity": "sha512-8cJBL5tTd2OS0dM4jz07wQd5g0dCCqIhUxPIGtZfa5L6hWlvV5MHTITy/DBAsF+Oe2LS1X3krBUhNwaGUWpWxw==", + "dev": true, + "requires": { + "buffer-alloc": "^1.2.0" + } }, "isexe": { "version": "2.0.0", @@ -8027,6 +8172,15 @@ "source-map": "^0.5.3" }, "dependencies": { + "rimraf": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "dev": true, + "requires": { + "glob": "^7.0.5" + } + }, "source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", @@ -8216,6 +8370,12 @@ "resolved": "https://registry.npmjs.org/just-clone/-/just-clone-1.0.2.tgz", "integrity": "sha1-v7P672WqEqMWBYcSlFwyb9jwFDQ=" }, + "just-debounce": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/just-debounce/-/just-debounce-1.0.0.tgz", + "integrity": "sha1-h/zPrv/AtozRnVX2cilD+SnqNeo=", + "dev": true + }, "just-extend": { "version": "1.1.27", "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-1.1.27.tgz", @@ -8223,9 +8383,9 @@ "dev": true }, "karma": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/karma/-/karma-2.0.4.tgz", - "integrity": "sha512-32yhTwoi6BZgJZhR78GwhzyFABbYG/1WwQqYgY7Vh96Demvua2jM3+FyRltIMTUH/Kd5xaQvDw2L7jTvkYFeXg==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/karma/-/karma-2.0.5.tgz", + "integrity": "sha512-rECezBeY7mjzGUWhFlB7CvPHgkHJLXyUmWg+6vHCEsdWNUTnmiS6jRrIMcJEWgU2DUGZzGWG0bTRVky8fsDTOA==", "dev": true, "requires": { "bluebird": "^3.3.0", @@ -8329,6 +8489,15 @@ "unpipe": "1.0.0" } }, + "rimraf": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "dev": true, + "requires": { + "glob": "^7.0.5" + } + }, "statuses": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", @@ -8581,6 +8750,16 @@ "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", "dev": true }, + "last-run": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/last-run/-/last-run-1.1.1.tgz", + "integrity": "sha1-RblpQsF7HHnHchmCWbqUO+v4yls=", + "dev": true, + "requires": { + "default-resolution": "^2.0.0", + "es6-weak-map": "^2.0.1" + } + }, "lazy-cache": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", @@ -8920,6 +9099,19 @@ "requires": { "lodash._basecopy": "^3.0.0", "lodash.keys": "^3.0.0" + }, + "dependencies": { + "lodash.keys": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", + "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", + "dev": true, + "requires": { + "lodash._getnative": "^3.0.0", + "lodash.isarguments": "^3.0.0", + "lodash.isarray": "^3.0.0" + } + } } }, "lodash._baseclone": { @@ -8934,6 +9126,19 @@ "lodash._basefor": "^3.0.0", "lodash.isarray": "^3.0.0", "lodash.keys": "^3.0.0" + }, + "dependencies": { + "lodash.keys": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", + "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", + "dev": true, + "requires": { + "lodash._getnative": "^3.0.0", + "lodash.isarguments": "^3.0.0", + "lodash.isarray": "^3.0.0" + } + } } }, "lodash._basecopy": { @@ -9024,9 +9229,9 @@ "dev": true }, "lodash._reinterpolate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", - "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-2.4.1.tgz", + "integrity": "sha1-TxInqlqHEfxjL1sHofRgequLMiI=", "dev": true }, "lodash._reunescapedhtml": { @@ -9037,19 +9242,6 @@ "requires": { "lodash._htmlescapes": "~2.4.1", "lodash.keys": "~2.4.1" - }, - "dependencies": { - "lodash.keys": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-2.4.1.tgz", - "integrity": "sha1-SN6kbfj/djKxDXBrissmWR4rNyc=", - "dev": true, - "requires": { - "lodash._isnative": "~2.4.1", - "lodash._shimkeys": "~2.4.1", - "lodash.isobject": "~2.4.1" - } - } } }, "lodash._root": { @@ -9098,19 +9290,6 @@ "requires": { "lodash._objecttypes": "~2.4.1", "lodash.keys": "~2.4.1" - }, - "dependencies": { - "lodash.keys": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-2.4.1.tgz", - "integrity": "sha1-SN6kbfj/djKxDXBrissmWR4rNyc=", - "dev": true, - "requires": { - "lodash._isnative": "~2.4.1", - "lodash._shimkeys": "~2.4.1", - "lodash.isobject": "~2.4.1" - } - } } }, "lodash.defaultsdeep": { @@ -9120,12 +9299,14 @@ "dev": true }, "lodash.escape": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-3.2.0.tgz", - "integrity": "sha1-mV7g3BjBtIzJLv+ucaEKq1tIdpg=", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-2.4.1.tgz", + "integrity": "sha1-LOEsXghNsKV92l5dHu659dF1o7Q=", "dev": true, "requires": { - "lodash._root": "^3.0.0" + "lodash._escapehtmlchar": "~2.4.1", + "lodash._reunescapedhtml": "~2.4.1", + "lodash.keys": "~2.4.1" } }, "lodash.get": { @@ -9156,14 +9337,14 @@ } }, "lodash.keys": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", - "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-2.4.1.tgz", + "integrity": "sha1-SN6kbfj/djKxDXBrissmWR4rNyc=", "dev": true, "requires": { - "lodash._getnative": "^3.0.0", - "lodash.isarguments": "^3.0.0", - "lodash.isarray": "^3.0.0" + "lodash._isnative": "~2.4.1", + "lodash._shimkeys": "~2.4.1", + "lodash.isobject": "~2.4.1" } }, "lodash.merge": { @@ -9185,30 +9366,28 @@ "dev": true }, "lodash.template": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-3.6.2.tgz", - "integrity": "sha1-+M3sxhaaJVvpCYrosMU9N4kx0U8=", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-2.4.1.tgz", + "integrity": "sha1-nmEQB+32KRKal0qzxIuBez4c8g0=", "dev": true, "requires": { - "lodash._basecopy": "^3.0.0", - "lodash._basetostring": "^3.0.0", - "lodash._basevalues": "^3.0.0", - "lodash._isiterateecall": "^3.0.0", - "lodash._reinterpolate": "^3.0.0", - "lodash.escape": "^3.0.0", - "lodash.keys": "^3.0.0", - "lodash.restparam": "^3.0.0", - "lodash.templatesettings": "^3.0.0" + "lodash._escapestringchar": "~2.4.1", + "lodash._reinterpolate": "~2.4.1", + "lodash.defaults": "~2.4.1", + "lodash.escape": "~2.4.1", + "lodash.keys": "~2.4.1", + "lodash.templatesettings": "~2.4.1", + "lodash.values": "~2.4.1" } }, "lodash.templatesettings": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-3.1.1.tgz", - "integrity": "sha1-+zB4RHU7Zrnxr6VOJix0UwfbqOU=", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-2.4.1.tgz", + "integrity": "sha1-6nbHXRHrhtTb6JqDiTu4YZKaxpk=", "dev": true, "requires": { - "lodash._reinterpolate": "^3.0.0", - "lodash.escape": "^3.0.0" + "lodash._reinterpolate": "~2.4.1", + "lodash.escape": "~2.4.1" } }, "lodash.values": { @@ -9218,19 +9397,6 @@ "dev": true, "requires": { "lodash.keys": "~2.4.1" - }, - "dependencies": { - "lodash.keys": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-2.4.1.tgz", - "integrity": "sha1-SN6kbfj/djKxDXBrissmWR4rNyc=", - "dev": true, - "requires": { - "lodash._isnative": "~2.4.1", - "lodash._shimkeys": "~2.4.1", - "lodash.isobject": "~2.4.1" - } - } } }, "log-driver": { @@ -9388,6 +9554,13 @@ "dev": true, "optional": true }, + "oauth-sign": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=", + "dev": true, + "optional": true + }, "qs": { "version": "6.2.3", "resolved": "https://registry.npmjs.org/qs/-/qs-6.2.3.tgz", @@ -9425,6 +9598,16 @@ "tunnel-agent": "~0.4.1" } }, + "tough-cookie": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", + "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", + "dev": true, + "optional": true, + "requires": { + "punycode": "^1.4.1" + } + }, "tunnel-agent": { "version": "0.4.3", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz", @@ -9653,6 +9836,18 @@ } } }, + "matchdep": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/matchdep/-/matchdep-2.0.0.tgz", + "integrity": "sha1-xvNINKDY28OzfCfui7yyfHd1WC4=", + "dev": true, + "requires": { + "findup-sync": "^2.0.0", + "micromatch": "^3.0.4", + "resolve": "^1.4.0", + "stack-trace": "0.0.10" + } + }, "math-random": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/math-random/-/math-random-1.0.1.tgz", @@ -9698,9 +9893,9 @@ } }, "mdast-util-to-hast": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-3.0.1.tgz", - "integrity": "sha512-+eimV/12kdg0/T0EEfcK7IsDbSu2auVm92z5jdSEQ3DHF2HiU4OHmX9ir5wpQajr73nwabdxrUoxREvW2zVFFw==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-3.0.2.tgz", + "integrity": "sha512-YI8Ea3TFWEZrS31+6Q/d8ZYTOSDKM06IPc3l2+OMFX1o3JTG2mrztlmzDsUMwIXLWofEdTVl/WXBgRG6ddlU/A==", "dev": true, "requires": { "collapse-white-space": "^1.0.0", @@ -9755,18 +9950,18 @@ } }, "memoizee": { - "version": "0.4.12", - "resolved": "https://registry.npmjs.org/memoizee/-/memoizee-0.4.12.tgz", - "integrity": "sha512-sprBu6nwxBWBvBOh5v2jcsGqiGLlL2xr2dLub3vR8dnE8YB17omwtm/0NSHl8jjNbcsJd5GMWJAnTSVe/O0Wfg==", + "version": "0.4.14", + "resolved": "https://registry.npmjs.org/memoizee/-/memoizee-0.4.14.tgz", + "integrity": "sha512-/SWFvWegAIYAO4NQMpcX+gcra0yEZu4OntmUdrBaWrJncxOqAziGFlHxc7yjKVK2uu3lpPW27P27wkR82wA8mg==", "requires": { "d": "1", - "es5-ext": "^0.10.30", + "es5-ext": "^0.10.45", "es6-weak-map": "^2.0.2", "event-emitter": "^0.3.5", "is-promise": "^2.1", "lru-queue": "0.1", "next-tick": "1", - "timers-ext": "^0.1.2" + "timers-ext": "^0.1.5" } }, "memory-fs": { @@ -10271,6 +10466,12 @@ } } }, + "mute-stdout": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/mute-stdout/-/mute-stdout-1.0.0.tgz", + "integrity": "sha1-WzLqB+tDyd7WEwQ0z5JvRrKn/U0=", + "dev": true + }, "mute-stream": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", @@ -10328,9 +10529,9 @@ "dev": true }, "neo-async": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.5.1.tgz", - "integrity": "sha512-3KL3fvuRkZ7s4IFOMfztb7zJp3QaVWnBeGoJlgB38XnCRPj/0tLzzLG5IB8NYOHbJ8g8UGrgZv44GLDk6CxTxA==", + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.5.2.tgz", + "integrity": "sha512-vdqTKI9GBIYcAEbFAcpKPErKINfPF5zIuz3/niBfq8WUZjpT2tytLlFVrBgWdOtqI4uaA/Rb6No0hux39XXDuw==", "dev": true }, "netmask": { @@ -10345,9 +10546,9 @@ "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=" }, "nightwatch": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/nightwatch/-/nightwatch-1.0.6.tgz", - "integrity": "sha1-F7Ghm0VfEi+SPkftfth7bJimopY=", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/nightwatch/-/nightwatch-1.0.8.tgz", + "integrity": "sha512-2G6mc2DALGs73BfmJjknmm2pClOz+qaYe7UY7RPtX1O0sZ7GLyV/CJXvBUBj42payEGdJpSX51s2s50IBfeQ9Q==", "dev": true, "requires": { "assertion-error": "^1.1.0", @@ -10637,9 +10838,9 @@ "dev": true }, "oauth-sign": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", - "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=", + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", "dev": true }, "object-assign": { @@ -10763,6 +10964,16 @@ "isobject": "^3.0.1" } }, + "object.reduce": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object.reduce/-/object.reduce-1.0.1.tgz", + "integrity": "sha1-b+NI8qx/oPlcpiEiZZkJaCW7A60=", + "dev": true, + "requires": { + "for-own": "^1.0.0", + "make-iterator": "^1.0.0" + } + }, "on-finished": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", @@ -10996,37 +11207,6 @@ "wordwrap": "~1.0.0" } }, - "orchestrator": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/orchestrator/-/orchestrator-0.3.8.tgz", - "integrity": "sha1-FOfp4nZPcxX7rBhOUGx6pt+UrX4=", - "dev": true, - "requires": { - "end-of-stream": "~0.1.5", - "sequencify": "~0.0.7", - "stream-consume": "~0.1.0" - }, - "dependencies": { - "end-of-stream": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-0.1.5.tgz", - "integrity": "sha1-jhdyBsPICDfYVjLouTWd/osvbq8=", - "dev": true, - "requires": { - "once": "~1.3.0" - } - }, - "once": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/once/-/once-1.3.3.tgz", - "integrity": "sha1-suJhVXzkwxTsgwTz+oJmPkKXyiA=", - "dev": true, - "requires": { - "wrappy": "1" - } - } - } - }, "ordered-read-streams": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/ordered-read-streams/-/ordered-read-streams-1.0.1.tgz", @@ -11481,9 +11661,9 @@ "dev": true }, "path-parse": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", - "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", "dev": true }, "path-platform": { @@ -11768,6 +11948,12 @@ "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", "dev": true }, + "psl": { + "version": "1.1.29", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", + "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==", + "dev": true + }, "public-encrypt": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.2.tgz", @@ -11894,9 +12080,9 @@ "dev": true }, "randomatic": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-3.0.0.tgz", - "integrity": "sha512-VdxFOIEY3mNO5PtSRkkle/hPJDHvQhK21oa73K4yAc9qmp6N429gAyF1gZMOTMeS0/AYzaV/2Trcef+NaIonSA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-3.1.0.tgz", + "integrity": "sha512-KnGPVE0lo2WoXxIZ7cPR8YBpiol4gsSuOwDSg410oHh80ZMp5EiypNqL2K4Z77vJn6lB5rap7IkAmcUlalcnBQ==", "dev": true, "requires": { "is-number": "^4.0.0", @@ -12175,18 +12361,18 @@ } }, "remark-reference-links": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/remark-reference-links/-/remark-reference-links-4.0.1.tgz", - "integrity": "sha1-AhrtHFXBh9cSs8dtAFe/UQ0wC6c=", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/remark-reference-links/-/remark-reference-links-4.0.2.tgz", + "integrity": "sha512-871gKTysBtdQUjoqXA0URWmVhI2jFrpLkWrM3/bydAbsngilDYRjjl2LDAgmNooW8bYbHa57YQ13ld+mYr3TLg==", "dev": true, "requires": { "unist-util-visit": "^1.0.0" } }, "remark-slug": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/remark-slug/-/remark-slug-5.0.0.tgz", - "integrity": "sha512-bRFK90ia6iooqC5KH6e9nEIL3OwRbTPU6ed2fm/fa66uofKdmRcsmRVMwND3pXLbvH2F022cETYlE7YlVs7LNQ==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/remark-slug/-/remark-slug-5.1.0.tgz", + "integrity": "sha512-FW/V7b3ekfDL1eyPDyzfq0qz5HFPKPNWVC2eqFDie45r774FLGoymOS1oU7LVQfdFNEvNLZ6oBJT/oIxAyBISg==", "dev": true, "requires": { "github-slugger": "^1.0.0", @@ -12288,6 +12474,17 @@ "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=", "dev": true }, + "replace-homedir": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/replace-homedir/-/replace-homedir-1.0.0.tgz", + "integrity": "sha1-6H9tUTuSjd6AgmDBK+f+xv9ueYw=", + "dev": true, + "requires": { + "homedir-polyfill": "^1.0.1", + "is-absolute": "^1.0.0", + "remove-trailing-separator": "^1.1.0" + } + }, "replacestream": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/replacestream/-/replacestream-0.1.3.tgz", @@ -12298,31 +12495,31 @@ } }, "request": { - "version": "2.87.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.87.0.tgz", - "integrity": "sha512-fcogkm7Az5bsS6Sl0sibkbhcKsnyon/jV1kF3ajGmF0c8HrttdKTPRT9hieOaQHA5HEq6r8OyWOo/o781C1tNw==", + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", "dev": true, "requires": { "aws-sign2": "~0.7.0", - "aws4": "^1.6.0", + "aws4": "^1.8.0", "caseless": "~0.12.0", - "combined-stream": "~1.0.5", - "extend": "~3.0.1", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", "forever-agent": "~0.6.1", - "form-data": "~2.3.1", - "har-validator": "~5.0.3", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", "http-signature": "~1.2.0", "is-typedarray": "~1.0.0", "isstream": "~0.1.2", "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.17", - "oauth-sign": "~0.8.2", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", "performance-now": "^2.1.0", - "qs": "~6.5.1", - "safe-buffer": "^5.1.1", - "tough-cookie": "~2.3.3", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", "tunnel-agent": "^0.6.0", - "uuid": "^3.1.0" + "uuid": "^3.3.2" } }, "requestretry": { @@ -12452,13 +12649,10 @@ } }, "rimraf": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", - "dev": true, - "requires": { - "glob": "^7.0.5" - } + "version": "2.2.8", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz", + "integrity": "sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI=", + "dev": true }, "ripemd160": { "version": "2.0.2", @@ -12555,6 +12749,15 @@ "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==", "dev": true }, + "semver-greatest-satisfied-range": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/semver-greatest-satisfied-range/-/semver-greatest-satisfied-range-1.1.0.tgz", + "integrity": "sha1-E+jCZYq5aRywzXEJMkAoDTb3els=", + "dev": true, + "requires": { + "sver-compat": "^1.5.0" + } + }, "send": { "version": "0.13.2", "resolved": "https://registry.npmjs.org/send/-/send-0.13.2.tgz", @@ -12604,12 +12807,6 @@ } } }, - "sequencify": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/sequencify/-/sequencify-0.0.7.tgz", - "integrity": "sha1-kM/xnQLgcCf9dn9erT57ldHnOAw=", - "dev": true - }, "serve-index": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz", @@ -13351,6 +13548,12 @@ "tweetnacl": "~0.14.0" } }, + "stack-trace": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", + "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=", + "dev": true + }, "state-toggle": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/state-toggle/-/state-toggle-1.0.1.tgz", @@ -13451,10 +13654,10 @@ "readable-stream": "^2.0.2" } }, - "stream-consume": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/stream-consume/-/stream-consume-0.1.1.tgz", - "integrity": "sha512-tNa3hzgkjEP7XbCkbRXe1jpg+ievoa0O4SCFlMOYEscGSS4JJsckGL8swUyAa/ApGU3Ae4t6Honor4HhL+tRyg==", + "stream-exhaust": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/stream-exhaust/-/stream-exhaust-1.0.2.tgz", + "integrity": "sha512-b/qaq/GlBK5xaq1yrK9/zFcyRSTNxmcZwFLGSTG0mXgZl/4Z6GgiyYOXOvY7N3eEvFRAG1bkDRz5EPGSvPYQlw==", "dev": true }, "stream-http": { @@ -13660,6 +13863,16 @@ "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", "dev": true }, + "sver-compat": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/sver-compat/-/sver-compat-1.5.0.tgz", + "integrity": "sha1-PPh9/rTQe0o/FIJ7wYaz/QxkXNg=", + "dev": true, + "requires": { + "es6-iterator": "^2.0.1", + "es6-symbol": "^3.1.1" + } + }, "table": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/table/-/table-4.0.2.tgz", @@ -13815,15 +14028,6 @@ "integrity": "sha1-+qDp0jDFGsyVyhOjYawFyn4EVT0=", "dev": true }, - "tildify": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/tildify/-/tildify-1.2.0.tgz", - "integrity": "sha1-3OwD9V3Km3qj5bBPIYF+tW5jWIo=", - "dev": true, - "requires": { - "os-homedir": "^1.0.0" - } - }, "time-stamp": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/time-stamp/-/time-stamp-1.1.0.tgz", @@ -13964,11 +14168,12 @@ } }, "tough-cookie": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", - "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", "dev": true, "requires": { + "psl": "^1.1.24", "punycode": "^1.4.1" } }, @@ -14009,15 +14214,15 @@ "dev": true }, "trough": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/trough/-/trough-1.0.2.tgz", - "integrity": "sha512-FHkoUZvG6Egrv9XZAyYGKEyb1JMsFphgPjoczkZC2y6W93U1jswcVURB8MUvtsahEPEVACyxD47JAL63vF4JsQ==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/trough/-/trough-1.0.3.tgz", + "integrity": "sha512-fwkLWH+DimvA4YCy+/nvJd61nWQQ2liO/nF/RjkTpiOGi+zxZzVkhb1mvbHIIW4b/8nDsYI8uTmAlc0nNkRMOw==", "dev": true }, "tsscmp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/tsscmp/-/tsscmp-1.0.5.tgz", - "integrity": "sha1-fcSjOvcVgatDN9qR2FylQn69mpc=", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/tsscmp/-/tsscmp-1.0.6.tgz", + "integrity": "sha512-LxhtAkPDTkVCMQjt2h6eBVY28KCjikZqZfMcC15YBeNjkgUpdCfBu5HoiOTDu86v6smE8yOjyEktJ8hlbANHQA==", "dev": true, "optional": true }, @@ -14177,6 +14382,29 @@ "integrity": "sha1-a7rwh3UA02vjTsqlhODbn+8DUgk=", "dev": true }, + "undertaker": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/undertaker/-/undertaker-1.2.0.tgz", + "integrity": "sha1-M52kZGJS0ILcN45wgGcpl1DhG0k=", + "dev": true, + "requires": { + "arr-flatten": "^1.0.1", + "arr-map": "^2.0.0", + "bach": "^1.0.0", + "collection-map": "^1.0.0", + "es6-weak-map": "^2.0.1", + "last-run": "^1.1.0", + "object.defaults": "^1.0.0", + "object.reduce": "^1.0.0", + "undertaker-registry": "^1.0.0" + } + }, + "undertaker-registry": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/undertaker-registry/-/undertaker-registry-1.0.1.tgz", + "integrity": "sha1-XkvaMI5KiirlhPm5pDWaSZglzFA=", + "dev": true + }, "unherit": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/unherit/-/unherit-1.1.1.tgz", @@ -14298,12 +14526,21 @@ "dev": true }, "unist-util-visit": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.3.1.tgz", - "integrity": "sha512-0fdB9EQJU0tho5tK0VzOJzAQpPv2LyLZ030b10GxuzAWEfvd54mpY7BMjQ1L69k2YNvL+SvxRzH0yUIehOO8aA==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.4.0.tgz", + "integrity": "sha512-FiGu34ziNsZA3ZUteZxSFaczIjGmksfSgdKqBfOejrrfzyUy5b7YrlzT1Bcvi+djkYDituJDy2XB7tGTeBieKw==", + "dev": true, + "requires": { + "unist-util-visit-parents": "^2.0.0" + } + }, + "unist-util-visit-parents": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-2.0.1.tgz", + "integrity": "sha512-6B0UTiMfdWql4cQ03gDTCSns+64Zkfo2OCbK31Ov0uMizEz+CJeAp0cgZVb5Fhmcd7Bct2iRNywejT0orpbqUA==", "dev": true, "requires": { - "unist-util-is": "^2.1.1" + "unist-util-is": "^2.1.2" } }, "unpipe": { @@ -14422,9 +14659,9 @@ } }, "url-parse": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.1.tgz", - "integrity": "sha512-x95Td74QcvICAA0+qERaVkRpTGKyBHHYdwL2LXZm5t/gBtCB9KQSO/0zQgSTYEV1p0WcvSg79TLNPSvd5IDJMQ==", + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.3.tgz", + "integrity": "sha512-rh+KuAW36YKo0vClhQzLLveoj8FwPJNu65xLb7Mrt+eZht0IPT0IXgSv8gcMegZ6NvjJUALf6Mf25POlMwD1Fw==", "dev": true, "requires": { "querystringify": "^2.0.0", @@ -14460,12 +14697,6 @@ "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", "dev": true }, - "user-home": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/user-home/-/user-home-1.1.1.tgz", - "integrity": "sha1-K1viOjK2Onyd640PKNSFcko98ZA=", - "dev": true - }, "useragent": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/useragent/-/useragent-2.2.1.tgz", @@ -14518,18 +14749,18 @@ "optional": true }, "v8flags": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-2.1.1.tgz", - "integrity": "sha1-qrGh+jDUX4jdMhFIh1rALAtV5bQ=", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.1.1.tgz", + "integrity": "sha512-iw/1ViSEaff8NJ3HLyEjawk/8hjJib3E7pvG4pddVXfUg1983s3VGsiClDjhK64MQVDGqc1Q8r18S4VKQZS9EQ==", "dev": true, "requires": { - "user-home": "^1.1.1" + "homedir-polyfill": "^1.0.1" } }, "validate-npm-package-license": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.3.tgz", - "integrity": "sha512-63ZOUnL4SIXj4L0NixR3L1lcjO38crAbgrTpl28t8jjrfuiOBL5Iygm+60qPs/KsZGzPNg6Smnc/oY16QTjF0g==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", "dev": true, "requires": { "spdx-correct": "^3.0.0", @@ -14952,9 +15183,9 @@ }, "dependencies": { "time-stamp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/time-stamp/-/time-stamp-2.0.0.tgz", - "integrity": "sha1-lcakRTDhW6jW9KPsuMOj+sRto1c=", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/time-stamp/-/time-stamp-2.0.1.tgz", + "integrity": "sha512-KUnkvOWC3C+pEbwE/0u3CcmNpGCDqkYGYZOphe1QFxApYQkJ5g195TDBjgZch/zG6chU1NcabLwnM7BCpWAzTQ==", "dev": true } } diff --git a/package.json b/package.json index 77181edc6a5..9d2de7d4e37 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,6 @@ "block-loader": "^2.1.0", "chai": "^3.3.0", "coveralls": "^3.0.1", - "del": "^2.2.0", "documentation": "^5.2.2", "ejs": "^2.5.1", "es5-shim": "^4.5.2", @@ -42,12 +41,11 @@ "eslint-plugin-standard": "^3.0.1", "faker": "^3.1.0", "fs.extra": "^1.3.2", - "gulp": "^3.9.1", + "gulp": "^4.0.0", "gulp-babel": "^6.1.2", "gulp-clean": "^0.3.2", "gulp-concat": "^2.6.0", "gulp-connect": "5.5.0", - "gulp-documentation": "^3.2.1", "gulp-eslint": "^4.0.0", "gulp-footer": "^1.0.5", "gulp-header": "^1.7.1", From f04ff6fd06a9c15240a6b7e98a0c6d738a1ece00 Mon Sep 17 00:00:00 2001 From: susyt Date: Wed, 5 Sep 2018 09:31:55 -0700 Subject: [PATCH 67/83] Update gumgumBidAdapter.md (#3031) New zone and slot Ids were created for Prebid testing --- modules/gumgumBidAdapter.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/gumgumBidAdapter.md b/modules/gumgumBidAdapter.md index 500c2a49e3b..14f2fe40abb 100644 --- a/modules/gumgumBidAdapter.md +++ b/modules/gumgumBidAdapter.md @@ -20,7 +20,7 @@ var adUnits = [ { bidder: 'gumgum', params: { - inSlot: '9' // GumGum Slot ID given to the client + inSlot: '15901' // GumGum Slot ID given to the client } } ] @@ -31,7 +31,7 @@ var adUnits = [ { bidder: 'gumgum', params: { - inScreen: 'ggumtest' // GumGum Zone ID given to the client + inScreen: 'dc9d6be1' // GumGum Zone ID given to the client } } ] From 3c50ff684722b454ab80a480516f40248ecfc212 Mon Sep 17 00:00:00 2001 From: Jonathan Mullins Date: Thu, 6 Sep 2018 03:39:25 +1000 Subject: [PATCH 68/83] corrected user sync type (#3034) --- modules/playgroundxyzBidAdapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/playgroundxyzBidAdapter.js b/modules/playgroundxyzBidAdapter.js index e521f7f98d6..e54f93ab8ca 100644 --- a/modules/playgroundxyzBidAdapter.js +++ b/modules/playgroundxyzBidAdapter.js @@ -102,7 +102,7 @@ export const spec = { } if (syncOptions.pixelEnabled) { return [{ - type: 'pixel', + type: 'image', url: '//ib.adnxs.com/getuidnb?https://ads.playground.xyz/usersync?partner=appnexus&uid=$UID' }]; } From 803e609547cbc965266055d07cba2eec9237828b Mon Sep 17 00:00:00 2001 From: Jaimin Panchal Date: Wed, 5 Sep 2018 14:11:24 -0400 Subject: [PATCH 69/83] Revert breaking change (#3052) --- src/prebid.js | 7 ++++--- test/spec/unit/pbjs_api_spec.js | 29 ++++++++--------------------- 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/src/prebid.js b/src/prebid.js index f30b063f70e..bfc9e31a06c 100644 --- a/src/prebid.js +++ b/src/prebid.js @@ -1,13 +1,13 @@ /** @module pbjs */ import { getGlobal } from './prebidGlobal'; -import { flatten, uniques, isGptPubadsDefined, adUnitsFilter, removeRequestId } from './utils'; +import { flatten, uniques, isGptPubadsDefined, adUnitsFilter, removeRequestId, getLatestHighestCpmBid } from './utils'; import { listenMessagesFromCreative } from './secureCreatives'; import { userSync } from 'src/userSync.js'; import { loadScript } from './adloader'; import { config } from './config'; import { auctionManager } from './auctionManager'; -import { targeting, RENDERED, BID_TARGETING_SET } from './targeting'; +import { targeting, getHighestCpmBidsFromBidPool, RENDERED, BID_TARGETING_SET } from './targeting'; import { createHook } from 'src/hook'; import { sessionLoader } from 'src/debugging'; import includes from 'core-js/library/fn/array/includes'; @@ -597,7 +597,8 @@ $$PREBID_GLOBAL$$.getAllPrebidWinningBids = function () { * @return {Array} array containing highest cpm bid object(s) */ $$PREBID_GLOBAL$$.getHighestCpmBids = function (adUnitCode) { - return targeting.getWinningBids(adUnitCode) + let bidsReceived = getHighestCpmBidsFromBidPool(auctionManager.getBidsReceived(), getLatestHighestCpmBid); + return targeting.getWinningBids(adUnitCode, bidsReceived) .map(removeRequestId); }; diff --git a/test/spec/unit/pbjs_api_spec.js b/test/spec/unit/pbjs_api_spec.js index 63656cb39f6..41e40100011 100644 --- a/test/spec/unit/pbjs_api_spec.js +++ b/test/spec/unit/pbjs_api_spec.js @@ -1810,10 +1810,13 @@ describe('Unit: Prebid Module', function () { }); }); - describe('getHighestCpm', function () { - after(function () { - resetAuction(); - }); + describe('getHighestCpm', () => { + // it('returns an array of winning bid objects for each adUnit', () => { + // const highestCpmBids = $$PREBID_GLOBAL$$.getHighestCpmBids(); + // expect(highestCpmBids.length).to.equal(2); + // expect(highestCpmBids[0]).to.deep.equal(auctionManager.getBidsReceived()[1]); + // expect(highestCpmBids[1]).to.deep.equal(auctionManager.getBidsReceived()[2]); + // }); it('returns an array containing the highest bid object for the given adUnitCode', function () { const highestCpmBids = $$PREBID_GLOBAL$$.getHighestCpmBids('/19968336/header-bid-tag-0'); @@ -1833,23 +1836,7 @@ describe('Unit: Prebid Module', function () { const highestCpmBids = $$PREBID_GLOBAL$$.getHighestCpmBids('/19968336/header-bid-tag-0'); expect(highestCpmBids.length).to.equal(0); - }); - - it('should not return rendered bid', function() { - let _bidsReceived = getBidResponses().slice(0, 3); - _bidsReceived[0].cpm = 12; - _bidsReceived[0].status = 'rendered'; - _bidsReceived[1].cpm = 9; - _bidsReceived[2].cpm = 11; - - _bidsReceived.forEach((bid) => { - bid.adUnitCode = '/19968336/header-bid-tag-0'; - }); - - auction.getBidsReceived = function() { return _bidsReceived }; - - const highestCpmBids = $$PREBID_GLOBAL$$.getHighestCpmBids('/19968336/header-bid-tag-0'); - expect(highestCpmBids[0]).to.deep.equal(auctionManager.getBidsReceived()[2]); + resetAuction(); }); }); From bf4e2d67d1df34c5077a27c4f031dea2032b7101 Mon Sep 17 00:00:00 2001 From: beth92 Date: Wed, 5 Sep 2018 14:40:46 -0400 Subject: [PATCH 70/83] Fix creativeId field in Yieldmo bid response (#3053) * Fix creativeId field in bid response We had an issue whereby prebid wasn't passing us yieldmo bids even though we could see them in the network requests. Turned out that the `creativeId` field was being set to `undefined` because the response body from the yieldmo server uses snake case, not camel case. Tested the proposed fix and saw prebid log the bid as expected. * Fix test --- modules/yieldmoBidAdapter.js | 2 +- test/spec/modules/yieldmoBidAdapter_spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/yieldmoBidAdapter.js b/modules/yieldmoBidAdapter.js index ad2aff7dec8..b747e40becd 100644 --- a/modules/yieldmoBidAdapter.js +++ b/modules/yieldmoBidAdapter.js @@ -111,7 +111,7 @@ function createNewBid(response) { cpm: response.cpm, width: response.width, height: response.height, - creativeId: response.creativeId, + creativeId: response.creative_id, currency: CURRENCY, netRevenue: NET_REVENUE, ttl: TIME_TO_LIVE, diff --git a/test/spec/modules/yieldmoBidAdapter_spec.js b/test/spec/modules/yieldmoBidAdapter_spec.js index 462b2715d24..45baecf9617 100644 --- a/test/spec/modules/yieldmoBidAdapter_spec.js +++ b/test/spec/modules/yieldmoBidAdapter_spec.js @@ -104,7 +104,7 @@ describe('YieldmoAdapter', function () { width: 300, height: 250, ad: '
', - creativeId: '9874652394875' + creative_id: '9874652394875' }], header: 'header?' }; From 0f401eefed245db91249758a3a7a8d9d41844607 Mon Sep 17 00:00:00 2001 From: kusapan Date: Fri, 7 Sep 2018 04:41:02 +0900 Subject: [PATCH 71/83] YIELDONE adapter - added UserSync (#3045) * added UserSync * added UserSync Unit Test --- modules/yieldoneBidAdapter.js | 9 +++++++++ modules/yieldoneBidAdapter.md | 12 ++++++++++++ test/spec/modules/yieldoneBidAdapter_spec.js | 16 ++++++++++++++++ 3 files changed, 37 insertions(+) diff --git a/modules/yieldoneBidAdapter.js b/modules/yieldoneBidAdapter.js index 9f94b5b815e..cdcab0c705a 100644 --- a/modules/yieldoneBidAdapter.js +++ b/modules/yieldoneBidAdapter.js @@ -4,6 +4,7 @@ import {registerBidder} from 'src/adapters/bidderFactory'; const BIDDER_CODE = 'yieldone'; const ENDPOINT_URL = '//y.one.impact-ad.jp/h_bid'; +const USER_SYNC_URL = '//y.one.impact-ad.jp/push_sync'; export const spec = { code: BIDDER_CODE, @@ -66,6 +67,14 @@ export const spec = { bidResponses.push(bidResponse); } return bidResponses; + }, + getUserSyncs: function(syncOptions) { + if (syncOptions.iframeEnabled) { + return [{ + type: 'iframe', + url: USER_SYNC_URL + }]; + } } } registerBidder(spec); diff --git a/modules/yieldoneBidAdapter.md b/modules/yieldoneBidAdapter.md index b5d96f822b5..b154a2ee781 100644 --- a/modules/yieldoneBidAdapter.md +++ b/modules/yieldoneBidAdapter.md @@ -25,3 +25,15 @@ THE YIELDONE adapter requires setup and approval from the YIELDONE team. Please }] }]; ``` + +### Configuration + +YIELDONE recommends the UserSync configuration below. Without it, the YIELDONE adapter will not able to perform user syncs, which lowers match rate and reduces monetization. + +```javascript +pbjs.setConfig({ + userSync: { + iframeEnabled: true, + enabledBidders: ['yieldone'] + }}); +``` diff --git a/test/spec/modules/yieldoneBidAdapter_spec.js b/test/spec/modules/yieldoneBidAdapter_spec.js index ca4f1fb8dec..b717ef52709 100644 --- a/test/spec/modules/yieldoneBidAdapter_spec.js +++ b/test/spec/modules/yieldoneBidAdapter_spec.js @@ -144,4 +144,20 @@ describe('yieldoneBidAdapter', function() { expect(result.length).to.equal(0); }); }); + + describe('getUserSyncs', function () { + const userSyncUrl = '//y.one.impact-ad.jp/push_sync'; + + it('handles empty sync options', function () { + expect(spec.getUserSyncs({})).to.be.empty; + }); + + it('should return a sync url if iframe syncs are enabled', function () { + expect(spec.getUserSyncs({ + 'iframeEnabled': true + })).to.deep.equal([{ + type: 'iframe', url: userSyncUrl + }]); + }); + }); }); From 55669ac493ccced1196644defa3352ad8af80375 Mon Sep 17 00:00:00 2001 From: phtechno Date: Thu, 6 Sep 2018 21:52:29 +0200 Subject: [PATCH 72/83] Changes on AdSize + gdpr (#3035) * Changes on AdSize + gdpr - Primary adsize is now the prebid slot adsize - On bidder.params you can now overwrite the prebid slot size (Not primary size anymore) - gdpr string will be only attached if "gdprApplies=true" * Update yieldlabBidAdapter.js --- modules/yieldlabBidAdapter.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/modules/yieldlabBidAdapter.js b/modules/yieldlabBidAdapter.js index b62e6b827e5..32ed723a15a 100644 --- a/modules/yieldlabBidAdapter.js +++ b/modules/yieldlabBidAdapter.js @@ -13,7 +13,7 @@ export const spec = { supportedMediaTypes: [VIDEO, BANNER], isBidRequestValid: function (bid) { - if (bid && bid.params && bid.params.adslotId && bid.params.adSize) { + if (bid && bid.params && bid.params.adslotId && bid.params.supplyId) { return true } return false @@ -40,8 +40,10 @@ export const spec = { }) if (bidderRequest && bidderRequest.gdprConsent) { - query.consent = bidderRequest.gdprConsent.consentString query.gdpr = (typeof bidderRequest.gdprConsent.gdprApplies === 'boolean') ? bidderRequest.gdprConsent.gdprApplies : true + if (query.gdpr) { + query.consent = bidderRequest.gdprConsent.consentString + } } const adslots = adslotIds.join(',') @@ -73,23 +75,24 @@ export const spec = { }) if (matchedBid) { - const sizes = parseSize(bidRequest.params.adSize) + const primarysize = bidRequest.sizes.length === 2 && !utils.isArray(bidRequest.sizes[0]) ? bidRequest.sizes : bidRequest.sizes[0] + const customsize = bidRequest.params.adSize !== undefined ? parseSize(bidRequest.params.adSize) : primarysize const bidResponse = { requestId: bidRequest.bidId, cpm: matchedBid.price / 100, - width: sizes[0], - height: sizes[1], + width: primarysize[0], + height: primarysize[1], creativeId: '' + matchedBid.id, dealId: matchedBid.pid, currency: CURRENCY_CODE, netRevenue: false, ttl: BID_RESPONSE_TTL_SEC, referrer: '', - ad: `` + ad: `` } if (isVideo(bidRequest)) { bidResponse.mediaType = VIDEO - bidResponse.vastUrl = `${ENDPOINT}/d/${matchedBid.id}/${bidRequest.params.supplyId}/${sizes[0]}x${sizes[1]}?ts=${timestamp}` + bidResponse.vastUrl = `${ENDPOINT}/d/${matchedBid.id}/${bidRequest.params.supplyId}/${customsize[0]}x${customsize[1]}?ts=${timestamp}` } bidResponses.push(bidResponse) From d8743670c6e2b3cc6307d17a02be795359beea49 Mon Sep 17 00:00:00 2001 From: Ignat Khaylov Date: Thu, 6 Sep 2018 22:56:05 +0300 Subject: [PATCH 73/83] Fixed default values in bidResponse and added changes to the description (#3051) * Fixed default values in bidResponse and added changes to the description * Added unit test for default cpm and netRevenue, removed placementId from tests and description --- modules/betweenBidAdapter.js | 20 +++--- modules/betweenBidAdapter.md | 67 ++++++++++++++++++++- test/spec/modules/betweenBidAdapter_spec.js | 25 +++++++- 3 files changed, 101 insertions(+), 11 deletions(-) diff --git a/modules/betweenBidAdapter.js b/modules/betweenBidAdapter.js index 98140fe68e6..b0e487d0eef 100644 --- a/modules/betweenBidAdapter.js +++ b/modules/betweenBidAdapter.js @@ -69,13 +69,13 @@ export const spec = { for (var i = 0; i < serverResponse.body.length; i++) { let bidResponse = { requestId: serverResponse.body[i].bidid, - cpm: serverResponse.body[i].cpm || 123, - width: serverResponse.body[i].w || 200, - height: serverResponse.body[i].h || 400, - ttl: serverResponse.body[i].ttl || 120, - creativeId: serverResponse.body[i].creativeid || 123, + cpm: serverResponse.body[i].cpm || 0, + width: serverResponse.body[i].w, + height: serverResponse.body[i].h, + ttl: serverResponse.body[i].ttl, + creativeId: serverResponse.body[i].creativeid, currency: serverResponse.body[i].currency || 'RUB', - netRevenue: serverResponse.body[i].netRevenue || false, + netRevenue: serverResponse.body[i].netRevenue || true, ad: serverResponse.body[i].ad }; bidResponses.push(bidResponse); @@ -106,10 +106,14 @@ export const spec = { }); } */ + // syncs.push({ + // type: 'iframe', + // url: '//acdn.adnxs.com/ib/static/usersync/v3/async_usersync.html' + // }); syncs.push({ type: 'iframe', - url: '//acdn.adnxs.com/ib/static/usersync/v3/async_usersync.html' - }) + url: 'http://ads.betweendigital.com/sspmatch-iframe' + }); return syncs; } } diff --git a/modules/betweenBidAdapter.md b/modules/betweenBidAdapter.md index 4ecd07e60bc..426d0aa2ed7 100644 --- a/modules/betweenBidAdapter.md +++ b/modules/betweenBidAdapter.md @@ -12,7 +12,7 @@ About us : http://betweendigital.com # Test Parameters -``` +```javascript var adUnits = [ { code: 'test-div', @@ -28,4 +28,69 @@ About us : http://betweendigital.com ] } ]; +``` + +Where: + +* s - the section id +* code - the id of the iframe tag to which the ads will be rendered + +# Example page + +```html + + + + + + + + + + +

Prebid.js BetweenBidAdapter Test

+ + + ``` \ No newline at end of file diff --git a/test/spec/modules/betweenBidAdapter_spec.js b/test/spec/modules/betweenBidAdapter_spec.js index b1eea08a147..f2d770805c5 100644 --- a/test/spec/modules/betweenBidAdapter_spec.js +++ b/test/spec/modules/betweenBidAdapter_spec.js @@ -6,7 +6,6 @@ describe('betweenBidAdapterTests', function () { expect(spec.isBidRequestValid({ bidder: 'between', params: { - placementId: 'example', w: 240, h: 400, s: 1112 @@ -17,7 +16,7 @@ describe('betweenBidAdapterTests', function () { let bidRequestData = [{ bidId: 'bid1234', bidder: 'between', - params: {w: 240, h: 400, s: 1112, placementId: 'example'}, + params: {w: 240, h: 400, s: 1112}, sizes: [[240, 400]] }] let request = spec.buildRequests(bidRequestData); @@ -42,6 +41,28 @@ describe('betweenBidAdapterTests', function () { expect(bid.currency).to.equal('USD'); expect(bid.width).to.equal(240); expect(bid.height).to.equal(400); + expect(bid.netRevenue).to.equal(true); + expect(bid.requestId).to.equal('bid1234'); + expect(bid.ad).to.equal('Ad html'); + }); + it('validate_response_params', function () { + let serverResponse = { + body: [{ + bidid: 'bid1234', + w: 240, + h: 400, + currency: 'USD', + ad: 'Ad html' + }] + }; + let bids = spec.interpretResponse(serverResponse); + expect(bids).to.have.lengthOf(1); + let bid = bids[0]; + expect(bid.cpm).to.equal(0); + expect(bid.currency).to.equal('USD'); + expect(bid.width).to.equal(240); + expect(bid.height).to.equal(400); + expect(bid.netRevenue).to.equal(true); expect(bid.requestId).to.equal('bid1234'); expect(bid.ad).to.equal('Ad html'); }); From b1e784385a71b2efb974f6c8e80ae896a502c737 Mon Sep 17 00:00:00 2001 From: Matt Kendall <1870166+mkendall07@users.noreply.github.com> Date: Fri, 7 Sep 2018 13:03:37 -0400 Subject: [PATCH 74/83] PR review and ticket coordinater updates per PMC discussion (#3050) * updates per previous discussion * updates per review --- PR_REVIEW.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PR_REVIEW.md b/PR_REVIEW.md index 012a2d8b501..d5799472377 100644 --- a/PR_REVIEW.md +++ b/PR_REVIEW.md @@ -18,6 +18,7 @@ For modules and core platform updates, the initial reviewer should request an ad - Once there is 2 `LGTM` on the PR, merge to master - Ask the submitter to add a PR for documentation if applicable. - Add a line into the [draft release](https://github.com/prebid/Prebid.js/releases) notes for this submission. If no draft release is available, create one using [this template]( https://gist.github.com/mkendall07/c3af6f4691bed8a46738b3675cb5a479) +- Add the PR to the appropriate project board (I.E. 1.23.0 Release) for the week, [see](https://github.com/prebid/Prebid.js/projects) ### New Adapter or updates to adapter process - Follow steps above for general review process. In addition, please verify the following: @@ -39,9 +40,9 @@ For modules and core platform updates, the initial reviewer should request an ad ## Ticket Coordinator Each week, Prebid Org assigns one person to keep an eye on incoming issues and PRs. That person should: -- Review issues and PRs at least once per weekday for new items. +- Review issues and PRs at least once per weekday for new items. Encourage a 48 "SLA" on PRs/issues assigned. Aim for touchpoint once every 48/hours. - For PRs: assign PRs to individuals on the PR review list. Try to be equitable -- not all PRs are created equally. Use the "Assigned" field and add the "Needs Review" label. -- For Issues: try to address questions and troubleshooting requests on your own, assigning them to others as needed. +- For Issues: try to address questions and troubleshooting requests on your own, assigning them to others as needed. Please add labels as appropriate (I.E. bug, question, backlog etc). - Issues that are questions or troubleshooting requests may be closed if the originator doesn't respond within a week to requests for confirmation or details. - Issues that are bug reports should be left open and assigned to someone in PR rotation to confirm or deny the bug status. - It's polite to check with others before assigning them large tasks. From 6a3d62899f0aa4aa8032f492d9203e32c7cf5213 Mon Sep 17 00:00:00 2001 From: Tomas Roos Date: Mon, 10 Sep 2018 14:55:48 +0200 Subject: [PATCH 75/83] Ability to statically pass consentData (#2636) * Added static consentData to consentManagement config * Added test for static cmpApi * logError instead of logInfo --- modules/consentManagement.js | 24 +- test/spec/modules/consentManagement_spec.js | 411 +++++++++++++++++++- 2 files changed, 433 insertions(+), 2 deletions(-) diff --git a/modules/consentManagement.js b/modules/consentManagement.js index 0618a3f752c..1c8095b4dbd 100644 --- a/modules/consentManagement.js +++ b/modules/consentManagement.js @@ -17,14 +17,26 @@ const DEFAULT_ALLOW_AUCTION_WO_CONSENT = true; export let userCMP; export let consentTimeout; export let allowAuction; +export let staticConsentData; let consentData; // add new CMPs here, with their dedicated lookup function const cmpCallMap = { - 'iab': lookupIabConsent + 'iab': lookupIabConsent, + 'static': lookupStaticConsentData }; +/** + * This function reads the consent string from the config to obtain the consent information of the user. + * @param {function(string)} cmpSuccess acts as a success callback when the value is read from config; pass along consentObject (string) from CMP + * @param {function(string)} cmpError acts as an error callback while interacting with the config string; pass along an error message (string) + * @param {object} hookConfig contains module related variables (see comment in requestBidsHook function) + */ +function lookupStaticConsentData(cmpSuccess, cmpError, hookConfig) { + cmpSuccess(staticConsentData, hookConfig); +} + /** * This function handles interacting with an IAB compliant CMP to obtain the consent information of the user. * Given the async nature of the CMP's API, we pass in acting success/error callback functions to exit this function @@ -348,7 +360,17 @@ export function setConfig(config) { allowAuction = DEFAULT_ALLOW_AUCTION_WO_CONSENT; utils.logInfo(`consentManagement config did not specify allowAuctionWithoutConsent. Using system default setting (${DEFAULT_ALLOW_AUCTION_WO_CONSENT}).`); } + utils.logInfo('consentManagement module has been activated...'); + + if (userCMP === 'static') { + if (utils.isPlainObject(config.consentData)) { + staticConsentData = config.consentData; + consentTimeout = 0; + } else { + utils.logError(`consentManagement config with cmpApi: 'static' did not specify consentData. No consents will be available to adapters.`); + } + } $$PREBID_GLOBAL$$.requestBids.addHook(requestBidsHook, 50); } config.getConfig('consentManagement', config => setConfig(config.consentManagement)); diff --git a/test/spec/modules/consentManagement_spec.js b/test/spec/modules/consentManagement_spec.js index baa9a43f6aa..6af8c8a4478 100644 --- a/test/spec/modules/consentManagement_spec.js +++ b/test/spec/modules/consentManagement_spec.js @@ -1,4 +1,4 @@ -import {setConfig, requestBidsHook, resetConsentData, userCMP, consentTimeout, allowAuction} from 'modules/consentManagement'; +import {setConfig, requestBidsHook, resetConsentData, userCMP, consentTimeout, allowAuction, staticConsentData} from 'modules/consentManagement'; import {gdprDataHandler} from 'src/adaptermanager'; import * as utils from 'src/utils'; import { config } from 'src/config'; @@ -45,6 +45,415 @@ describe('consentManagement', function () { expect(allowAuction).to.be.false; }); }); + + describe('static consent string setConfig value', () => { + afterEach(() => { + config.resetConfig(); + $$PREBID_GLOBAL$$.requestBids.removeHook(requestBidsHook); + }); + it('results in user settings overriding system defaults', () => { + let staticConfig = { + cmpApi: 'static', + timeout: 7500, + allowAuctionWithoutConsent: false, + consentData: { + getConsentData: { + 'gdprApplies': true, + 'hasGlobalScope': false, + 'consentData': 'BOOgjO9OOgjO9APABAENAi-AAAAWd7_______9____7_9uz_Gv_r_ff_3nW0739P1A_r_Oz_rm_-zzV44_lpQQRCEA' + }, + getVendorConsents: { + 'metadata': 'BOOgjO9OOgjO9APABAENAi-AAAAWd7_______9____7_9uz_Gv_r_ff_3nW0739P1A_r_Oz_rm_-zzV44_lpQQRCEA', + 'gdprApplies': true, + 'hasGlobalScope': false, + 'isEU': true, + 'cookieVersion': 1, + 'created': '2018-05-29T07:45:48.522Z', + 'lastUpdated': '2018-05-29T07:45:48.522Z', + 'cmpId': 15, + 'cmpVersion': 1, + 'consentLanguage': 'EN', + 'vendorListVersion': 34, + 'maxVendorId': 359, + 'purposeConsents': { + '1': true, + '2': true, + '3': true, + '4': true, + '5': true + }, + 'vendorConsents': { + '1': true, + '2': true, + '3': true, + '4': true, + '5': false, + '6': true, + '7': true, + '8': true, + '9': true, + '10': true, + '11': true, + '12': true, + '13': true, + '14': true, + '15': true, + '16': true, + '17': true, + '18': true, + '19': true, + '20': true, + '21': true, + '22': true, + '23': true, + '24': true, + '25': true, + '26': true, + '27': true, + '28': true, + '29': true, + '30': true, + '31': true, + '32': true, + '33': true, + '34': true, + '35': true, + '36': true, + '37': true, + '38': true, + '39': true, + '40': true, + '41': true, + '42': true, + '43': true, + '44': true, + '45': true, + '46': true, + '47': true, + '48': true, + '49': true, + '50': true, + '51': true, + '52': true, + '53': true, + '54': false, + '55': true, + '56': true, + '57': true, + '58': true, + '59': true, + '60': true, + '61': true, + '62': true, + '63': true, + '64': true, + '65': true, + '66': true, + '67': true, + '68': true, + '69': true, + '70': true, + '71': true, + '72': true, + '73': true, + '74': true, + '75': true, + '76': true, + '77': true, + '78': true, + '79': true, + '80': true, + '81': true, + '82': true, + '83': false, + '84': true, + '85': true, + '86': true, + '87': true, + '88': true, + '89': true, + '90': true, + '91': true, + '92': true, + '93': true, + '94': true, + '95': true, + '96': false, + '97': true, + '98': true, + '99': false, + '100': true, + '101': true, + '102': true, + '103': false, + '104': true, + '105': true, + '106': false, + '107': false, + '108': true, + '109': true, + '110': true, + '111': true, + '112': true, + '113': true, + '114': true, + '115': true, + '116': false, + '117': false, + '118': false, + '119': true, + '120': true, + '121': false, + '122': true, + '123': false, + '124': true, + '125': true, + '126': true, + '127': true, + '128': true, + '129': true, + '130': true, + '131': true, + '132': true, + '133': true, + '134': true, + '135': false, + '136': true, + '137': false, + '138': true, + '139': true, + '140': true, + '141': true, + '142': true, + '143': true, + '144': true, + '145': true, + '146': false, + '147': true, + '148': true, + '149': true, + '150': true, + '151': true, + '152': false, + '153': true, + '154': true, + '155': true, + '156': true, + '157': true, + '158': true, + '159': true, + '160': true, + '161': true, + '162': true, + '163': true, + '164': true, + '165': true, + '166': false, + '167': true, + '168': true, + '169': true, + '170': true, + '171': false, + '172': false, + '173': true, + '174': true, + '175': true, + '176': false, + '177': true, + '178': false, + '179': true, + '180': true, + '181': false, + '182': true, + '183': true, + '184': false, + '185': true, + '186': false, + '187': false, + '188': true, + '189': true, + '190': true, + '191': false, + '192': true, + '193': true, + '194': true, + '195': true, + '196': false, + '197': true, + '198': true, + '199': true, + '200': true, + '201': true, + '202': true, + '203': true, + '204': false, + '205': true, + '206': false, + '207': false, + '208': true, + '209': true, + '210': true, + '211': true, + '212': true, + '213': true, + '214': false, + '215': true, + '216': false, + '217': true, + '218': false, + '219': false, + '220': false, + '221': false, + '222': false, + '223': false, + '224': true, + '225': true, + '226': true, + '227': true, + '228': true, + '229': true, + '230': true, + '231': false, + '232': true, + '233': false, + '234': true, + '235': true, + '236': true, + '237': true, + '238': true, + '239': true, + '240': true, + '241': true, + '242': false, + '243': false, + '244': true, + '245': true, + '246': true, + '247': false, + '248': true, + '249': true, + '250': false, + '251': false, + '252': true, + '253': true, + '254': true, + '255': true, + '256': true, + '257': true, + '258': true, + '259': true, + '260': true, + '261': false, + '262': true, + '263': false, + '264': true, + '265': true, + '266': true, + '267': false, + '268': false, + '269': true, + '270': true, + '271': false, + '272': true, + '273': true, + '274': true, + '275': true, + '276': true, + '277': true, + '278': true, + '279': true, + '280': true, + '281': true, + '282': true, + '283': false, + '284': true, + '285': true, + '286': false, + '287': false, + '288': true, + '289': true, + '290': true, + '291': true, + '292': false, + '293': false, + '294': true, + '295': true, + '296': false, + '297': true, + '298': false, + '299': true, + '300': false, + '301': true, + '302': true, + '303': true, + '304': true, + '305': false, + '306': false, + '307': false, + '308': true, + '309': true, + '310': true, + '311': false, + '312': false, + '313': false, + '314': true, + '315': true, + '316': true, + '317': true, + '318': true, + '319': true, + '320': true, + '321': false, + '322': false, + '323': true, + '324': false, + '325': true, + '326': true, + '327': false, + '328': true, + '329': false, + '330': false, + '331': true, + '332': false, + '333': true, + '334': false, + '335': false, + '336': false, + '337': false, + '338': false, + '339': true, + '340': false, + '341': false, + '342': false, + '343': false, + '344': false, + '345': true, + '346': false, + '347': false, + '348': false, + '349': true, + '350': false, + '351': false, + '352': false, + '353': false, + '354': true, + '355': false, + '356': false, + '357': false, + '358': false, + '359': true + } + } + } + }; + + setConfig(staticConfig); + expect(userCMP).to.be.equal('static'); + expect(consentTimeout).to.be.equal(0); // should always return without a timeout when config is used + expect(allowAuction).to.be.false; + expect(staticConsentData).to.be.equal(staticConfig.consentData); + }); + }); }); describe('requestBidsHook tests:', function () { From e368e0701c6a0352bea2f9c99804132068d6342f Mon Sep 17 00:00:00 2001 From: r-sato Date: Mon, 10 Sep 2018 22:36:57 +0900 Subject: [PATCH 76/83] Update dgadsBidAdapter (#3048) * Add dgads adapter * Add dgads adapter * Add spec file for dgads * Add spec file for dgads * Add dgads bid adapter * Add dgads bid adapter * fix * fix * fix email * remove semi-colon * Add mediaType native * Add import medaTypes * Change method to 'GET' and Change parameter name and Add get cookie. * fix camelcase * fix space * revert to normal function --- modules/dgadsBidAdapter.js | 21 ++++++++++++++++++--- test/spec/modules/dgadsBidAdapter_spec.js | 20 ++++++++++++++------ 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/modules/dgadsBidAdapter.js b/modules/dgadsBidAdapter.js index 7d47cc7acf6..0d6f00fe9a9 100644 --- a/modules/dgadsBidAdapter.js +++ b/modules/dgadsBidAdapter.js @@ -3,6 +3,7 @@ import * as utils from 'src/utils'; import { BANNER, NATIVE } from 'src/mediaTypes'; const BIDDER_CODE = 'dgads'; +const UID_NAME = 'dgads_uid'; const ENDPOINT = 'https://ads-tr.bigmining.com/ad/p/bid'; export const spec = { @@ -27,13 +28,15 @@ export const spec = { const params = bidRequest.params; const data = {}; - data['location_id'] = params.location_id; - data['site_id'] = params.site_id; + data['_loc'] = params.location_id; + data['_medium'] = params.site_id; data['transaction_id'] = bidRequest.transactionId; data['bid_id'] = bidRequest.bidId; + data['referer'] = utils.getTopWindowUrl(); + data['_uid'] = getCookieUid(UID_NAME); return { - method: 'POST', + method: 'GET', url: ENDPOINT, data, }; @@ -84,5 +87,17 @@ function setNativeResponse(ad) { nativeResponce.impressionTrackers = ad.impressionTrackers || []; return nativeResponce; } +export function getCookieUid(uidName) { + if (utils.cookiesAreEnabled()) { + let cookies = document.cookie.split(';'); + for (let i = 0; i < cookies.length; i++) { + let value = cookies[i].split('='); + if (value[0].indexOf(uidName) > -1) { + return value[1]; + } + } + } + return ''; +} registerBidder(spec); diff --git a/test/spec/modules/dgadsBidAdapter_spec.js b/test/spec/modules/dgadsBidAdapter_spec.js index 25f484678a0..2454885217d 100644 --- a/test/spec/modules/dgadsBidAdapter_spec.js +++ b/test/spec/modules/dgadsBidAdapter_spec.js @@ -1,11 +1,12 @@ import {expect} from 'chai'; import * as utils from 'src/utils'; -import {spec} from 'modules/dgadsBidAdapter'; +import {spec, getCookieUid} from 'modules/dgadsBidAdapter'; import {newBidder} from 'src/adapters/bidderFactory'; import { BANNER, NATIVE } from 'src/mediaTypes'; describe('dgadsBidAdapter', function () { const adapter = newBidder(spec); + const UID_NAME = 'dgads_uid'; const VALID_ENDPOINT = 'https://ads-tr.bigmining.com/ad/p/bid'; describe('inherited functions', function () { @@ -101,23 +102,30 @@ describe('dgadsBidAdapter', function () { const noBidRequests = []; expect(Object.keys(spec.buildRequests(noBidRequests)).length).to.equal(0); }); + it('getCookieUid return empty if cookie not found', function () { + expect(getCookieUid(UID_NAME)).to.equal(''); + }); const data = { location_id: '1', site_id: '1', transaction_id: 'c1f1eff6-23c6-4844-a321-575212939e37', - bid_id: '2db3101abaec66' + bid_id: '2db3101abaec66', + referer: utils.getTopWindowUrl(), + _uid: '' }; - it('sends bid request to VALID_ENDPOINT via POST', function () { + it('sends bid request to VALID_ENDPOINT via GET', function () { const request = spec.buildRequests(bidRequests)[0]; expect(request.url).to.equal(VALID_ENDPOINT); - expect(request.method).to.equal('POST'); + expect(request.method).to.equal('GET'); }); it('should attache params to the request', function () { const request = spec.buildRequests(bidRequests)[0]; - expect(request.data['location_id']).to.equal(data['location_id']); - expect(request.data['site_id']).to.equal(data['site_id']); + expect(request.data['_loc']).to.equal(data['location_id']); + expect(request.data['_medium']).to.equal(data['site_id']); expect(request.data['transaction_id']).to.equal(data['transaction_id']); expect(request.data['bid_id']).to.equal(data['bid_id']); + expect(request.data['referer']).to.equal(data['referer']); + expect(request.data['_uid']).to.equal(data['_uid']); }); }); From ebfbc54030bf05156102c54bbfdfc4dd392dee26 Mon Sep 17 00:00:00 2001 From: Zachary Lester Date: Tue, 11 Sep 2018 07:59:15 -0700 Subject: [PATCH 77/83] Fix #3059 by returning both hb_deal and hb_deal_${bidder_code} (#3062) * Fix #3059 by returning both hb_deal and hb_deal_${bidder_code} * Add unit test per @mkendall07 --- src/targeting.js | 13 ++++++++++--- test/spec/unit/core/targeting_spec.js | 15 ++++++++++++++- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/targeting.js b/src/targeting.js index d645a8ed20d..4bd3adbd9fc 100644 --- a/src/targeting.js +++ b/src/targeting.js @@ -259,9 +259,16 @@ export function newTargeting(auctionManager) { typeof winner.sendStandardTargeting === 'undefined' || winner.sendStandardTargeting || standardKeys.indexOf(key) === -1) - .map(key => ({ - [(key === 'hb_deal') ? `${key}_${winner.bidderCode}`.substring(0, MAX_DFP_KEYLENGTH) : key.substring(0, MAX_DFP_KEYLENGTH)]: [winner.adserverTargeting[key]] - })) + .reduce((acc, key) => { + const targetingValue = [winner.adserverTargeting[key]]; + const targeting = { [key.substring(0, MAX_DFP_KEYLENGTH)]: targetingValue }; + if (key === 'hb_deal') { + const bidderCodeTargetingKey = `${key}_${winner.bidderCode}`.substring(0, MAX_DFP_KEYLENGTH); + const bidderCodeTargeting = { [bidderCodeTargetingKey]: targetingValue }; + return [...acc, targeting, bidderCodeTargeting]; + } + return [...acc, targeting]; + }, []) }; }); diff --git a/test/spec/unit/core/targeting_spec.js b/test/spec/unit/core/targeting_spec.js index 2fdca462a35..a72992e099d 100644 --- a/test/spec/unit/core/targeting_spec.js +++ b/test/spec/unit/core/targeting_spec.js @@ -30,6 +30,7 @@ const bid1 = { 'hb_bidder': 'rubicon', 'hb_adid': '148018fe5e', 'hb_pb': '0.53', + 'hb_deal': '1234', 'foobar': '300x250' }, 'netRevenue': true, @@ -120,6 +121,18 @@ describe('targeting tests', function () { targetingModule.isBidNotExpired.restore(); }); + describe('when hb_deal is present in bid.adserverTargeting', function () { + it('returns targeting with both hb_deal and hb_deal_{bidder_code}', function () { + const targeting = targetingInstance.getAllTargeting(['/123456/header-bid-tag-0']); + + // We should add both keys rather than one or the other + expect(targeting['/123456/header-bid-tag-0']).to.contain.keys('hb_deal', `hb_deal_${bid1.bidderCode}`); + + // We should assign both keys the same value + expect(targeting['/123456/header-bid-tag-0']['hb_deal']).to.deep.equal(targeting['/123456/header-bid-tag-0'][`hb_deal_${bid1.bidderCode}`]); + }); + }); + it('selects the top bid when _sendAllBids true', function () { config.setConfig({ enableSendAllBids: true }); let targeting = targetingInstance.getAllTargeting(['/123456/header-bid-tag-0']); @@ -127,7 +140,7 @@ describe('targeting tests', function () { // we should only get the targeting data for the one requested adunit expect(Object.keys(targeting).length).to.equal(1); - let sendAllBidCpm = Object.keys(targeting['/123456/header-bid-tag-0']).filter(key => key.indexOf('hb_pb_') != -1) + let sendAllBidCpm = Object.keys(targeting['/123456/header-bid-tag-0']).filter(key => key.indexOf('hb_pb_') != -1); // we shouldn't get more than 1 key for hb_pb_${bidder} expect(sendAllBidCpm.length).to.equal(1); From f46fcc8d29f5c169f6489f64cb892c6c221b112a Mon Sep 17 00:00:00 2001 From: christopher-allene-piximedia Date: Tue, 11 Sep 2018 17:08:19 +0200 Subject: [PATCH 78/83] Add Piximedia adapter (#3063) * Add Piximedia adapter * Fix piximediaBidAdapter_spec.js style --- modules/piximediaBidAdapter.js | 46 ++++++++ modules/piximediaBidAdapter.md | 25 +++++ test/spec/modules/piximediaBidAdapter_spec.js | 102 ++++++++++++++++++ 3 files changed, 173 insertions(+) create mode 100644 modules/piximediaBidAdapter.js create mode 100644 modules/piximediaBidAdapter.md create mode 100644 test/spec/modules/piximediaBidAdapter_spec.js diff --git a/modules/piximediaBidAdapter.js b/modules/piximediaBidAdapter.js new file mode 100644 index 00000000000..bf894116d7b --- /dev/null +++ b/modules/piximediaBidAdapter.js @@ -0,0 +1,46 @@ +import * as utils from 'src/utils'; +import { registerBidder } from 'src/adapters/bidderFactory'; + +const BIDDER_CODE = 'piximedia'; +const ENDPOINT = '//ad.piximedia.com/prebid'; + +export const spec = { + code: BIDDER_CODE, + isBidRequestValid: function(bid) { + return !!(bid.params && bid.params.siteId && bid.params.placementId); + }, + buildRequests: function(validBidRequests) { + return validBidRequests.map(bidRequest => { + let parseSized = utils.parseSizesInput(bidRequest.sizes); + let arrSize = parseSized[0].split('x'); + return { + method: 'GET', + url: ENDPOINT, + data: { + timestamp: utils.timestamp(), + pver: '1.0', + pbparams: JSON.stringify(bidRequest.params), + pbwidth: arrSize[0], + pbheight: arrSize[1], + pbbidid: bidRequest.bidId, + }, + }; + }); + }, + interpretResponse: function(serverResponse, request) { + const res = serverResponse.body; + const bidResponse = { + requestId: res.bidId, + cpm: parseFloat(res.cpm), + width: res.width, + height: res.height, + creativeId: res.creative_id, + currency: res.currency, + netRevenue: true, + ttl: 300, + ad: res.adm + }; + return [bidResponse]; + } +} +registerBidder(spec); diff --git a/modules/piximediaBidAdapter.md b/modules/piximediaBidAdapter.md new file mode 100644 index 00000000000..fae014cbdff --- /dev/null +++ b/modules/piximediaBidAdapter.md @@ -0,0 +1,25 @@ +# Overview + +**Module Name**: Piximedia Bidder Adapter +**Module Type**: Bidder Adapter +**Maintainer**: contact@piximedia.fr + +# Description + +Piximedia Bidder Adapter for Prebid.js. + +# Test Parameters +``` + var adUnits = [{ + code: 'mpu', + sizes: [[300, 250]], + bids: [{ + bidder: 'piximedia', + params: { + siteId: 'PIXIMEDIA', + placementId: 'PREBID' + } + }] + }]; + +``` diff --git a/test/spec/modules/piximediaBidAdapter_spec.js b/test/spec/modules/piximediaBidAdapter_spec.js new file mode 100644 index 00000000000..02cf80c614f --- /dev/null +++ b/test/spec/modules/piximediaBidAdapter_spec.js @@ -0,0 +1,102 @@ +import { expect } from 'chai'; +import { spec } from 'modules/piximediaBidAdapter'; + +describe('piximediaAdapterTest', function() { + describe('bidRequestValidity', function() { + it('bidRequest with site ID and placement ID param', function() { + expect(spec.isBidRequestValid({ + bidder: 'piximedia', + params: { + 'siteId': 'PIXIMEDIA_PREBID10', + 'placementId': 'RG' + }, + })).to.equal(true); + }); + + it('bidRequest with no required params', function() { + expect(spec.isBidRequestValid({ + bidder: 'piximedia', + params: { + }, + })).to.equal(false); + }); + }); + + describe('bidRequest', function() { + const bidRequests = [{ + 'bidder': 'piximedia', + 'params': { + 'siteId': 'PIXIMEDIA_PREBID10', + 'placementId': 'RG' + }, + 'adUnitCode': 'div-gpt-ad-1460505748561-0', + 'transactionId': 'd7b773de-ceaa-484d-89ca-d9f51b8d61ec', + 'sizes': [300, 250], + 'bidId': '51ef8751f9aead', + 'bidderRequestId': '418b37f85e772c', + 'auctionId': '18fd8b8b0bd757' + }]; + + it('bidRequest HTTP method', function() { + const requests = spec.buildRequests(bidRequests); + requests.forEach(function(requestItem) { + expect(requestItem.method).to.equal('GET'); + }); + }); + + it('bidRequest data', function() { + const requests = spec.buildRequests(bidRequests); + expect(typeof requests[0].data.timestamp).to.equal('number'); + expect(requests[0].data.pver).to.equal('1.0'); + expect(requests[0].data.pbparams).to.equal(JSON.stringify(bidRequests[0].params)); + expect(requests[0].data.pbwidth).to.equal('300'); + expect(requests[0].data.pbheight).to.equal('250'); + expect(requests[0].data.pbbidid).to.equal('51ef8751f9aead'); + }); + }); + + describe('interpretResponse', function() { + const bidRequest = { + 'method': 'GET', + 'url': 'https://ad.piximedia.com/', + 'data': { + 'ver': 2, + 'hb': 1, + 'output': 'js', + 'pub': 267, + 'zone': 62546, + 'width': '300', + 'height': '250', + 'callback': 'json', + 'callback_uid': '51ef8751f9aead', + 'url': 'https://example.com', + 'cb': '', + } + }; + + const bidResponse = { + body: { + 'bidId': '51ef8751f9aead', + 'cpm': 4.2, + 'width': '300', + 'height': '250', + 'creative_id': '1234', + 'currency': 'EUR', + 'adm': '
', + }, + headers: {} + }; + + it('result is correct', function() { + const result = spec.interpretResponse(bidResponse, bidRequest); + expect(result[0].requestId).to.equal('51ef8751f9aead'); + expect(result[0].cpm).to.equal(4.2); + expect(result[0].width).to.equal('300'); + expect(result[0].height).to.equal('250'); + expect(result[0].creativeId).to.equal('1234'); + expect(result[0].currency).to.equal('EUR'); + expect(result[0].ttl).to.equal(300); + expect(result[0].ad).to.equal('
'); + }); + }); +}); From 640fa2ba89cc880b916e7fd38bd52f75b0f9d7b6 Mon Sep 17 00:00:00 2001 From: Vedant Seta Date: Wed, 12 Sep 2018 01:52:38 +0530 Subject: [PATCH 79/83] Media.net Adapter Improvements (#2954) * Media.net bid adapter: firing logs on 'bidWon' and 'onTimeout' events * Media.net Bid Adapter: removed use of prebid global to save page meta data --- modules/medianetBidAdapter.js | 77 +++++++++++++++++++- src/adaptermanager.js | 4 +- src/auction.js | 2 +- test/spec/modules/medianetBidAdapter_spec.js | 7 +- 4 files changed, 85 insertions(+), 5 deletions(-) diff --git a/modules/medianetBidAdapter.js b/modules/medianetBidAdapter.js index 07c721371bd..aee26f0ae3e 100644 --- a/modules/medianetBidAdapter.js +++ b/modules/medianetBidAdapter.js @@ -1,6 +1,7 @@ import { registerBidder } from 'src/adapters/bidderFactory'; import * as utils from 'src/utils'; import { config } from 'src/config'; +import * as url from 'src/url'; const BIDDER_CODE = 'medianet'; const BID_URL = '//prebid.media.net/rtb/prebid'; @@ -9,6 +10,13 @@ const SLOT_VISIBILITY = { ABOVE_THE_FOLD: 1, BELOW_THE_FOLD: 2 }; +const EVENTS = { + TIMEOUT_EVENT_NAME: 'client_timeout', + BID_WON_EVENT_NAME: 'client_bid_won' +}; +const EVENT_PIXEL_URL = 'qsearch-a.akamaihd.net/log'; + +let mnData = {}; $$PREBID_GLOBAL$$.medianetGlobals = {}; @@ -24,15 +32,20 @@ function siteDetails(site) { } function getPageMeta() { + if (mnData.pageMeta) { + return mnData.pageMeta; + } let canonicalUrl = getUrlFromSelector('link[rel="canonical"]', 'href'); let ogUrl = getUrlFromSelector('meta[property="og:url"]', 'content'); let twitterUrl = getUrlFromSelector('meta[name="twitter:url"]', 'content'); - return Object.assign({}, + mnData.pageMeta = Object.assign({}, canonicalUrl && { 'canonical_url': canonicalUrl }, ogUrl && { 'og_url': ogUrl }, twitterUrl && { 'twitter_url': twitterUrl } ); + + return mnData.pageMeta; } function getUrlFromSelector(selector, attribute) { @@ -218,6 +231,39 @@ function fetchCookieSyncUrls(response) { return []; } +function getLoggingData(event, data) { + data = (utils.isArray(data) && data) || []; + + let params = {}; + params.logid = 'kfk'; + params.evtid = 'projectevents'; + params.project = 'prebid'; + params.acid = utils.deepAccess(data, '0.auctionId') || ''; + params.cid = $$PREBID_GLOBAL$$.medianetGlobals.cid || ''; + params.crid = data.map((adunit) => utils.deepAccess(adunit, 'params.0.crid') || adunit.adUnitCode).join('|'); + params.adunit_count = data.length || 0; + params.dn = utils.getTopWindowLocation().host || ''; + params.requrl = utils.getTopWindowUrl() || ''; + params.event = event.name || ''; + params.value = event.value || ''; + params.rd = event.related_data || ''; + + return params; +} + +function logEvent (event, data) { + let getParams = { + protocol: 'https', + hostname: EVENT_PIXEL_URL, + search: getLoggingData(event, data) + }; + utils.triggerPixel(url.format(getParams)); +} + +function clearMnData() { + mnData = {}; +} + export const spec = { code: BIDDER_CODE, @@ -296,6 +342,35 @@ export const spec = { } }, + /** + * @param {TimedOutBid} timeoutData + */ + onTimeout: (timeoutData) => { + try { + let eventData = { + name: EVENTS.TIMEOUT_EVENT_NAME, + value: timeoutData.length, + related_data: timeoutData[0].timeout || config.getConfig('bidderTimeout') + }; + logEvent(eventData, timeoutData); + } catch (e) {} + }, + + /** + * @param {TimedOutBid} timeoutData + */ + onBidWon: (bid) => { + try { + let eventData = { + name: EVENTS.BID_WON_EVENT_NAME, + value: bid.cpm + }; + logEvent(eventData, [bid]); + } catch (e) {} + }, + + clearMnData, + getWindowSize, }; registerBidder(spec); diff --git a/src/adaptermanager.js b/src/adaptermanager.js index 009ba18347b..8dd750b916a 100644 --- a/src/adaptermanager.js +++ b/src/adaptermanager.js @@ -521,6 +521,8 @@ exports.callTimedOutBidders = function(adUnits, timedOutBidders, cbTimeout) { }); } -exports.callBidWonBidder = function(bidder, bid) { +exports.callBidWonBidder = function(bidder, bid, adUnits) { + // Adding user configured params to bidWon event data + bid.params = utils.getUserConfiguredParams(adUnits, bid.adUnitCode, bid.bidder); tryCallBidderMethod(bidder, 'onBidWon', bid); }; diff --git a/src/auction.js b/src/auction.js index e2db713dd93..fd46c5fec16 100644 --- a/src/auction.js +++ b/src/auction.js @@ -281,7 +281,7 @@ export function newAuction({adUnits, adUnitCodes, callback, cbTimeout, labels}) function addWinningBid(winningBid) { _winningBids = _winningBids.concat(winningBid); - adaptermanager.callBidWonBidder(winningBid.bidder, winningBid); + adaptermanager.callBidWonBidder(winningBid.bidder, winningBid, adUnits); } return { diff --git a/test/spec/modules/medianetBidAdapter_spec.js b/test/spec/modules/medianetBidAdapter_spec.js index bb55ed99e02..331b36b3217 100644 --- a/test/spec/modules/medianetBidAdapter_spec.js +++ b/test/spec/modules/medianetBidAdapter_spec.js @@ -562,8 +562,11 @@ describe('Media.net bid adapter', function () { expect(JSON.parse(bidReq.data)).to.deep.equal(VALID_PAYLOAD_FOR_GDPR); }); - describe('build requests: when page meta-data is available', function () { - it('should pass canonical, twitter and fb paramters if available', function () { + describe('build requests: when page meta-data is available', () => { + beforeEach(() => { + spec.clearMnData(); + }); + it('should pass canonical, twitter and fb paramters if available', () => { let documentStub = sandbox.stub(window.top.document, 'querySelector'); documentStub.withArgs('link[rel="canonical"]').returns({ href: 'http://localhost:9999/canonical-test' From db694a074a4a2699566310aba4489b3cf6ede334 Mon Sep 17 00:00:00 2001 From: florevallatmrf <32760132+florevallatmrf@users.noreply.github.com> Date: Tue, 11 Sep 2018 23:13:58 +0200 Subject: [PATCH 80/83] Fix the secure creative resizing (#3066) * Fix the secure creative resize * do not use template litterals --- src/secureCreatives.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/secureCreatives.js b/src/secureCreatives.js index cd289cf657f..1038afdf46a 100644 --- a/src/secureCreatives.js +++ b/src/secureCreatives.js @@ -72,8 +72,8 @@ function resizeRemoteCreative({ adUnitCode, width, height }) { // resize both container div + iframe ['div', 'iframe'].forEach(elmType => { let elementStyle = getElementByAdUnit(elmType).style; - elementStyle.width = width; - elementStyle.height = height; + elementStyle.width = width + 'px'; + elementStyle.height = height + 'px'; }); function getElementByAdUnit(elmType) { return document.getElementById(find(window.googletag.pubads().getSlots().filter(isSlotMatchingAdUnitCode(adUnitCode)), slot => slot) From 73e9ef15d298ce687f7e5593bfd03a53f61f7288 Mon Sep 17 00:00:00 2001 From: Jeremy Blencowe Date: Tue, 11 Sep 2018 14:14:51 -0700 Subject: [PATCH 81/83] AOL adapter - add defaults for currency and creative ID until fix issued server-side (#3068) * Add AOL defaults for currency and creative ID until fix issued server-side * Satisfy linter single quotes --- modules/aolBidAdapter.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/aolBidAdapter.js b/modules/aolBidAdapter.js index 28e8cb0b46e..3d89007bbc2 100644 --- a/modules/aolBidAdapter.js +++ b/modules/aolBidAdapter.js @@ -387,9 +387,9 @@ export const spec = { cpm: cpm, width: bidData.w, height: bidData.h, - creativeId: bidData.crid, + creativeId: bidData.crid || 0, pubapiId: response.id, - currency: response.cur, + currency: response.cur || 'USD', dealId: bidData.dealid, netRevenue: true, ttl: bidRequest.ttl From f272031f1fc5f44c08ac7e0ebee5e47bf973dbe9 Mon Sep 17 00:00:00 2001 From: Jaimin Panchal Date: Tue, 11 Sep 2018 17:33:48 -0400 Subject: [PATCH 82/83] Fix for early auction close with video + done cb cleanup (#3024) * done cb cleanup * rename some vars * added unit tests, updates after changes requested * add deprecated notice to function --- modules/prebidServerBidAdapter/index.js | 8 +- src/adaptermanager.js | 6 +- src/adapters/bidderFactory.js | 16 +--- src/auction.js | 114 +++++++++++++++--------- src/utils.js | 9 ++ src/video.js | 2 +- test/spec/auctionmanager_spec.js | 90 ++++++++++++++++--- 7 files changed, 161 insertions(+), 84 deletions(-) diff --git a/modules/prebidServerBidAdapter/index.js b/modules/prebidServerBidAdapter/index.js index 47c1bfa80db..f94cfeecec9 100644 --- a/modules/prebidServerBidAdapter/index.js +++ b/modules/prebidServerBidAdapter/index.js @@ -630,13 +630,7 @@ export function PrebidServer() { utils.logError('error parsing response: ', result.status); } - const videoBid = bids.some(bidResponse => bidResponse.bid.mediaType === 'video'); - const cacheEnabled = config.getConfig('cache.url'); - - // video bids with cache enabled need to be cached first before they are considered done - if (!(videoBid && cacheEnabled)) { - done(); - } + done(); doClientSideSyncs(requestedBidders); } diff --git a/src/adaptermanager.js b/src/adaptermanager.js index 8dd750b916a..5b05578d303 100644 --- a/src/adaptermanager.js +++ b/src/adaptermanager.js @@ -335,8 +335,7 @@ exports.callBids = (adUnits, bidRequests, addBidResponse, doneCb, requestCallbac if (s2sBidRequest.ad_units.length) { let doneCbs = serverBidRequests.map(bidRequest => { bidRequest.start = timestamp(); - bidRequest.doneCbCallCount = 0; - return doneCb(bidRequest.bidderRequestId) + return doneCb; }); // only log adapters that actually have adUnit bids @@ -372,12 +371,11 @@ exports.callBids = (adUnits, bidRequests, addBidResponse, doneCb, requestCallbac utils.logMessage(`CALLING BIDDER ======= ${bidRequest.bidderCode}`); events.emit(CONSTANTS.EVENTS.BID_REQUESTED, bidRequest); bidRequest.doneCbCallCount = 0; - let done = doneCb(bidRequest.bidderRequestId); let ajax = ajaxBuilder(requestBidsTimeout, requestCallbacks ? { request: requestCallbacks.request.bind(null, bidRequest.bidderCode), done: requestCallbacks.done } : undefined); - adapter.callBids(bidRequest, addBidResponse, done, ajax); + adapter.callBids(bidRequest, addBidResponse, doneCb, ajax); }); } diff --git a/src/adapters/bidderFactory.js b/src/adapters/bidderFactory.js index b7574f24c08..d5ccf57e394 100644 --- a/src/adapters/bidderFactory.js +++ b/src/adapters/bidderFactory.js @@ -177,22 +177,8 @@ export function newBidder(spec) { // register any required usersync pixels. const responses = []; function afterAllResponses(bids) { - const bidsArray = bids ? (bids[0] ? bids : [bids]) : []; - - const videoBid = bidsArray.some(bid => bid.mediaType === 'video'); - const cacheEnabled = config.getConfig('cache.url'); - - // video bids with cache enabled need to be cached first before they are considered done - if (!(videoBid && cacheEnabled)) { - done(); - } - - // TODO: the code above needs to be refactored. We should always call done when we're done. if the auction - // needs to do cleanup before _it_ can be done it should handle that itself in the auction. It should _not_ - // require us, the bidders, to conditionally call done. That makes the whole done API very flaky. - // As soon as that is refactored, we can move this emit event where it should be, within the done function. + done(); events.emit(CONSTANTS.EVENTS.BIDDER_DONE, bidderRequest); - registerSyncs(responses, bidderRequest.gdprConsent); } diff --git a/src/auction.js b/src/auction.js index fd46c5fec16..280f3209b3a 100644 --- a/src/auction.js +++ b/src/auction.js @@ -48,7 +48,7 @@ * @property {function(): void} callBids - sends requests to all adapters for bids */ -import { uniques, flatten, timestamp, adUnitsFilter, delayExecution, getBidderRequest } from './utils'; +import { uniques, flatten, timestamp, adUnitsFilter, getBidderRequest, deepAccess } from './utils'; import { getPriceBucketString } from './cpmBucketManager'; import { getNativeTargeting } from './native'; import { getCacheUrl, store } from './videoCache'; @@ -58,6 +58,7 @@ import { userSync } from 'src/userSync'; import { createHook } from 'src/hook'; import find from 'core-js/library/fn/array/find'; import includes from 'core-js/library/fn/array/includes'; +import { OUTSTREAM } from './video'; const { syncUsers } = userSync; const utils = require('./utils'); @@ -155,29 +156,21 @@ export function newAuction({adUnits, adUnitCodes, callback, cbTimeout, labels}) } } - function done(bidRequestId) { - const innerBidRequestId = bidRequestId; - return delayExecution(function() { - const request = find(_bidderRequests, (bidRequest) => { - return innerBidRequestId === bidRequest.bidderRequestId; - }); - - // this is done for cache-enabled video bids in tryAddVideoBid, after the cache is stored - request.doneCbCallCount += 1; - bidsBackAll(); - }, 1); + function auctionDone(bidderCount) { + let doneCalled = 0; + return function() { + doneCalled++; + if (doneCalled === bidderCount) { + closeAuction(); + } + } } - /** - * Execute bidBackHandler if all bidders have called done. - */ - function bidsBackAll() { - if (_bidderRequests.every((bidRequest) => bidRequest.doneCbCallCount >= 1)) { - // when all bidders have called done callback atleast once it means auction is complete - utils.logInfo(`Bids Received for Auction with id: ${_auctionId}`, _bidsReceived); - _auctionStatus = AUCTION_COMPLETED; - executeCallback(false, true); - } + function closeAuction() { + // when all bidders have called done callback atleast once it means auction is complete + utils.logInfo(`Bids Received for Auction with id: ${_auctionId}`, _bidsReceived); + _auctionStatus = AUCTION_COMPLETED; + executeCallback(false, true); } function callBids() { @@ -206,7 +199,11 @@ export function newAuction({adUnits, adUnitCodes, callback, cbTimeout, labels}) }; events.emit(CONSTANTS.EVENTS.AUCTION_INIT, auctionInit); - adaptermanager.callBids(_adUnits, bidRequests, addBidResponse.bind(this), done.bind(this), { + let callbacks = auctionCallbacks(auctionDone(bidRequests.length), this); + let boundObj = { + auctionAddBidResponse: callbacks.addBidResponse + } + adaptermanager.callBids(_adUnits, bidRequests, addBidResponse.bind(boundObj), callbacks.adapterDone, { request(source, origin) { increment(outstandingRequests, origin); increment(requests, source); @@ -288,7 +285,6 @@ export function newAuction({adUnits, adUnitCodes, callback, cbTimeout, labels}) addBidReceived, executeCallback, callBids, - bidsBackAll, addWinningBid, getWinningBids: () => _winningBids, getTimeout: () => _timeout, @@ -301,6 +297,50 @@ export function newAuction({adUnits, adUnitCodes, callback, cbTimeout, labels}) } } +export const addBidResponse = createHook('asyncSeries', function(adUnitCode, bid) { + this.auctionAddBidResponse(adUnitCode, bid); +}, 'addBidResponse'); + +export function auctionCallbacks(auctionDone, auctionInstance) { + let outstandingBidsAdded = 0; + let doneCalled = false; + + function afterBidAdded() { + outstandingBidsAdded--; + if (doneCalled && outstandingBidsAdded === 0) { + auctionDone() + } + } + + function addBidResponse(adUnitCode, bid) { + outstandingBidsAdded++; + let bidRequests = auctionInstance.getBidRequests(); + let auctionId = auctionInstance.getAuctionId(); + + let bidRequest = getBidderRequest(bidRequests, bid.bidderCode, adUnitCode); + let bidResponse = getPreparedBidForAuction({adUnitCode, bid, bidRequest, auctionId}); + + if (bidResponse.mediaType === 'video') { + tryAddVideoBid(auctionInstance, bidResponse, afterBidAdded); + } else { + addBidToAuction(auctionInstance, bidResponse); + afterBidAdded(); + } + } + + function adapterDone() { + doneCalled = true; + if ((outstandingBidsAdded === 0)) { + auctionDone(); + } + } + + return { + addBidResponse, + adapterDone + } +} + function doCallbacksIfTimedout(auctionInstance, bidResponse) { if (bidResponse.timeToRespond > auctionInstance.getTimeout() + config.getConfig('timeoutBuffer')) { auctionInstance.executeCallback(true); @@ -316,9 +356,11 @@ function addBidToAuction(auctionInstance, bidResponse) { } // Video bids may fail if the cache is down, or there's trouble on the network. -function tryAddVideoBid(auctionInstance, bidResponse, bidRequest) { +function tryAddVideoBid(auctionInstance, bidResponse, afterBidAdded) { let addBid = true; - if (config.getConfig('cache.url')) { + const context = deepAccess(bidResponse, 'context'); + + if (config.getConfig('cache.url') && context !== OUTSTREAM) { if (!bidResponse.videoCacheKey) { addBid = false; store([bidResponse], function (error, cacheIds) { @@ -331,10 +373,8 @@ function tryAddVideoBid(auctionInstance, bidResponse, bidRequest) { if (!bidResponse.vastUrl) { bidResponse.vastUrl = getCacheUrl(bidResponse.videoCacheKey); } - // only set this prop after the bid has been cached to avoid early ending auction early in bidsBackAll - bidRequest.doneCbCallCount += 1; addBidToAuction(auctionInstance, bidResponse); - auctionInstance.bidsBackAll(); + afterBidAdded(); } }); } else if (!bidResponse.vastUrl) { @@ -344,24 +384,10 @@ function tryAddVideoBid(auctionInstance, bidResponse, bidRequest) { } if (addBid) { addBidToAuction(auctionInstance, bidResponse); + afterBidAdded(); } } -export const addBidResponse = createHook('asyncSeries', function(adUnitCode, bid) { - let auctionInstance = this; - let bidRequests = auctionInstance.getBidRequests(); - let auctionId = auctionInstance.getAuctionId(); - - let bidRequest = getBidderRequest(bidRequests, bid.bidderCode, adUnitCode); - let bidResponse = getPreparedBidForAuction({adUnitCode, bid, bidRequest, auctionId}); - - if (bidResponse.mediaType === 'video') { - tryAddVideoBid(auctionInstance, bidResponse, bidRequest); - } else { - addBidToAuction(auctionInstance, bidResponse); - } -}, 'addBidResponse'); - // Postprocess the bids so that all the universal properties exist, no matter which bidder they came from. // This should be called before addBidToAuction(). function getPreparedBidForAuction({adUnitCode, bid, bidRequest, auctionId}) { diff --git a/src/utils.js b/src/utils.js index db50745ebcc..77dfe10c918 100644 --- a/src/utils.js +++ b/src/utils.js @@ -189,6 +189,9 @@ export function parseGPTSingleSizeArray(singleSize) { } }; +/** + * @deprecated This function will be removed soon + */ exports.getTopWindowLocation = function() { if (exports.inIframe()) { let loc; @@ -202,6 +205,9 @@ exports.getTopWindowLocation = function() { return exports.getWindowLocation(); } +/** + * @deprecated This function will be removed soon + */ exports.getTopFrameReferrer = function () { try { // force an exception in x-domain environments. #1509 @@ -221,6 +227,9 @@ exports.getTopFrameReferrer = function () { } }; +/** + * @deprecated This function will be removed soon + */ exports.getAncestorOrigins = function () { if (window.document.location && window.document.location.ancestorOrigins && window.document.location.ancestorOrigins.length >= 1) { diff --git a/src/video.js b/src/video.js index 8e0775a6d62..b0d03ab6377 100644 --- a/src/video.js +++ b/src/video.js @@ -4,7 +4,7 @@ import { config } from '../src/config'; import includes from 'core-js/library/fn/array/includes'; const VIDEO_MEDIA_TYPE = 'video'; -const OUTSTREAM = 'outstream'; +export const OUTSTREAM = 'outstream'; /** * Helper functions for working with video-enabled adUnits diff --git a/test/spec/auctionmanager_spec.js b/test/spec/auctionmanager_spec.js index 0562479ca24..fae85310a38 100644 --- a/test/spec/auctionmanager_spec.js +++ b/test/spec/auctionmanager_spec.js @@ -1,5 +1,5 @@ import { auctionManager, newAuctionManager } from 'src/auctionManager'; -import { getKeyValueTargetingPairs } from 'src/auction'; +import { getKeyValueTargetingPairs, auctionCallbacks } from 'src/auction'; import CONSTANTS from 'src/constants.json'; import { adjustBids } from 'src/auction'; import * as auctionModule from 'src/auction'; @@ -44,7 +44,8 @@ function mockBid(opts) { 'creativeId': 'id', 'currency': 'USD', 'netRevenue': true, - 'ttl': 360 + 'ttl': 360, + getSize: () => '300x250' }; } @@ -54,6 +55,12 @@ function mockBidRequest(bid, opts) { } let bidderCode = opts && opts.bidderCode; let adUnitCode = opts && opts.adUnitCode; + let defaultMediaType = { + banner: { + sizes: [[300, 250], [300, 600]] + } + } + let mediaType = (opts && opts.mediaType) ? opts.mediaType : defaultMediaType; let requestId = utils.getUniqueIdentifierStr(); @@ -71,7 +78,8 @@ function mockBidRequest(bid, opts) { 'sizes': [[300, 250], [300, 600]], 'bidId': bid.requestId, 'bidderRequestId': requestId, - 'auctionId': '20882439e3238c' + 'auctionId': '20882439e3238c', + 'mediaTypes': mediaType } ], 'auctionStart': 1505250713622, @@ -107,16 +115,6 @@ function mockAjaxBuilder() { } describe('auctionmanager.js', function () { - let xhr; - - before(function () { - xhr = sinon.useFakeXMLHttpRequest(); - }); - - after(function () { - xhr.restore(); - }); - describe('getKeyValueTargetingPairs', function () { const DEFAULT_BID = { cpm: 5.578, @@ -857,4 +855,70 @@ describe('auctionmanager.js', function () { store.store.restore(); }); }); + + describe('auctionCallbacks', function() { + let bids = TEST_BIDS; + let bidRequests; + let xhr; + let requests; + let doneSpy; + let auction = { + getBidRequests: () => bidRequests, + getAuctionId: () => '1', + addBidReceived: () => true, + getTimeout: () => 1000 + } + + beforeEach(() => { + doneSpy = sinon.spy(); + xhr = sinon.useFakeXMLHttpRequest(); + requests = []; + xhr.onCreate = (request) => requests.push(request); + config.setConfig({ + cache: { + url: 'https://prebid.adnxs.com/pbc/v1/cache' + } + }) + }); + + afterEach(() => { + doneSpy.reset(); + xhr.restore(); + config.resetConfig(); + }); + + it('should call auction done after bid is added to auction for mediaType banner', function () { + bidRequests = [ + mockBidRequest(bids[0]), + ]; + let cbs = auctionCallbacks(doneSpy, auction); + cbs.addBidResponse(ADUNIT_CODE, bids[0]); + cbs.adapterDone(); + assert.equal(doneSpy.callCount, 1); + }); + + it('should call auction done after prebid cache is complete for mediaType video', function() { + bids[0].mediaType = 'video'; + let opts = { + mediaType: { + video: { + context: 'instream', + playerSize: [640, 480], + }, + } + } + bidRequests = [ + mockBidRequest(bids[0], opts) + ] + + let cbs = auctionCallbacks(doneSpy, auction); + cbs.addBidResponse(ADUNIT_CODE, bids[0]); + assert.equal(doneSpy.callCount, 0); + const uuid = 'c488b101-af3e-4a99-b538-00423e5a3371'; + const responseBody = `{"responses":[{"uuid":"${uuid}"}]}`; + requests[0].respond(200, { 'Content-Type': 'application/json' }, responseBody); + cbs.adapterDone(); + assert.equal(doneSpy.callCount, 1); + }) + }); }); From 079e27fa412e622a12b9b670471a3b30f90542df Mon Sep 17 00:00:00 2001 From: Jaimin Panchal Date: Wed, 12 Sep 2018 10:00:04 -0400 Subject: [PATCH 83/83] Add referer detection module (#3067) * add referere detection module * dont log all errors on console * Update message * Add jsdoc --- modules/appnexusBidAdapter.js | 10 ++ src/adaptermanager.js | 10 +- src/refererDetection.js | 152 +++++++++++++++++++ test/spec/modules/appnexusBidAdapter_spec.js | 26 ++++ test/spec/refererDetection_spec.js | 80 ++++++++++ 5 files changed, 275 insertions(+), 3 deletions(-) create mode 100644 src/refererDetection.js create mode 100644 test/spec/refererDetection_spec.js diff --git a/modules/appnexusBidAdapter.js b/modules/appnexusBidAdapter.js index 7dac4b8b182..1bffb80975f 100644 --- a/modules/appnexusBidAdapter.js +++ b/modules/appnexusBidAdapter.js @@ -107,6 +107,16 @@ export const spec = { }; } + if (bidderRequest && bidderRequest.refererInfo) { + let refererinfo = { + rd_ref: bidderRequest.refererInfo.referer, + rd_top: bidderRequest.refererInfo.reachedTop, + rd_ifs: bidderRequest.refererInfo.numIframes, + rd_stk: bidderRequest.refererInfo.stack.join(',') + } + payload.referrer_detection = refererinfo; + } + const payloadString = JSON.stringify(payload); return { method: 'POST', diff --git a/src/adaptermanager.js b/src/adaptermanager.js index 5b05578d303..e851a9accc9 100644 --- a/src/adaptermanager.js +++ b/src/adaptermanager.js @@ -9,6 +9,7 @@ import { config, RANDOM } from 'src/config'; import includes from 'core-js/library/fn/array/includes'; import find from 'core-js/library/fn/array/find'; import { adunitCounter } from './adUnits'; +import { getRefererInfo } from './refererDetection'; var utils = require('./utils.js'); var CONSTANTS = require('./constants.json'); @@ -97,7 +98,7 @@ function getBids({bidderCode, auctionId, bidderRequestId, adUnits, labels}) { bidId: bid.bid_id || utils.getUniqueIdentifierStr(), bidderRequestId, auctionId, - bidRequestsCount: adunitCounter.getCounter(adUnit.code) + bidRequestsCount: adunitCounter.getCounter(adUnit.code), })); } return bids; @@ -165,6 +166,7 @@ exports.makeBidRequests = function(adUnits, auctionStart, auctionId, cbTimeout, if (config.getConfig('bidderSequence') === RANDOM) { bidderCodes = shuffle(bidderCodes); } + const refererInfo = getRefererInfo(); let clientBidderCodes = bidderCodes; let clientTestAdapters = []; @@ -195,7 +197,8 @@ exports.makeBidRequests = function(adUnits, auctionStart, auctionId, cbTimeout, bids: getBids({bidderCode, auctionId, bidderRequestId, 'adUnits': adUnitsS2SCopy, labels}), auctionStart: auctionStart, timeout: _s2sConfig.timeout, - src: CONSTANTS.S2S.SRC + src: CONSTANTS.S2S.SRC, + refererInfo }; if (bidderRequest.bids.length !== 0) { bidRequests.push(bidderRequest); @@ -228,7 +231,8 @@ exports.makeBidRequests = function(adUnits, auctionStart, auctionId, cbTimeout, bidderRequestId, bids: getBids({bidderCode, auctionId, bidderRequestId, 'adUnits': adUnitsClientCopy, labels}), auctionStart: auctionStart, - timeout: cbTimeout + timeout: cbTimeout, + refererInfo }; const adapter = _bidderRegistry[bidderCode]; if (!adapter) { diff --git a/src/refererDetection.js b/src/refererDetection.js new file mode 100644 index 00000000000..6292b65f92a --- /dev/null +++ b/src/refererDetection.js @@ -0,0 +1,152 @@ +import { logWarn } from './utils'; + +export function detectReferer(win) { + function getLevels() { + let levels = walkUpWindows(); + let ancestors = getAncestorOrigins(); + + if (ancestors) { + for (let i = 0, l = ancestors.length; i < l; i++) { + levels[i].ancestor = ancestors[i]; + } + } + return levels; + } + + function getAncestorOrigins() { + try { + if (!win.location.ancestorOrigins) { + return; + } + return win.location.ancestorOrigins; + } catch (e) { + // Ignore error + } + } + + function getPubUrlStack(levels) { + let stack = []; + let defUrl = null; + let encodedUrl = null; + let frameLocation = null; + let prevFrame = null; + let prevRef = null; + let ancestor = null; + let detectedRefererUrl = null; + + let i; + for (i = levels.length - 1; i >= 0; i--) { + try { + frameLocation = levels[i].location; + } catch (e) { + // Ignore error + } + + if (frameLocation) { + encodedUrl = encodeURIComponent(frameLocation); + stack.push(encodedUrl); + if (!detectedRefererUrl) { + detectedRefererUrl = encodedUrl; + } + } else if (i !== 0) { + prevFrame = levels[i - 1]; + try { + prevRef = prevFrame.referrer; + ancestor = prevFrame.ancestor; + } catch (e) { + // Ignore error + } + + if (prevRef) { + encodedUrl = encodeURIComponent(prevRef); + stack.push(encodedUrl); + if (!detectedRefererUrl) { + detectedRefererUrl = encodedUrl; + } + } else if (ancestor) { + encodedUrl = encodeURIComponent(ancestor); + stack.push(encodedUrl); + if (!detectedRefererUrl) { + detectedRefererUrl = encodedUrl; + } + } else { + stack.push(defUrl); + } + } else { + stack.push(defUrl); + } + } + return { + stack, + detectedRefererUrl + }; + } + + function walkUpWindows() { + let acc = []; + let currentWindow; + do { + try { + currentWindow = currentWindow ? currentWindow.parent : win; + try { + acc.push({ + referrer: currentWindow.document.referrer || null, + location: currentWindow.location.href || null, + isTop: (currentWindow == win.top) + }); + } catch (e) { + acc.push({ + referrer: null, + location: null, + isTop: (currentWindow == win.top) + }); + logWarn('Trying to access cross domain iframe. Continuing without referrer and location'); + } + } catch (e) { + acc.push({ + referrer: null, + location: null, + isTop: false + }); + return acc; + } + } while (currentWindow != win.top); + return acc; + } + + /** + * Referer info + * @typedef {Object} refererInfo + * @property {string} referer detected top url + * @property {boolean} reachedTop whether prebid was able to walk upto top window or not + * @property {number} numIframes number of iframes + * @property {string} stack comma separated urls of all origins + */ + + /** + * Get referer info + * @returns {refererInfo} + */ + function refererInfo() { + try { + let levels = getLevels(); + let numIframes = levels.length - 1; + let reachedTop = (levels[numIframes].location !== null || + (numIframes > 0 && levels[numIframes - 1].referrer !== null)); + let stackInfo = getPubUrlStack(levels); + + return { + referer: stackInfo.detectedRefererUrl, + reachedTop, + numIframes, + stack: stackInfo.stack, + }; + } catch (e) { + // Ignore error + } + } + + return refererInfo; +} + +export const getRefererInfo = detectReferer(window); diff --git a/test/spec/modules/appnexusBidAdapter_spec.js b/test/spec/modules/appnexusBidAdapter_spec.js index d9e21a95f78..66568781a84 100644 --- a/test/spec/modules/appnexusBidAdapter_spec.js +++ b/test/spec/modules/appnexusBidAdapter_spec.js @@ -370,6 +370,32 @@ describe('AppNexusAdapter', function () { lng: -75.3009142 }); }); + + it('should add referer info to payload', function () { + const bidRequest = Object.assign({}, bidRequests[0]) + const bidderRequest = { + refererInfo: { + referer: 'http%3A%2F%2Fexample.com%2Fpage.html', + reachedTop: true, + numIframes: 2, + stack: [ + 'http%3A%2F%2Fexample.com%2Fpage.html', + 'http%3A%2F%2Fexample.com%2Fiframe1.html', + 'http%3A%2F%2Fexample.com%2Fiframe2.html' + ] + } + } + const request = spec.buildRequests([bidRequest], bidderRequest); + const payload = JSON.parse(request.data); + + expect(payload.referrer_detection).to.exist; + expect(payload.referrer_detection).to.deep.equal({ + rd_ref: 'http%3A%2F%2Fexample.com%2Fpage.html', + rd_top: true, + rd_ifs: 2, + rd_stk: bidderRequest.refererInfo.stack.join(',') + }); + }); }) describe('interpretResponse', function () { diff --git a/test/spec/refererDetection_spec.js b/test/spec/refererDetection_spec.js new file mode 100644 index 00000000000..95a2d096389 --- /dev/null +++ b/test/spec/refererDetection_spec.js @@ -0,0 +1,80 @@ +import { detectReferer } from 'src/refererDetection'; +import { expect } from 'chai'; + +var mocks = { + createFakeWindow: function (referrer, href) { + return { + document: { + referrer: referrer + }, + location: { + href: href, + // TODO: add ancestorOrigins to increase test coverage + }, + parent: null, + top: null + }; + } +} + +describe('referer detection', () => { + it('should return referer details in nested friendly iframes', function() { + // Fake window object to test friendly iframes + // - Main page http://example.com/page.html + // - - Iframe1 http://example.com/iframe1.html + // - - - Iframe2 http://example.com/iframe2.html + let mockIframe2WinObject = mocks.createFakeWindow('http://example.com/iframe1.html', 'http://example.com/iframe2.html'); + let mockIframe1WinObject = mocks.createFakeWindow('http://example.com/page.html', 'http://example.com/iframe1.html'); + let mainWinObject = mocks.createFakeWindow('http://example.com/page.html', 'http://example.com/page.html'); + mockIframe2WinObject.parent = mockIframe1WinObject; + mockIframe2WinObject.top = mainWinObject; + mockIframe1WinObject.parent = mainWinObject; + mockIframe1WinObject.top = mainWinObject; + mainWinObject.top = mainWinObject; + + const getRefererInfo = detectReferer(mockIframe2WinObject); + let result = getRefererInfo(); + let expectedResult = { + referer: 'http%3A%2F%2Fexample.com%2Fpage.html', + reachedTop: true, + numIframes: 2, + stack: [ + 'http%3A%2F%2Fexample.com%2Fpage.html', + 'http%3A%2F%2Fexample.com%2Fiframe1.html', + 'http%3A%2F%2Fexample.com%2Fiframe2.html' + ] + }; + expect(result).to.deep.equal(expectedResult); + }); + + it('should return referer details in nested cross domain iframes', function() { + // Fake window object to test cross domain iframes. + // - Main page http://example.com/page.html + // - - Iframe1 http://aaa.com/iframe1.html + // - - - Iframe2 http://bbb.com/iframe2.html + let mockIframe2WinObject = mocks.createFakeWindow('http://aaa.com/iframe1.html', 'http://bbb.com/iframe2.html'); + // Sinon cannot throw exception when accessing a propery so passing null to create cross domain + // environment for refererDetection module + let mockIframe1WinObject = mocks.createFakeWindow(null, null); + let mainWinObject = mocks.createFakeWindow(null, null); + mockIframe2WinObject.parent = mockIframe1WinObject; + mockIframe2WinObject.top = mainWinObject; + mockIframe1WinObject.parent = mainWinObject; + mockIframe1WinObject.top = mainWinObject; + mainWinObject.top = mainWinObject; + + const getRefererInfo = detectReferer(mockIframe2WinObject); + let result = getRefererInfo(); + let expectedResult = { + referer: 'http%3A%2F%2Faaa.com%2Fiframe1.html', + reachedTop: false, + numIframes: 2, + stack: [ + null, + 'http%3A%2F%2Faaa.com%2Fiframe1.html', + 'http%3A%2F%2Fbbb.com%2Fiframe2.html' + ] + }; + expect(result).to.deep.equal(expectedResult); + }); +});