prebid.js 7.22.0 → 7.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/33acrossBidAdapter.js +1 -1
- package/dist/aaxBlockmeterRtdProvider.js +1 -0
- package/dist/adagioBidAdapter.js +1 -1
- package/dist/adbookpspBidAdapter.js +1 -1
- package/dist/adgenerationBidAdapter.js +1 -1
- package/dist/admaticBidAdapter.js +1 -0
- package/dist/adrelevantisBidAdapter.js +1 -1
- package/dist/adtrgtmeBidAdapter.js +1 -1
- package/dist/adxcgBidAdapter.js +1 -1
- package/dist/adyoulikeBidAdapter.js +1 -1
- package/dist/ajaBidAdapter.js +1 -1
- package/dist/amxBidAdapter.js +1 -1
- package/dist/amxIdSystem.js +1 -1
- package/dist/analyticsAdapter.js +1 -1
- package/dist/appierAnalyticsAdapter.js +1 -1
- package/dist/appnexusBidAdapter.js +1 -1
- package/dist/asoBidAdapter.js +1 -1
- package/dist/audiencerunBidAdapter.js +1 -1
- package/dist/axonixBidAdapter.js +1 -1
- package/dist/bidViewability.js +1 -1
- package/dist/bidViewabilityIO.js +1 -1
- package/dist/bidglassBidAdapter.js +1 -1
- package/dist/big-richmediaBidAdapter.js +1 -1
- package/dist/bluebillywigBidAdapter.js +1 -1
- package/dist/bridgewellBidAdapter.js +1 -1
- package/dist/brightMountainMediaBidAdapter.js +1 -1
- package/dist/browsiRtdProvider.js +1 -1
- package/dist/carodaBidAdapter.js +1 -1
- package/dist/chtnwBidAdapter.js +1 -0
- package/dist/cleanioRtdProvider.js +1 -1
- package/dist/concertBidAdapter.js +1 -1
- package/dist/connectIdSystem.js +1 -1
- package/dist/connectadBidAdapter.js +1 -1
- package/dist/consentManagement.js +1 -1
- package/dist/consentManagementUsp.js +1 -1
- package/dist/consumableBidAdapter.js +1 -1
- package/dist/conversantBidAdapter.js +1 -1
- package/dist/craftBidAdapter.js +1 -1
- package/dist/criteoBidAdapter.js +1 -1
- package/dist/currency.js +1 -1
- package/dist/dependencies.json +19 -0
- package/dist/dfpAdServerVideo.js +1 -1
- package/dist/dgkeywordRtdProvider.js +1 -1
- package/dist/dspxBidAdapter.js +1 -1
- package/dist/eplanningBidAdapter.js +1 -1
- package/dist/finativeBidAdapter.js +1 -1
- package/dist/gdprEnforcement.js +1 -1
- package/dist/glimpseBidAdapter.js +1 -1
- package/dist/gmosspBidAdapter.js +1 -1
- package/dist/goldbachBidAdapter.js +1 -1
- package/dist/googleAnalyticsAdapter.js +1 -1
- package/dist/gridBidAdapter.js +1 -1
- package/dist/gridNMBidAdapter.js +1 -1
- package/dist/growthCodeIdSystem.js +1 -1
- package/dist/gumgumBidAdapter.js +1 -1
- package/dist/h12mediaBidAdapter.js +1 -1
- package/dist/id5AnalyticsAdapter.js +1 -1
- package/dist/id5IdSystem.js +1 -1
- package/dist/impactifyBidAdapter.js +1 -1
- package/dist/improvedigitalBidAdapter.js +1 -1
- package/dist/inmarBidAdapter.js +1 -1
- package/dist/insticatorBidAdapter.js +1 -1
- package/dist/instreamTracking.js +1 -1
- package/dist/ixBidAdapter.js +1 -1
- package/dist/jixieBidAdapter.js +1 -1
- package/dist/justpremiumBidAdapter.js +1 -1
- package/dist/jwplayerVideoProvider.js +1 -0
- package/dist/kargoBidAdapter.js +1 -1
- package/dist/konduitAnalyticsAdapter.js +1 -1
- package/dist/kueezBidAdapter.js +1 -1
- package/dist/kueezRtbBidAdapter.js +1 -0
- package/dist/lassoBidAdapter.js +1 -1
- package/dist/lifestreetBidAdapter.js +1 -1
- package/dist/liveyieldAnalyticsAdapter.js +1 -1
- package/dist/logicadBidAdapter.js +1 -1
- package/dist/loglyliftBidAdapter.js +1 -1
- package/dist/magniteAnalyticsAdapter.js +1 -1
- package/dist/malltvAnalyticsAdapter.js +1 -1
- package/dist/marsmediaBidAdapter.js +1 -1
- package/dist/mediafuseBidAdapter.js +1 -1
- package/dist/mediakeysBidAdapter.js +1 -1
- package/dist/mediasquareBidAdapter.js +1 -1
- package/dist/mgidBidAdapter.js +1 -1
- package/dist/mgidRtdProvider.js +1 -0
- package/dist/minutemediaBidAdapter.js +1 -1
- package/dist/multibid.js +1 -1
- package/dist/not-for-prod/prebid.js +153 -141
- package/dist/oguryBidAdapter.js +1 -1
- package/dist/onetagBidAdapter.js +1 -1
- package/dist/ooloAnalyticsAdapter.js +1 -1
- package/dist/openxOrtbBidAdapter.js +1 -1
- package/dist/ortbConverter.js +1 -0
- package/dist/outbrainBidAdapter.js +1 -1
- package/dist/oxxionRtdProvider.js +1 -0
- package/dist/parrableIdSystem.js +1 -1
- package/dist/pbsExtensions.js +1 -0
- package/dist/permutiveRtdProvider.js +1 -1
- package/dist/pixfutureBidAdapter.js +1 -1
- package/dist/prebid-core.js +1 -1
- package/dist/prebidServerBidAdapter.js +1 -1
- package/dist/priceFloors.js +1 -1
- package/dist/pubCommonId.js +1 -1
- package/dist/publinkIdSystem.js +1 -1
- package/dist/pubmaticBidAdapter.js +1 -1
- package/dist/pubwiseAnalyticsAdapter.js +1 -1
- package/dist/pxyzBidAdapter.js +1 -1
- package/dist/quantcastBidAdapter.js +1 -1
- package/dist/readpeakBidAdapter.js +1 -1
- package/dist/relaidoBidAdapter.js +1 -1
- package/dist/rhythmoneBidAdapter.js +1 -1
- package/dist/riseBidAdapter.js +1 -1
- package/dist/rtdModule.js +1 -1
- package/dist/rubiconAnalyticsAdapter.js +1 -1
- package/dist/rubiconBidAdapter.js +1 -1
- package/dist/schain.js +1 -1
- package/dist/seedingAllianceBidAdapter.js +1 -1
- package/dist/seedtagBidAdapter.js +1 -1
- package/dist/sharethroughAnalyticsAdapter.js +1 -1
- package/dist/sharethroughBidAdapter.js +1 -1
- package/dist/shinezBidAdapter.js +1 -1
- package/dist/smaatoBidAdapter.js +1 -1
- package/dist/smartadserverBidAdapter.js +1 -1
- package/dist/smartxBidAdapter.js +1 -1
- package/dist/smilewantedBidAdapter.js +1 -1
- package/dist/sonobiBidAdapter.js +1 -1
- package/dist/sovrnAnalyticsAdapter.js +1 -1
- package/dist/sovrnBidAdapter.js +1 -1
- package/dist/spotxBidAdapter.js +1 -1
- package/dist/sspBCBidAdapter.js +1 -1
- package/dist/sublimeBidAdapter.js +1 -1
- package/dist/synacormediaBidAdapter.js +1 -1
- package/dist/targetVideoBidAdapter.js +1 -1
- package/dist/teadsBidAdapter.js +1 -1
- package/dist/teadsIdSystem.js +1 -1
- package/dist/trionBidAdapter.js +1 -1
- package/dist/tripleliftBidAdapter.js +1 -1
- package/dist/ttdBidAdapter.js +1 -1
- package/dist/ucfunnelAnalyticsAdapter.js +1 -1
- package/dist/underdogmediaBidAdapter.js +1 -1
- package/dist/undertoneBidAdapter.js +1 -1
- package/dist/userId.js +1 -1
- package/dist/vidazooBidAdapter.js +1 -1
- package/dist/video.js +1 -0
- package/dist/videoModule.js +1 -0
- package/dist/videobyteBidAdapter.js +1 -1
- package/dist/videojsVideoProvider.js +1 -0
- package/dist/visxBidAdapter.js +1 -1
- package/dist/vuukleBidAdapter.js +1 -1
- package/dist/widespaceBidAdapter.js +1 -1
- package/dist/winrBidAdapter.js +1 -1
- package/dist/yahoosspBidAdapter.js +1 -1
- package/dist/yieldmoBidAdapter.js +1 -1
- package/dist/yieldoneAnalyticsAdapter.js +1 -1
- package/integrationExamples/gpt/mgidRtdProvider_example.html +143 -0
- package/integrationExamples/videoModule/jwplayer/bidMarkedAsUsed.html +98 -0
- package/integrationExamples/videoModule/jwplayer/bidRequestScheduling.html +89 -0
- package/integrationExamples/videoModule/jwplayer/eventListeners.html +244 -0
- package/integrationExamples/videoModule/jwplayer/gamAdServerMediation.html +122 -0
- package/integrationExamples/videoModule/jwplayer/mediaMetadata.html +80 -0
- package/integrationExamples/videoModule/jwplayer/playlist.html +122 -0
- package/integrationExamples/videoModule/videojs/bidMarkedAsUsed.html +126 -0
- package/integrationExamples/videoModule/videojs/bidRequestScheduling.html +132 -0
- package/integrationExamples/videoModule/videojs/eventListeners.html +238 -0
- package/integrationExamples/videoModule/videojs/gamAdServerMediation.html +138 -0
- package/integrationExamples/videoModule/videojs/mediaMetadata.html +103 -0
- package/integrationExamples/videoModule/videojs/playlist.html +151 -0
- package/libraries/ortbConverter/README.md +378 -0
- package/libraries/ortbConverter/converter.js +135 -0
- package/libraries/ortbConverter/lib/composer.js +43 -0
- package/libraries/ortbConverter/lib/mergeProcessors.js +9 -0
- package/libraries/ortbConverter/lib/sizes.js +14 -0
- package/libraries/ortbConverter/processors/banner.js +40 -0
- package/libraries/ortbConverter/processors/default.js +167 -0
- package/libraries/ortbConverter/processors/mediaType.js +21 -0
- package/libraries/ortbConverter/processors/native.js +37 -0
- package/libraries/ortbConverter/processors/video.js +66 -0
- package/libraries/pbsExtensions/pbsExtensions.js +12 -0
- package/libraries/pbsExtensions/processors/aliases.js +17 -0
- package/libraries/pbsExtensions/processors/mediaType.js +23 -0
- package/libraries/pbsExtensions/processors/params.js +22 -0
- package/libraries/pbsExtensions/processors/pbs.js +99 -0
- package/libraries/pbsExtensions/processors/requestExtPrebid.js +30 -0
- package/libraries/pbsExtensions/processors/video.js +23 -0
- package/libraries/video/constants/enums.js +5 -0
- package/libraries/video/constants/events.js +97 -0
- package/libraries/video/constants/ortb.js +169 -0
- package/libraries/video/constants/vendorCodes.js +6 -0
- package/libraries/video/shared/eventHandler.js +18 -0
- package/libraries/video/shared/parentModule.js +82 -0
- package/libraries/video/shared/state.js +47 -0
- package/libraries/video/shared/vastXmlBuilder.js +77 -0
- package/libraries/video/shared/vastXmlEditor.js +115 -0
- package/modules/.submodules.json +7 -1
- package/modules/aaxBlockmeterRtdProvider.js +59 -0
- package/modules/aaxBlockmeterRtdProvider.md +48 -0
- package/modules/admaticBidAdapter.js +147 -0
- package/modules/admaticBidAdapter.md +48 -0
- package/modules/amxBidAdapter.js +1 -0
- package/modules/appnexusBidAdapter.js +38 -1
- package/modules/chtnwBidAdapter.js +110 -0
- package/modules/chtnwBidAdapter.md +31 -0
- package/modules/concertBidAdapter.js +44 -2
- package/modules/connectIdSystem.js +36 -23
- package/modules/connectIdSystem.md +3 -2
- package/modules/consentManagement.js +22 -1
- package/modules/consentManagementUsp.js +29 -7
- package/modules/criteoBidAdapter.js +25 -5
- package/modules/currency.js +9 -0
- package/modules/dgkeywordRtdProvider.js +3 -3
- package/modules/gridNMBidAdapter.js +10 -14
- package/modules/growthCodeIdSystem.js +9 -5
- package/modules/gumgumBidAdapter.js +4 -0
- package/modules/improvedigitalBidAdapter.js +191 -470
- package/modules/ixBidAdapter.js +54 -71
- package/modules/jwplayerVideoProvider.js +929 -0
- package/modules/jwplayerVideoProvider.md +25 -0
- package/modules/kargoBidAdapter.js +1 -1
- package/modules/kueezRtbBidAdapter.js +278 -0
- package/modules/kueezRtbBidAdapter.md +35 -0
- package/modules/magniteAnalyticsAdapter.js +6 -1
- package/modules/mgidRtdProvider.js +190 -0
- package/modules/mgidRtdProvider.md +51 -0
- package/modules/multibid/index.js +12 -0
- package/modules/openxOrtbBidAdapter.js +120 -275
- package/modules/oxxionRtdProvider.js +119 -0
- package/modules/oxxionRtdProvider.md +48 -0
- package/modules/permutiveRtdProvider.js +2 -1
- package/modules/permutiveRtdProvider.md +36 -1
- package/modules/prebidServerBidAdapter/index.js +19 -716
- package/modules/prebidServerBidAdapter/ortbConverter.js +274 -0
- package/modules/priceFloors.js +73 -1
- package/modules/pubmaticBidAdapter.js +21 -29
- package/modules/rtdModule/index.js +22 -1
- package/modules/schain.js +24 -1
- package/modules/spotxBidAdapter.js +16 -15
- package/modules/synacormediaBidAdapter.js +1 -1
- package/modules/teadsIdSystem.js +5 -0
- package/modules/tripleliftBidAdapter.js +1 -1
- package/modules/userId/eids.js +3 -10
- package/modules/userId/index.js +64 -6
- package/modules/videoModule/addingSubmodule.md +521 -0
- package/modules/videoModule/coreVideo.js +234 -0
- package/modules/videoModule/gamAdServerSubmodule.js +27 -0
- package/modules/videoModule/index.js +244 -0
- package/modules/videoModule/videoImpressionVerifier.js +206 -0
- package/modules/videojsVideoProvider.js +854 -0
- package/modules/videojsVideoProvider.md +17 -0
- package/package.json +12 -8
- package/src/adRendering.js +1 -1
- package/src/adapterManager.js +56 -7
- package/src/adloader.js +3 -1
- package/src/auction.js +6 -1
- package/src/events.js +5 -1
- package/src/pbjsORTB.js +35 -0
- package/src/prebid.js +137 -112
- package/src/targeting.js +10 -2
- package/src/utils/currency.js +16 -0
- package/src/utils.js +21 -0
- package/test/spec/auctionmanager_spec.js +15 -0
- package/test/spec/modules/aaxBlockmeter_spec.js +58 -0
- package/test/spec/modules/admaticBidAdapter_spec.js +46 -0
- package/test/spec/modules/chtnwBidAdapter_spec.js +105 -0
- package/test/spec/modules/concertBidAdapter_spec.js +56 -0
- package/test/spec/modules/connectIdSystem_spec.js +175 -5
- package/test/spec/modules/consentManagementUsp_spec.js +64 -18
- package/test/spec/modules/criteoBidAdapter_spec.js +28 -0
- package/test/spec/modules/dgkeywordRtdProvider_spec.js +3 -3
- package/test/spec/modules/eids_spec.js +10 -7
- package/test/spec/modules/ftrackIdSystem_spec.js +34 -22
- package/test/spec/modules/gumgumBidAdapter_spec.js +15 -0
- package/test/spec/modules/improvedigitalBidAdapter_spec.js +231 -211
- package/test/spec/modules/ixBidAdapter_spec.js +412 -350
- package/test/spec/modules/kueezRtbBidAdapter_spec.js +396 -0
- package/test/spec/modules/magniteAnalyticsAdapter_spec.js +26 -0
- package/test/spec/modules/mgidRtdProvider_spec.js +366 -0
- package/test/spec/modules/openxOrtbBidAdapter_spec.js +77 -49
- package/test/spec/modules/oxxionRtdProvider_spec.js +142 -0
- package/test/spec/modules/permutiveRtdProvider_spec.js +64 -5
- package/test/spec/modules/prebidServerBidAdapter_spec.js +139 -137
- package/test/spec/modules/realTimeDataModule_spec.js +65 -0
- package/test/spec/modules/tripleliftBidAdapter_spec.js +14 -0
- package/test/spec/modules/userId_spec.js +67 -1
- package/test/spec/modules/videoModule/coreVideo_spec.js +98 -0
- package/test/spec/modules/videoModule/pbVideo_spec.js +362 -0
- package/test/spec/modules/videoModule/shared/parentModule_spec.js +73 -0
- package/test/spec/modules/videoModule/shared/state_spec.js +26 -0
- package/test/spec/modules/videoModule/shared/vastXmlBuilder_spec.js +103 -0
- package/test/spec/modules/videoModule/shared/vastXmlEditor_spec.js +209 -0
- package/test/spec/modules/videoModule/submodules/jwplayerVideoProvider_spec.js +846 -0
- package/test/spec/modules/videoModule/submodules/videojsVideoProvider_spec.js +391 -0
- package/test/spec/modules/videoModule/videoImpressionVerifier_spec.js +112 -0
- package/test/spec/ortbConverter/banner_spec.js +203 -0
- package/test/spec/ortbConverter/composer_spec.js +69 -0
- package/test/spec/ortbConverter/converter_spec.js +283 -0
- package/test/spec/ortbConverter/currency_spec.js +40 -0
- package/test/spec/ortbConverter/default_processors_spec.js +61 -0
- package/test/spec/ortbConverter/gdpr_spec.js +38 -0
- package/test/spec/ortbConverter/mediaTypes_spec.js +67 -0
- package/test/spec/ortbConverter/mergeProcessors_spec.js +59 -0
- package/test/spec/ortbConverter/multibid_spec.js +35 -0
- package/test/spec/ortbConverter/native_spec.js +95 -0
- package/test/spec/ortbConverter/pbjsORTB_spec.js +67 -0
- package/test/spec/ortbConverter/pbsExtensions/aliases_spec.js +57 -0
- package/test/spec/ortbConverter/pbsExtensions/params_spec.js +96 -0
- package/test/spec/ortbConverter/pbsExtensions/video_spec.js +52 -0
- package/test/spec/ortbConverter/priceFloors_spec.js +143 -0
- package/test/spec/ortbConverter/schain_spec.js +33 -0
- package/test/spec/ortbConverter/userId_spec.js +21 -0
- package/test/spec/ortbConverter/usp_spec.js +15 -0
- package/test/spec/ortbConverter/video_spec.js +189 -0
- package/test/spec/unit/core/adapterManager_spec.js +102 -0
- package/test/spec/unit/core/targeting_spec.js +34 -0
- package/test/spec/unit/pbjs_api_spec.js +124 -45
- package/test/spec/utils_spec.js +45 -1
|
@@ -286,6 +286,44 @@ describe('IndexexchangeAdapter', function () {
|
|
|
286
286
|
}
|
|
287
287
|
];
|
|
288
288
|
|
|
289
|
+
const DEFAULT_VIDEO_VALID_BID_MEDIUM_SIZE = [
|
|
290
|
+
{
|
|
291
|
+
bidder: 'ix',
|
|
292
|
+
params: {
|
|
293
|
+
siteId: '456',
|
|
294
|
+
video: {
|
|
295
|
+
skippable: false,
|
|
296
|
+
mimes: [
|
|
297
|
+
'video/mp4',
|
|
298
|
+
'video/webm'
|
|
299
|
+
],
|
|
300
|
+
minduration: 0,
|
|
301
|
+
maxduration: 60,
|
|
302
|
+
protocols: [2]
|
|
303
|
+
},
|
|
304
|
+
size: [640, 480]
|
|
305
|
+
},
|
|
306
|
+
sizes: [[640, 480], [200, 400]],
|
|
307
|
+
mediaTypes: {
|
|
308
|
+
video: {
|
|
309
|
+
context: 'instream',
|
|
310
|
+
playerSize: [[640, 480], [200, 400]]
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
ortb2Imp: {
|
|
314
|
+
ext: {
|
|
315
|
+
tid: '173f49a8-7549-4218-a23c-e7ba59b47230'
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
adUnitCode: 'div-gpt-ad-1460505748562-0',
|
|
319
|
+
transactionId: '173f49a8-7549-4218-a23c-e7ba59b47230',
|
|
320
|
+
bidId: '1a2b3c4e',
|
|
321
|
+
bidderRequestId: '11a22b33c44e',
|
|
322
|
+
auctionId: '1aa2bb3cc4de',
|
|
323
|
+
schain: SAMPLE_SCHAIN
|
|
324
|
+
}
|
|
325
|
+
];
|
|
326
|
+
|
|
289
327
|
const DEFAULT_MULTIFORMAT_BANNER_VALID_BID = [
|
|
290
328
|
{
|
|
291
329
|
bidder: 'ix',
|
|
@@ -364,6 +402,78 @@ describe('IndexexchangeAdapter', function () {
|
|
|
364
402
|
}
|
|
365
403
|
];
|
|
366
404
|
|
|
405
|
+
const DEFAULT_MULTIFORMAT_VALID_BID = [
|
|
406
|
+
{
|
|
407
|
+
bidder: 'ix',
|
|
408
|
+
params: {
|
|
409
|
+
tagId: '123',
|
|
410
|
+
siteId: '456',
|
|
411
|
+
video: {
|
|
412
|
+
siteId: '1111'
|
|
413
|
+
},
|
|
414
|
+
banner: {
|
|
415
|
+
siteId: '2222'
|
|
416
|
+
},
|
|
417
|
+
native: {
|
|
418
|
+
siteId: '3333'
|
|
419
|
+
},
|
|
420
|
+
size: [300, 250]
|
|
421
|
+
},
|
|
422
|
+
mediaTypes: {
|
|
423
|
+
video: {
|
|
424
|
+
context: 'outstream',
|
|
425
|
+
playerSize: [[300, 250]],
|
|
426
|
+
skippable: false,
|
|
427
|
+
mimes: [
|
|
428
|
+
'video/mp4',
|
|
429
|
+
'video/webm'
|
|
430
|
+
],
|
|
431
|
+
minduration: 0,
|
|
432
|
+
maxduration: 60,
|
|
433
|
+
protocols: [1]
|
|
434
|
+
},
|
|
435
|
+
banner: {
|
|
436
|
+
sizes: [[300, 250], [300, 600]]
|
|
437
|
+
},
|
|
438
|
+
native: {
|
|
439
|
+
icon: {
|
|
440
|
+
required: false
|
|
441
|
+
},
|
|
442
|
+
title: {
|
|
443
|
+
len: 25,
|
|
444
|
+
required: true
|
|
445
|
+
},
|
|
446
|
+
body: {
|
|
447
|
+
required: true
|
|
448
|
+
},
|
|
449
|
+
image: {
|
|
450
|
+
required: true
|
|
451
|
+
},
|
|
452
|
+
sponsoredBy: {
|
|
453
|
+
required: true
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
},
|
|
457
|
+
ortb2Imp: {
|
|
458
|
+
ext: {
|
|
459
|
+
tid: '173f49a8-7549-4218-a23c-e7ba59b47230',
|
|
460
|
+
data: {
|
|
461
|
+
pbadslot: 'div-gpt-ad-1460505748562-0'
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
},
|
|
465
|
+
nativeOrtbRequest: {
|
|
466
|
+
assets: [{id: 0, required: 0, img: {type: 1}}, {id: 1, required: 1, title: {len: 140}}, {id: 2, required: 1, data: {type: 2}}, {id: 3, required: 1, img: {type: 3}}, {id: 4, required: false, video: {mimes: ['video/mp4', 'video/webm'], minduration: 0, maxduration: 120, protocols: [2, 3, 5, 6]}}]
|
|
467
|
+
},
|
|
468
|
+
adUnitCode: 'div-gpt-ad-1460505748562-0',
|
|
469
|
+
transactionId: '273f49a8-7549-4218-a23c-e7ba59b47230',
|
|
470
|
+
bidId: '1a2b3c4e',
|
|
471
|
+
bidderRequestId: '11a22b33c44e',
|
|
472
|
+
auctionId: '1aa2bb3cc4de',
|
|
473
|
+
schain: SAMPLE_SCHAIN
|
|
474
|
+
}
|
|
475
|
+
];
|
|
476
|
+
|
|
367
477
|
const DEFAULT_NATIVE_VALID_BID = [
|
|
368
478
|
{
|
|
369
479
|
bidder: 'ix',
|
|
@@ -400,7 +510,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
400
510
|
}
|
|
401
511
|
},
|
|
402
512
|
nativeOrtbRequest: {
|
|
403
|
-
assets: [{id: 0, required: 0, img: {type: 1}}, {id: 1, required: 1, title: {len: 140}}, {id: 2, required: 1, data: {type: 2}}, {id: 3, required: 1, img: {type: 3}}, {id: 4, required: false, video: {mimes: ['video/mp4', 'video/webm'], minduration: 0, maxduration: 120, protocols: [2, 3, 5, 6]}}]
|
|
513
|
+
assets: [{ id: 0, required: 0, img: { type: 1 } }, { id: 1, required: 1, title: { len: 140 } }, { id: 2, required: 1, data: { type: 2 } }, { id: 3, required: 1, img: { type: 3 } }, { id: 4, required: false, video: { mimes: ['video/mp4', 'video/webm'], minduration: 0, maxduration: 120, protocols: [2, 3, 5, 6] } }]
|
|
404
514
|
},
|
|
405
515
|
adUnitCode: 'div-gpt-ad-1460505748563-0',
|
|
406
516
|
transactionId: '173f49a8-7549-4218-a23c-e7ba59b47231',
|
|
@@ -441,7 +551,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
441
551
|
}
|
|
442
552
|
},
|
|
443
553
|
nativeOrtbRequest: {
|
|
444
|
-
assets: [{id: 0, required: 0, img: {type: 1}}, {id: 1, required: 1, title: {len: 140}}, {id: 2, required: 1, data: {type: 2}}, {id: 3, required: 1, img: {type: 3}}, {id: 4, required: false, video: {mimes: ['video/mp4', 'video/webm'], minduration: 0, maxduration: 120, protocols: [2, 3, 5, 6]}}]
|
|
554
|
+
assets: [{ id: 0, required: 0, img: { type: 1 } }, { id: 1, required: 1, title: { len: 140 } }, { id: 2, required: 1, data: { type: 2 } }, { id: 3, required: 1, img: { type: 3 } }, { id: 4, required: false, video: { mimes: ['video/mp4', 'video/webm'], minduration: 0, maxduration: 120, protocols: [2, 3, 5, 6] } }]
|
|
445
555
|
},
|
|
446
556
|
adUnitCode: 'div-gpt-ad-1460505748562-0',
|
|
447
557
|
transactionId: '173f49a8-7549-4218-a23c-e7ba59b47230',
|
|
@@ -633,31 +743,6 @@ describe('IndexexchangeAdapter', function () {
|
|
|
633
743
|
}
|
|
634
744
|
};
|
|
635
745
|
|
|
636
|
-
const DEFAULT_BIDDER_REQUEST_DATA = {
|
|
637
|
-
ac: 'j',
|
|
638
|
-
r: JSON.stringify({
|
|
639
|
-
id: '345',
|
|
640
|
-
imp: [
|
|
641
|
-
{
|
|
642
|
-
id: '1a2b3c4e',
|
|
643
|
-
video: {
|
|
644
|
-
w: 640,
|
|
645
|
-
h: 480,
|
|
646
|
-
placement: 1
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
],
|
|
650
|
-
site: {
|
|
651
|
-
ref: 'https://ref.com/ref.html',
|
|
652
|
-
page: 'https://page.com'
|
|
653
|
-
},
|
|
654
|
-
}),
|
|
655
|
-
s: '21',
|
|
656
|
-
sd: 1,
|
|
657
|
-
t: 1000,
|
|
658
|
-
v: 8.1
|
|
659
|
-
};
|
|
660
|
-
|
|
661
746
|
const DEFAULT_USERID_DATA = {
|
|
662
747
|
idl_env: '1234-5678-9012-3456', // Liveramp
|
|
663
748
|
netId: 'testnetid123', // NetId
|
|
@@ -724,6 +809,8 @@ describe('IndexexchangeAdapter', function () {
|
|
|
724
809
|
lotamePanoramaId: 'bd738d136bdaa841117fe9b331bb4'
|
|
725
810
|
};
|
|
726
811
|
|
|
812
|
+
const extractPayload = function (bidRequest) { return bidRequest.data }
|
|
813
|
+
|
|
727
814
|
describe('inherited functions', function () {
|
|
728
815
|
it('should exists and is a function', function () {
|
|
729
816
|
const adapter = newBidder(spec);
|
|
@@ -778,7 +865,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
778
865
|
syncsPerBidder: 3
|
|
779
866
|
}
|
|
780
867
|
});
|
|
781
|
-
let userSync = spec.getUserSyncs(syncOptions, [{'body': {'ext': {'publishersyncsperbidderoverride': 0}}}]);
|
|
868
|
+
let userSync = spec.getUserSyncs(syncOptions, [{ 'body': { 'ext': { 'publishersyncsperbidderoverride': 0 } } }]);
|
|
782
869
|
expect(userSync.length).to.equal(0);
|
|
783
870
|
});
|
|
784
871
|
|
|
@@ -792,7 +879,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
792
879
|
syncsPerBidder: 3
|
|
793
880
|
}
|
|
794
881
|
});
|
|
795
|
-
let userSync = spec.getUserSyncs(syncOptions, [{'body': {'ext': {'publishersyncsperbidderoverride': 2}}}]);
|
|
882
|
+
let userSync = spec.getUserSyncs(syncOptions, [{ 'body': { 'ext': { 'publishersyncsperbidderoverride': 2 } } }]);
|
|
796
883
|
expect(userSync[0].type).to.equal('image');
|
|
797
884
|
const USER_SYNC_URL_0 = 'https://dsum.casalemedia.com/pbusermatch?origin=prebid&site_id=123&p=2&i=0&gdpr=1&gdpr_consent=3huaa11=qu3198ae&us_privacy=';
|
|
798
885
|
const USER_SYNC_URL_1 = 'https://dsum.casalemedia.com/pbusermatch?origin=prebid&site_id=123&p=2&i=1&gdpr=1&gdpr_consent=3huaa11=qu3198ae&us_privacy=';
|
|
@@ -811,7 +898,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
811
898
|
syncsPerBidder: 3
|
|
812
899
|
}
|
|
813
900
|
});
|
|
814
|
-
let userSync = spec.getUserSyncs(syncOptions, [{'body': {'ext': {'publishersyncsperbidderoverride': 4}}}]);
|
|
901
|
+
let userSync = spec.getUserSyncs(syncOptions, [{ 'body': { 'ext': { 'publishersyncsperbidderoverride': 4 } } }]);
|
|
815
902
|
expect(userSync[0].type).to.equal('image');
|
|
816
903
|
const USER_SYNC_URL_0 = 'https://dsum.casalemedia.com/pbusermatch?origin=prebid&site_id=123&p=3&i=0&gdpr=1&gdpr_consent=3huaa11=qu3198ae&us_privacy=';
|
|
817
904
|
const USER_SYNC_URL_1 = 'https://dsum.casalemedia.com/pbusermatch?origin=prebid&site_id=123&p=3&i=1&gdpr=1&gdpr_consent=3huaa11=qu3198ae&us_privacy=';
|
|
@@ -832,7 +919,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
832
919
|
syncsPerBidder: 0
|
|
833
920
|
}
|
|
834
921
|
});
|
|
835
|
-
let userSync = spec.getUserSyncs(syncOptions, [{'body': {'ext': {'publishersyncsperbidderoverride': 2}}}]);
|
|
922
|
+
let userSync = spec.getUserSyncs(syncOptions, [{ 'body': { 'ext': { 'publishersyncsperbidderoverride': 2 } } }]);
|
|
836
923
|
expect(userSync[0].type).to.equal('image');
|
|
837
924
|
const USER_SYNC_URL_0 = 'https://dsum.casalemedia.com/pbusermatch?origin=prebid&site_id=123&p=2&i=0&gdpr=1&gdpr_consent=3huaa11=qu3198ae&us_privacy=';
|
|
838
925
|
const USER_SYNC_URL_1 = 'https://dsum.casalemedia.com/pbusermatch?origin=prebid&site_id=123&p=2&i=1&gdpr=1&gdpr_consent=3huaa11=qu3198ae&us_privacy=';
|
|
@@ -868,7 +955,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
868
955
|
const bid = utils.deepClone(DEFAULT_VIDEO_VALID_BID[0]);
|
|
869
956
|
bid.mediaTypes.video.renderer = {
|
|
870
957
|
url: 'test',
|
|
871
|
-
render: () => {}
|
|
958
|
+
render: () => { }
|
|
872
959
|
};
|
|
873
960
|
bid.mediaTypes.video.context = 'outstream';
|
|
874
961
|
bid.mediaTypes.video.playerSize = [[300, 249]];
|
|
@@ -1080,7 +1167,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1080
1167
|
bid.nativeOrtbRequest = {}
|
|
1081
1168
|
expect(spec.isBidRequestValid(bid)).to.be.false;
|
|
1082
1169
|
|
|
1083
|
-
bid.nativeOrtbRequest = {assets: []}
|
|
1170
|
+
bid.nativeOrtbRequest = { assets: [] }
|
|
1084
1171
|
expect(spec.isBidRequestValid(bid)).to.be.false;
|
|
1085
1172
|
});
|
|
1086
1173
|
});
|
|
@@ -1104,7 +1191,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1104
1191
|
const cloneValidBid = utils.deepClone(validBid);
|
|
1105
1192
|
cloneValidBid[0].userIdAsEids = utils.deepClone(DEFAULT_USERIDASEIDS_DATA);
|
|
1106
1193
|
const request = spec.buildRequests(cloneValidBid, ALIAS_OPTIONS);
|
|
1107
|
-
const payload =
|
|
1194
|
+
const payload = extractPayload(request[0]);
|
|
1108
1195
|
expect(request).to.be.an('array');
|
|
1109
1196
|
expect(request).to.have.lengthOf.above(0); // should be 1 or more
|
|
1110
1197
|
expect(payload.user.eids).to.have.lengthOf(6);
|
|
@@ -1115,7 +1202,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1115
1202
|
|
|
1116
1203
|
describe('buildRequestsIdentity', function () {
|
|
1117
1204
|
let request;
|
|
1118
|
-
let
|
|
1205
|
+
let payload;
|
|
1119
1206
|
let testCopy;
|
|
1120
1207
|
|
|
1121
1208
|
beforeEach(function () {
|
|
@@ -1124,7 +1211,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1124
1211
|
return testCopy;
|
|
1125
1212
|
};
|
|
1126
1213
|
request = spec.buildRequests(DEFAULT_BANNER_VALID_BID, DEFAULT_OPTION)[0];
|
|
1127
|
-
|
|
1214
|
+
payload = extractPayload(request);
|
|
1128
1215
|
});
|
|
1129
1216
|
|
|
1130
1217
|
afterEach(function () {
|
|
@@ -1137,8 +1224,6 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1137
1224
|
});
|
|
1138
1225
|
|
|
1139
1226
|
it('payload should have correct format and value (single identity partner)', function () {
|
|
1140
|
-
const payload = JSON.parse(query.r);
|
|
1141
|
-
|
|
1142
1227
|
expect(payload.user).to.exist;
|
|
1143
1228
|
expect(payload.user.eids).to.exist;
|
|
1144
1229
|
expect(payload.user.eids).to.be.an('array');
|
|
@@ -1146,7 +1231,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1146
1231
|
});
|
|
1147
1232
|
|
|
1148
1233
|
it('identity data in impression should have correct format and value (single identity partner)', function () {
|
|
1149
|
-
const impression =
|
|
1234
|
+
const impression = payload.user.eids;
|
|
1150
1235
|
expect(impression[0].source).to.equal(testCopy.IdentityIp.data.source);
|
|
1151
1236
|
expect(impression[0].uids[0].id).to.equal(testCopy.IdentityIp.data.uids[0].id);
|
|
1152
1237
|
});
|
|
@@ -1166,8 +1251,6 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1166
1251
|
});
|
|
1167
1252
|
|
|
1168
1253
|
it('payload should have correct format and value (single identity w/ multi ids)', function () {
|
|
1169
|
-
const payload = JSON.parse(query.r);
|
|
1170
|
-
|
|
1171
1254
|
expect(payload.user).to.exist;
|
|
1172
1255
|
expect(payload.user.eids).to.exist;
|
|
1173
1256
|
expect(payload.user.eids).to.be.an('array');
|
|
@@ -1175,7 +1258,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1175
1258
|
});
|
|
1176
1259
|
|
|
1177
1260
|
it('identity data in impression should have correct format and value (single identity w/ multi ids)', function () {
|
|
1178
|
-
const impression =
|
|
1261
|
+
const impression = payload.user.eids;
|
|
1179
1262
|
|
|
1180
1263
|
expect(impression[0].source).to.equal(testCopy.IdentityIp.data.source);
|
|
1181
1264
|
expect(impression[0].uids).to.have.lengthOf(3);
|
|
@@ -1210,8 +1293,6 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1210
1293
|
});
|
|
1211
1294
|
|
|
1212
1295
|
it('payload should have correct format and value (multiple identity partners)', function () {
|
|
1213
|
-
const payload = JSON.parse(query.r);
|
|
1214
|
-
|
|
1215
1296
|
expect(payload.user).to.exist;
|
|
1216
1297
|
expect(payload.user.eids).to.exist;
|
|
1217
1298
|
expect(payload.user.eids).to.be.an('array');
|
|
@@ -1219,7 +1300,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1219
1300
|
});
|
|
1220
1301
|
|
|
1221
1302
|
it('identity data in impression should have correct format and value (multiple identity partners)', function () {
|
|
1222
|
-
const impression =
|
|
1303
|
+
const impression = payload.user.eids;
|
|
1223
1304
|
|
|
1224
1305
|
expect(impression[0].source).to.equal(testCopy.IdentityIp.data.source);
|
|
1225
1306
|
expect(impression[0].uids).to.have.lengthOf(1);
|
|
@@ -1242,8 +1323,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1242
1323
|
return undefined;
|
|
1243
1324
|
};
|
|
1244
1325
|
request = spec.buildRequests(DEFAULT_BANNER_VALID_BID, DEFAULT_OPTION)[0];
|
|
1245
|
-
|
|
1246
|
-
const payload = JSON.parse(query.r);
|
|
1326
|
+
payload = extractPayload(request);
|
|
1247
1327
|
|
|
1248
1328
|
expect(payload.user).to.exist;
|
|
1249
1329
|
expect(payload.user.eids).to.not.exist;
|
|
@@ -1255,8 +1335,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1255
1335
|
data: {}
|
|
1256
1336
|
}
|
|
1257
1337
|
request = spec.buildRequests(DEFAULT_BANNER_VALID_BID, DEFAULT_OPTION)[0];
|
|
1258
|
-
|
|
1259
|
-
const payload = JSON.parse(query.r);
|
|
1338
|
+
payload = extractPayload(request);
|
|
1260
1339
|
|
|
1261
1340
|
expect(payload.user).to.exist;
|
|
1262
1341
|
expect(payload.user.eids).to.exist;
|
|
@@ -1265,8 +1344,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1265
1344
|
it('payload should not have any user eids if identity data is pending for all partners', function () {
|
|
1266
1345
|
testCopy.IdentityIp.responsePending = true;
|
|
1267
1346
|
request = spec.buildRequests(DEFAULT_BANNER_VALID_BID, DEFAULT_OPTION)[0];
|
|
1268
|
-
|
|
1269
|
-
const payload = JSON.parse(query.r);
|
|
1347
|
+
payload = extractPayload(request);
|
|
1270
1348
|
|
|
1271
1349
|
expect(payload.user).to.exist;
|
|
1272
1350
|
expect(payload.user.eids).to.not.exist;
|
|
@@ -1276,8 +1354,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1276
1354
|
testCopy.IdentityIp.responsePending = false;
|
|
1277
1355
|
testCopy.IdentityIp.data = {};
|
|
1278
1356
|
request = spec.buildRequests(DEFAULT_BANNER_VALID_BID, DEFAULT_OPTION)[0];
|
|
1279
|
-
|
|
1280
|
-
const payload = JSON.parse(query.r);
|
|
1357
|
+
payload = extractPayload(request);
|
|
1281
1358
|
|
|
1282
1359
|
expect(payload.user).to.exist;
|
|
1283
1360
|
expect(payload.user.eids).to.not.exist;
|
|
@@ -1304,7 +1381,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1304
1381
|
const cloneValidBid = utils.deepClone(DEFAULT_VIDEO_VALID_BID);
|
|
1305
1382
|
cloneValidBid[0].userIdAsEids = utils.deepClone(DEFAULT_USERIDASEIDS_DATA);
|
|
1306
1383
|
const request = spec.buildRequests(cloneValidBid, DEFAULT_OPTION)[0];
|
|
1307
|
-
const payload =
|
|
1384
|
+
const payload = extractPayload(request);
|
|
1308
1385
|
|
|
1309
1386
|
expect(payload.user.eids).to.have.lengthOf(6);
|
|
1310
1387
|
expect(payload.user.eids).to.have.deep.members(DEFAULT_USERID_PAYLOAD);
|
|
@@ -1401,7 +1478,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1401
1478
|
cloneValidBid[0].userIdAsEids = utils.deepClone(DEFAULT_USERIDASEIDS_DATA);
|
|
1402
1479
|
|
|
1403
1480
|
const request = spec.buildRequests(cloneValidBid, DEFAULT_OPTION)[0];
|
|
1404
|
-
const payload =
|
|
1481
|
+
const payload = extractPayload(request);
|
|
1405
1482
|
|
|
1406
1483
|
validUserIdPayload = utils.deepClone(DEFAULT_USERID_PAYLOAD);
|
|
1407
1484
|
validUserIdPayload.push({
|
|
@@ -1480,7 +1557,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1480
1557
|
}]
|
|
1481
1558
|
});
|
|
1482
1559
|
|
|
1483
|
-
const payload =
|
|
1560
|
+
const payload = extractPayload(request);
|
|
1484
1561
|
expect(payload.user.eids).to.have.lengthOf(7);
|
|
1485
1562
|
expect(payload.user.eids).to.have.deep.members(validUserIdPayload);
|
|
1486
1563
|
});
|
|
@@ -1503,7 +1580,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1503
1580
|
bid.userId = DEFAULT_USERID_BID_DATA;
|
|
1504
1581
|
|
|
1505
1582
|
const request = spec.buildRequests([bid], DEFAULT_OPTION)[0];
|
|
1506
|
-
const r =
|
|
1583
|
+
const r = extractPayload(request);
|
|
1507
1584
|
|
|
1508
1585
|
expect(r.ext.ixdiag.userIds).to.be.an('array');
|
|
1509
1586
|
expect(r.ext.ixdiag.userIds.should.not.include('lotamePanoramaId'));
|
|
@@ -1514,8 +1591,8 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1514
1591
|
|
|
1515
1592
|
describe('First party data', function () {
|
|
1516
1593
|
it('should not set ixdiag.fpd value if not defined', function () {
|
|
1517
|
-
const request = spec.buildRequests(DEFAULT_BANNER_VALID_BID, {ortb2: {}})[0];
|
|
1518
|
-
const r =
|
|
1594
|
+
const request = spec.buildRequests(DEFAULT_BANNER_VALID_BID, { ortb2: {} })[0];
|
|
1595
|
+
const r = extractPayload(request);
|
|
1519
1596
|
|
|
1520
1597
|
expect(r.ext.ixdiag.fpd).to.be.undefined;
|
|
1521
1598
|
});
|
|
@@ -1531,8 +1608,8 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1531
1608
|
}
|
|
1532
1609
|
};
|
|
1533
1610
|
|
|
1534
|
-
const request = spec.buildRequests(DEFAULT_BANNER_VALID_BID, {ortb2})[0];
|
|
1535
|
-
const r =
|
|
1611
|
+
const request = spec.buildRequests(DEFAULT_BANNER_VALID_BID, { ortb2 })[0];
|
|
1612
|
+
const r = extractPayload(request);
|
|
1536
1613
|
|
|
1537
1614
|
expect(r.ext.ixdiag.fpd).to.exist;
|
|
1538
1615
|
});
|
|
@@ -1543,7 +1620,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1543
1620
|
});
|
|
1544
1621
|
|
|
1545
1622
|
const request = spec.buildRequests(DEFAULT_BANNER_VALID_BID)[0];
|
|
1546
|
-
const r =
|
|
1623
|
+
const r = extractPayload(request);
|
|
1547
1624
|
|
|
1548
1625
|
expect(r.ext.ixdiag.tmax).to.equal(250);
|
|
1549
1626
|
});
|
|
@@ -1553,11 +1630,18 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1553
1630
|
bidderTimeout: null
|
|
1554
1631
|
})
|
|
1555
1632
|
const request = spec.buildRequests(DEFAULT_BANNER_VALID_BID)[0];
|
|
1556
|
-
const r =
|
|
1633
|
+
const r = extractPayload(request);
|
|
1557
1634
|
|
|
1558
1635
|
expect(r.ext.ixdiag.tmax).to.be.undefined
|
|
1559
1636
|
});
|
|
1560
1637
|
|
|
1638
|
+
it('should set ixdiag.imps to number of impressions', function () {
|
|
1639
|
+
const request = spec.buildRequests(DEFAULT_BANNER_VALID_BID)[0];
|
|
1640
|
+
const r = extractPayload(request);
|
|
1641
|
+
|
|
1642
|
+
expect(r.ext.ixdiag.imps).to.equal(1);
|
|
1643
|
+
});
|
|
1644
|
+
|
|
1561
1645
|
it('should not send information that is not part of openRTB spec v2.5 using ortb2', function () {
|
|
1562
1646
|
const ortb2 = {
|
|
1563
1647
|
site: {
|
|
@@ -1571,8 +1655,8 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1571
1655
|
}
|
|
1572
1656
|
};
|
|
1573
1657
|
|
|
1574
|
-
const request = spec.buildRequests(DEFAULT_BANNER_VALID_BID, {ortb2})[0];
|
|
1575
|
-
const r =
|
|
1658
|
+
const request = spec.buildRequests(DEFAULT_BANNER_VALID_BID, { ortb2 })[0];
|
|
1659
|
+
const r = extractPayload(request);
|
|
1576
1660
|
|
|
1577
1661
|
expect(r.site.keywords).to.exist;
|
|
1578
1662
|
expect(r.site.search).to.exist;
|
|
@@ -1595,8 +1679,8 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1595
1679
|
const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]);
|
|
1596
1680
|
bid.mediaTypes.banner.sizes = LARGE_SET_OF_SIZES;
|
|
1597
1681
|
|
|
1598
|
-
const request = spec.buildRequests([bid], {ortb2})[0];
|
|
1599
|
-
const r =
|
|
1682
|
+
const request = spec.buildRequests([bid], { ortb2 })[0];
|
|
1683
|
+
const r = extractPayload(request);
|
|
1600
1684
|
|
|
1601
1685
|
expect(r.site.ref).to.exist;
|
|
1602
1686
|
expect(r.site.keywords).to.be.undefined;
|
|
@@ -1608,33 +1692,25 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1608
1692
|
let request = spec.buildRequests(DEFAULT_BANNER_VALID_BID, DEFAULT_OPTION)[0];
|
|
1609
1693
|
const requestUrl = request.url;
|
|
1610
1694
|
const requestMethod = request.method;
|
|
1611
|
-
const
|
|
1695
|
+
const payloadData = request.data;
|
|
1612
1696
|
|
|
1613
1697
|
const bidWithoutSchain = utils.deepClone(DEFAULT_BANNER_VALID_BID);
|
|
1614
1698
|
delete bidWithoutSchain[0].schain;
|
|
1615
1699
|
const requestWithoutSchain = spec.buildRequests(bidWithoutSchain, DEFAULT_OPTION)[0];
|
|
1616
|
-
const
|
|
1700
|
+
const payloadWithoutSchain = extractPayload(requestWithoutSchain);
|
|
1617
1701
|
const GPID = '/19968336/some-adunit-path';
|
|
1618
1702
|
|
|
1619
|
-
it('request should be made to IX endpoint with
|
|
1620
|
-
expect(requestMethod).to.equal('
|
|
1621
|
-
expect(requestUrl).to.equal(IX_SECURE_ENDPOINT);
|
|
1703
|
+
it('request should be made to IX endpoint with POST method and siteId in query param', function () {
|
|
1704
|
+
expect(requestMethod).to.equal('POST');
|
|
1705
|
+
expect(requestUrl).to.equal(IX_SECURE_ENDPOINT + '?s=' + DEFAULT_BANNER_VALID_BID[0].params.siteId);
|
|
1706
|
+
expect(request.option.contentType).to.equal('text/plain')
|
|
1622
1707
|
});
|
|
1623
1708
|
|
|
1624
1709
|
it('auction type should be set correctly', function () {
|
|
1625
|
-
const at =
|
|
1710
|
+
const at = payloadData.at;
|
|
1626
1711
|
expect(at).to.equal(1);
|
|
1627
1712
|
})
|
|
1628
1713
|
|
|
1629
|
-
it('query object (version, siteID and request) should be correct', function () {
|
|
1630
|
-
expect(query.v).to.equal(BANNER_ENDPOINT_VERSION);
|
|
1631
|
-
expect(query.s).to.equal(DEFAULT_BANNER_VALID_BID[0].params.siteId);
|
|
1632
|
-
expect(query.r).to.exist;
|
|
1633
|
-
expect(query.ac).to.equal('j');
|
|
1634
|
-
expect(query.sd).to.equal(1);
|
|
1635
|
-
expect(query.nf).not.to.exist;
|
|
1636
|
-
});
|
|
1637
|
-
|
|
1638
1714
|
it('should send dfp_adunit_code in request if ortb2Imp.ext.data.adserver.adslot exists', function () {
|
|
1639
1715
|
const AD_UNIT_CODE = '/19968336/some-adunit-path';
|
|
1640
1716
|
const validBids = utils.deepClone(DEFAULT_BANNER_VALID_BID);
|
|
@@ -1649,7 +1725,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1649
1725
|
}
|
|
1650
1726
|
};
|
|
1651
1727
|
const requests = spec.buildRequests(validBids, DEFAULT_OPTION);
|
|
1652
|
-
const { ext: { dfp_ad_unit_code } } =
|
|
1728
|
+
const { ext: { dfp_ad_unit_code } } = extractPayload(requests[0]).imp[0];
|
|
1653
1729
|
expect(dfp_ad_unit_code).to.equal(AD_UNIT_CODE);
|
|
1654
1730
|
});
|
|
1655
1731
|
|
|
@@ -1661,7 +1737,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1661
1737
|
}
|
|
1662
1738
|
};
|
|
1663
1739
|
const requests = spec.buildRequests(validBids, DEFAULT_OPTION);
|
|
1664
|
-
const { ext: { gpid } } =
|
|
1740
|
+
const { ext: { gpid } } = extractPayload(requests[0]).imp[0];
|
|
1665
1741
|
expect(gpid).to.equal(GPID);
|
|
1666
1742
|
});
|
|
1667
1743
|
|
|
@@ -1673,7 +1749,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1673
1749
|
}
|
|
1674
1750
|
};
|
|
1675
1751
|
const requests = spec.buildRequests(validBids, DEFAULT_OPTION);
|
|
1676
|
-
const { ext: { gpid } } =
|
|
1752
|
+
const { ext: { gpid } } = extractPayload(requests[0]).imp[0];
|
|
1677
1753
|
expect(gpid).to.equal(GPID);
|
|
1678
1754
|
});
|
|
1679
1755
|
|
|
@@ -1686,7 +1762,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1686
1762
|
}
|
|
1687
1763
|
};
|
|
1688
1764
|
const requests = spec.buildRequests(validBids, DEFAULT_OPTION);
|
|
1689
|
-
const imp =
|
|
1765
|
+
const imp = extractPayload(requests[0]).imp[0];
|
|
1690
1766
|
expect(deepAccess(imp, 'ext.dfp_ad_unit_code')).to.not.exist;
|
|
1691
1767
|
});
|
|
1692
1768
|
|
|
@@ -1704,7 +1780,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1704
1780
|
}
|
|
1705
1781
|
};
|
|
1706
1782
|
const requests = spec.buildRequests(validBids, DEFAULT_OPTION);
|
|
1707
|
-
const imp =
|
|
1783
|
+
const imp = extractPayload(requests[0]).imp[0];
|
|
1708
1784
|
expect(deepAccess(imp, 'ext.gpid')).to.not.exist;
|
|
1709
1785
|
});
|
|
1710
1786
|
|
|
@@ -1724,13 +1800,13 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1724
1800
|
}
|
|
1725
1801
|
};
|
|
1726
1802
|
const requests = spec.buildRequests(validBids, DEFAULT_OPTION);
|
|
1727
|
-
const imp =
|
|
1803
|
+
const imp = extractPayload(requests[0]).imp[0];
|
|
1728
1804
|
expect(deepAccess(imp, 'ext.gpid')).to.equal(GPID);
|
|
1729
1805
|
expect(deepAccess(imp, 'ext.dfp_ad_unit_code')).to.equal(AD_UNIT_CODE);
|
|
1730
1806
|
});
|
|
1731
1807
|
|
|
1732
1808
|
it('payload should have correct format and value', function () {
|
|
1733
|
-
const payload =
|
|
1809
|
+
const payload = payloadData;
|
|
1734
1810
|
expect(payload.id).to.equal(DEFAULT_BANNER_VALID_BID[0].bidderRequestId);
|
|
1735
1811
|
expect(payload.id).to.be.a('string');
|
|
1736
1812
|
expect(payload.site.page).to.equal(DEFAULT_OPTION.refererInfo.page);
|
|
@@ -1748,7 +1824,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1748
1824
|
|
|
1749
1825
|
request = spec.buildRequests(bidWithIntId, DEFAULT_OPTION)[0];
|
|
1750
1826
|
|
|
1751
|
-
const payload =
|
|
1827
|
+
const payload = extractPayload(request);
|
|
1752
1828
|
expect(bidWithIntId[0].bidderRequestId).to.be.a('number');
|
|
1753
1829
|
expect(payload.id).to.equal(bidWithIntId[0].bidderRequestId.toString());
|
|
1754
1830
|
expect(payload.id).to.be.a('string');
|
|
@@ -1760,19 +1836,21 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1760
1836
|
|
|
1761
1837
|
request = spec.buildRequests(bidWithIntId, DEFAULT_OPTION)[0];
|
|
1762
1838
|
|
|
1763
|
-
const payload =
|
|
1839
|
+
const payload = extractPayload(request);
|
|
1764
1840
|
expect(bidWithIntId[0].bidderRequestId).to.be.a('number');
|
|
1765
1841
|
expect(payload.id).to.equal(bidWithIntId[0].bidderRequestId.toString());
|
|
1766
1842
|
expect(payload.id).to.be.a('string');
|
|
1767
1843
|
});
|
|
1768
1844
|
|
|
1769
1845
|
it('payload should not include schain when not provided', function () {
|
|
1770
|
-
const payload =
|
|
1771
|
-
|
|
1846
|
+
const payload = payloadWithoutSchain;
|
|
1847
|
+
|
|
1848
|
+
const actualSchain = (((payload || {}).source || {}).ext || {}).schain;
|
|
1849
|
+
expect(actualSchain).to.not.exist;
|
|
1772
1850
|
});
|
|
1773
1851
|
|
|
1774
1852
|
it('impression should have correct format and value', function () {
|
|
1775
|
-
const impression =
|
|
1853
|
+
const impression = payloadData.imp[0];
|
|
1776
1854
|
const sidValue = DEFAULT_BANNER_VALID_BID[0].params.id;
|
|
1777
1855
|
|
|
1778
1856
|
expect(impression.id).to.equal(DEFAULT_BANNER_VALID_BID[0].bidId);
|
|
@@ -1797,7 +1875,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1797
1875
|
|
|
1798
1876
|
request = spec.buildRequests([bid], DEFAULT_OPTION)[0];
|
|
1799
1877
|
|
|
1800
|
-
const payload =
|
|
1878
|
+
const payload = extractPayload(request);
|
|
1801
1879
|
payload.imp[0].banner.format.forEach((imp) => {
|
|
1802
1880
|
expect(imp.ext.siteID).to.be.a('string');
|
|
1803
1881
|
});
|
|
@@ -1813,7 +1891,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1813
1891
|
const expectedFloor = 3.25;
|
|
1814
1892
|
bid.getFloor = () => ({ floor: expectedFloor, currency });
|
|
1815
1893
|
const request = spec.buildRequests([bid], {})[0];
|
|
1816
|
-
const impression =
|
|
1894
|
+
const impression = extractPayload(request).imp[0];
|
|
1817
1895
|
|
|
1818
1896
|
expect(impression.bidfloor).to.equal(expectedFloor);
|
|
1819
1897
|
expect(impression.bidfloorcur).to.equal(currency);
|
|
@@ -1825,7 +1903,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1825
1903
|
const expectedFloor = 3.25;
|
|
1826
1904
|
bid.getFloor = () => ({ floor: expectedFloor, currency });
|
|
1827
1905
|
const request = spec.buildRequests([bid], {})[0];
|
|
1828
|
-
const impression =
|
|
1906
|
+
const impression = extractPayload(request).imp[0];
|
|
1829
1907
|
|
|
1830
1908
|
expect(impression.bidfloor).to.equal(expectedFloor);
|
|
1831
1909
|
expect(impression.bidfloorcur).to.equal(currency);
|
|
@@ -1837,7 +1915,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1837
1915
|
bid.params.bidFloor = highFloor;
|
|
1838
1916
|
bid.params.bidFloorCur = 'USD'
|
|
1839
1917
|
const request = spec.buildRequests([bid], {})[0];
|
|
1840
|
-
const impression =
|
|
1918
|
+
const impression = extractPayload(request).imp[0];
|
|
1841
1919
|
|
|
1842
1920
|
expect(impression.bidfloor).to.equal(highFloor);
|
|
1843
1921
|
expect(impression.bidfloorcur).to.equal(bid.params.bidFloorCur);
|
|
@@ -1851,7 +1929,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1851
1929
|
const expectedFloor = highFloor;
|
|
1852
1930
|
bid.getFloor = () => ({ floor: expectedFloor, currency });
|
|
1853
1931
|
const requestBidFloor = spec.buildRequests([bid], {})[0];
|
|
1854
|
-
const impression =
|
|
1932
|
+
const impression = extractPayload(requestBidFloor).imp[0];
|
|
1855
1933
|
|
|
1856
1934
|
expect(impression.bidfloor).to.equal(highFloor);
|
|
1857
1935
|
expect(impression.bidfloorcur).to.equal(bid.params.bidFloorCur);
|
|
@@ -1863,7 +1941,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1863
1941
|
bid.params.bidFloor = 50;
|
|
1864
1942
|
bid.params.bidFloorCur = 'USD';
|
|
1865
1943
|
const requestBidFloor = spec.buildRequests([bid], {})[0];
|
|
1866
|
-
const impression =
|
|
1944
|
+
const impression = extractPayload(requestBidFloor).imp[0];
|
|
1867
1945
|
|
|
1868
1946
|
expect(impression.bidfloor).to.equal(bid.params.bidFloor);
|
|
1869
1947
|
expect(impression.bidfloorcur).to.equal(bid.params.bidFloorCur);
|
|
@@ -1875,7 +1953,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1875
1953
|
bid.params.bidFloor = 50;
|
|
1876
1954
|
bid.params.bidFloorCur = 'USD';
|
|
1877
1955
|
const requestBidFloor = spec.buildRequests([bid], {})[0];
|
|
1878
|
-
const impression =
|
|
1956
|
+
const impression = extractPayload(requestBidFloor).imp[0];
|
|
1879
1957
|
|
|
1880
1958
|
expect(impression.bidfloor).to.equal(bid.params.bidFloor);
|
|
1881
1959
|
expect(impression.bidfloorcur).to.equal(bid.params.bidFloorCur);
|
|
@@ -1900,7 +1978,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1900
1978
|
expect(bid.getFloor.getCall(1).args[0].size[0]).to.equal(500);
|
|
1901
1979
|
expect(bid.getFloor.getCall(1).args[0].size[1]).to.equal(400);
|
|
1902
1980
|
|
|
1903
|
-
const impression =
|
|
1981
|
+
const impression = extractPayload(requestBidFloor).imp[0];
|
|
1904
1982
|
expect(impression.bidfloor).to.equal(expectedFloor);
|
|
1905
1983
|
expect(impression.bidfloorcur).to.equal(currency);
|
|
1906
1984
|
});
|
|
@@ -1930,7 +2008,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1930
2008
|
expect(bid.getFloor.getCall(0).args[0].size[0]).to.equal(300);
|
|
1931
2009
|
expect(bid.getFloor.getCall(0).args[0].size[1]).to.equal(250);
|
|
1932
2010
|
|
|
1933
|
-
const impression =
|
|
2011
|
+
const impression = extractPayload(requestBidFloor).imp[0];
|
|
1934
2012
|
expect(impression.bidfloor).to.equal(expectedFloor);
|
|
1935
2013
|
expect(impression.bidfloorcur).to.equal(currency);
|
|
1936
2014
|
});
|
|
@@ -1940,7 +2018,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1940
2018
|
const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]);
|
|
1941
2019
|
bid.params.id = 50;
|
|
1942
2020
|
const requestBidFloor = spec.buildRequests([bid], {})[0];
|
|
1943
|
-
const impression =
|
|
2021
|
+
const impression = extractPayload(requestBidFloor).imp[0];
|
|
1944
2022
|
|
|
1945
2023
|
expect(impression.id).to.equal(DEFAULT_BANNER_VALID_BID[0].bidId);
|
|
1946
2024
|
expect(impression.banner.format[0].w).to.equal(DEFAULT_BANNER_VALID_BID[0].params.size[0]);
|
|
@@ -1954,7 +2032,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1954
2032
|
const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]);
|
|
1955
2033
|
bid.params.id = 'abc';
|
|
1956
2034
|
const requestBidFloor = spec.buildRequests([bid], {})[0];
|
|
1957
|
-
const impression =
|
|
2035
|
+
const impression = extractPayload(requestBidFloor).imp[0];
|
|
1958
2036
|
|
|
1959
2037
|
expect(impression.id).to.equal(DEFAULT_BANNER_VALID_BID[0].bidId);
|
|
1960
2038
|
expect(impression.banner.format[0].w).to.equal(DEFAULT_BANNER_VALID_BID[0].params.size[0]);
|
|
@@ -1982,7 +2060,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1982
2060
|
});
|
|
1983
2061
|
|
|
1984
2062
|
const requestWithFirstPartyData = spec.buildRequests(DEFAULT_BANNER_VALID_BID, DEFAULT_OPTION)[0];
|
|
1985
|
-
const pageUrl =
|
|
2063
|
+
const pageUrl = extractPayload(requestWithFirstPartyData).site.page;
|
|
1986
2064
|
const expectedPageUrl = DEFAULT_OPTION.refererInfo.page + '?ab=123&cd=123%23ab&e%2Ff=456&h%3Fg=456%23cd';
|
|
1987
2065
|
expect(pageUrl).to.equal(expectedPageUrl);
|
|
1988
2066
|
});
|
|
@@ -1995,7 +2073,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
1995
2073
|
});
|
|
1996
2074
|
|
|
1997
2075
|
const requestFirstPartyDataNumber = spec.buildRequests(DEFAULT_BANNER_VALID_BID, DEFAULT_OPTION)[0];
|
|
1998
|
-
const pageUrl =
|
|
2076
|
+
const pageUrl = extractPayload(requestFirstPartyDataNumber).site.page;
|
|
1999
2077
|
|
|
2000
2078
|
expect(pageUrl).to.equal(DEFAULT_OPTION.refererInfo.page);
|
|
2001
2079
|
});
|
|
@@ -2006,7 +2084,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2006
2084
|
});
|
|
2007
2085
|
|
|
2008
2086
|
const requestWithoutConfig = spec.buildRequests(DEFAULT_BANNER_VALID_BID, DEFAULT_OPTION)[0];
|
|
2009
|
-
const pageUrl =
|
|
2087
|
+
const pageUrl = extractPayload(requestWithoutConfig).site.page;
|
|
2010
2088
|
|
|
2011
2089
|
expect(pageUrl).to.equal(DEFAULT_OPTION.refererInfo.page);
|
|
2012
2090
|
expect(requestWithoutConfig.data.t).to.be.undefined;
|
|
@@ -2014,13 +2092,13 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2014
2092
|
|
|
2015
2093
|
it('should not set first party or timeout if it is setConfig is not called', function () {
|
|
2016
2094
|
const requestWithoutConfig = spec.buildRequests(DEFAULT_BANNER_VALID_BID, DEFAULT_OPTION)[0];
|
|
2017
|
-
const pageUrl =
|
|
2095
|
+
const pageUrl = extractPayload(requestWithoutConfig).site.page;
|
|
2018
2096
|
|
|
2019
2097
|
expect(pageUrl).to.equal(DEFAULT_OPTION.refererInfo.page);
|
|
2020
2098
|
expect(requestWithoutConfig.data.t).to.be.undefined;
|
|
2021
2099
|
});
|
|
2022
2100
|
|
|
2023
|
-
it('should set timeout if publisher set it through setConfig', function () {
|
|
2101
|
+
it('should no longer set timeout even if publisher set it through setConfig', function () {
|
|
2024
2102
|
config.setConfig({
|
|
2025
2103
|
ix: {
|
|
2026
2104
|
timeout: 500
|
|
@@ -2028,10 +2106,10 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2028
2106
|
});
|
|
2029
2107
|
const requestWithTimeout = spec.buildRequests(DEFAULT_BANNER_VALID_BID, {})[0];
|
|
2030
2108
|
|
|
2031
|
-
expect(requestWithTimeout.data.t).to.
|
|
2109
|
+
expect(requestWithTimeout.data.t).to.be.undefined;
|
|
2032
2110
|
});
|
|
2033
2111
|
|
|
2034
|
-
it('should set timeout if timeout is a string', function () {
|
|
2112
|
+
it('should no longer set timeout even if timeout is a string', function () {
|
|
2035
2113
|
config.setConfig({
|
|
2036
2114
|
ix: {
|
|
2037
2115
|
timeout: '500'
|
|
@@ -2046,11 +2124,10 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2046
2124
|
describe('request should contain both banner and video requests', function () {
|
|
2047
2125
|
const request = spec.buildRequests([DEFAULT_BANNER_VALID_BID[0], DEFAULT_VIDEO_VALID_BID[0]], {});
|
|
2048
2126
|
it('should have banner request', () => {
|
|
2049
|
-
const bannerImpression =
|
|
2127
|
+
const bannerImpression = extractPayload(request[0]).imp[0];
|
|
2050
2128
|
const sidValue = DEFAULT_BANNER_VALID_BID[0].params.id;
|
|
2051
2129
|
|
|
2052
|
-
expect(
|
|
2053
|
-
expect(JSON.parse(request[0].data.v)).to.equal(BANNER_ENDPOINT_VERSION);
|
|
2130
|
+
expect(extractPayload(request[0]).imp).to.have.lengthOf(1);
|
|
2054
2131
|
expect(bannerImpression.id).to.equal(DEFAULT_BANNER_VALID_BID[0].bidId);
|
|
2055
2132
|
|
|
2056
2133
|
expect(bannerImpression.banner.format).to.be.length(2);
|
|
@@ -2067,9 +2144,8 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2067
2144
|
});
|
|
2068
2145
|
|
|
2069
2146
|
it('should have video request', () => {
|
|
2070
|
-
const videoImpression =
|
|
2147
|
+
const videoImpression = extractPayload(request[1]).imp[0];
|
|
2071
2148
|
|
|
2072
|
-
expect(JSON.parse(request[1].data.v)).to.equal(VIDEO_ENDPOINT_VERSION);
|
|
2073
2149
|
expect(videoImpression.id).to.equal(DEFAULT_VIDEO_VALID_BID[0].bidId);
|
|
2074
2150
|
expect(videoImpression.video.w).to.equal(DEFAULT_VIDEO_VALID_BID[0].params.size[0]);
|
|
2075
2151
|
expect(videoImpression.video.h).to.equal(DEFAULT_VIDEO_VALID_BID[0].params.size[1]);
|
|
@@ -2080,11 +2156,10 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2080
2156
|
const request = spec.buildRequests([DEFAULT_BANNER_VALID_BID[0], DEFAULT_NATIVE_VALID_BID[0]]);
|
|
2081
2157
|
|
|
2082
2158
|
it('should have banner request', () => {
|
|
2083
|
-
const bannerImpression =
|
|
2159
|
+
const bannerImpression = extractPayload(request[0]).imp[0];
|
|
2084
2160
|
const sidValue = DEFAULT_BANNER_VALID_BID[0].params.id;
|
|
2085
2161
|
|
|
2086
|
-
expect(
|
|
2087
|
-
expect(JSON.parse(request[0].data.v)).to.equal(BANNER_ENDPOINT_VERSION);
|
|
2162
|
+
expect(extractPayload(request[0]).imp).to.have.lengthOf(1);
|
|
2088
2163
|
expect(bannerImpression.id).to.equal(DEFAULT_BANNER_VALID_BID[0].bidId);
|
|
2089
2164
|
|
|
2090
2165
|
expect(bannerImpression.banner.format).to.be.length(2);
|
|
@@ -2101,7 +2176,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2101
2176
|
});
|
|
2102
2177
|
|
|
2103
2178
|
it('should have native request', () => {
|
|
2104
|
-
const nativeImpression =
|
|
2179
|
+
const nativeImpression = extractPayload(request[1]).imp[0];
|
|
2105
2180
|
|
|
2106
2181
|
expect(request[1].data.hasOwnProperty('v')).to.equal(false);
|
|
2107
2182
|
expect(nativeImpression.id).to.equal(DEFAULT_NATIVE_VALID_BID[0].bidId);
|
|
@@ -2133,8 +2208,6 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2133
2208
|
const requests = spec.buildRequests([bid, DEFAULT_BANNER_VALID_BID[0]], DEFAULT_OPTION);
|
|
2134
2209
|
expect(requests).to.be.an('array');
|
|
2135
2210
|
expect(requests).to.have.lengthOf(2);
|
|
2136
|
-
expect(requests[0].data.sn).to.be.equal(0);
|
|
2137
|
-
expect(requests[1].data.sn).to.be.equal(1);
|
|
2138
2211
|
});
|
|
2139
2212
|
|
|
2140
2213
|
it('6 ad units should generate only 4 requests', function () {
|
|
@@ -2168,10 +2241,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2168
2241
|
for (var i = 0; i < requests.length; i++) {
|
|
2169
2242
|
const reqSize = `${requests[i].url}?${utils.parseQueryStringParameters(requests[i].data)}`.length;
|
|
2170
2243
|
expect(reqSize).to.be.lessThan(8000);
|
|
2171
|
-
let payload =
|
|
2172
|
-
if (requests.length > 1) {
|
|
2173
|
-
expect(requests[i].data.sn).to.equal(i);
|
|
2174
|
-
}
|
|
2244
|
+
let payload = extractPayload(requests[i]);
|
|
2175
2245
|
expect(payload.source.ext.schain).to.deep.equal(SAMPLE_SCHAIN);
|
|
2176
2246
|
}
|
|
2177
2247
|
});
|
|
@@ -2196,7 +2266,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2196
2266
|
expect(requests).to.be.an('array');
|
|
2197
2267
|
expect(requests).to.have.lengthOf(1);
|
|
2198
2268
|
|
|
2199
|
-
const impressions =
|
|
2269
|
+
const impressions = extractPayload(requests[0]).imp;
|
|
2200
2270
|
expect(impressions).to.be.an('array');
|
|
2201
2271
|
expect(impressions).to.have.lengthOf(3);
|
|
2202
2272
|
expect(requests[0].data.sn).to.be.undefined;
|
|
@@ -2212,7 +2282,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2212
2282
|
bid2.params.bidId = '2b3c4d5e';
|
|
2213
2283
|
|
|
2214
2284
|
const request = spec.buildRequests([bid, bid2], DEFAULT_OPTION)[0];
|
|
2215
|
-
const impression =
|
|
2285
|
+
const impression = extractPayload(request).imp[0];
|
|
2216
2286
|
const sidValue = bid.params.id;
|
|
2217
2287
|
|
|
2218
2288
|
expect(impression.id).to.equal(bid.bidId);
|
|
@@ -2242,7 +2312,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2242
2312
|
const bids = [DEFAULT_BANNER_VALID_BID[0], bid];
|
|
2243
2313
|
const request = spec.buildRequests(bids, DEFAULT_OPTION)[0];
|
|
2244
2314
|
|
|
2245
|
-
const impressions =
|
|
2315
|
+
const impressions = extractPayload(request).imp;
|
|
2246
2316
|
expect(impressions).to.be.an('array');
|
|
2247
2317
|
expect(impressions).to.have.lengthOf(2);
|
|
2248
2318
|
expect(request.data.sn).to.be.undefined;
|
|
@@ -2267,7 +2337,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2267
2337
|
|
|
2268
2338
|
it('request should not contain the extra video ad sizes that IX is not configured for', function () {
|
|
2269
2339
|
const request = spec.buildRequests(DEFAULT_VIDEO_VALID_BID, DEFAULT_OPTION);
|
|
2270
|
-
const impressions =
|
|
2340
|
+
const impressions = extractPayload(request[0]).imp;
|
|
2271
2341
|
|
|
2272
2342
|
expect(impressions).to.be.an('array');
|
|
2273
2343
|
expect(impressions).to.have.lengthOf(1);
|
|
@@ -2280,7 +2350,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2280
2350
|
|
|
2281
2351
|
const requests = spec.buildRequests([bid1, DEFAULT_BANNER_VALID_BID[0]], DEFAULT_OPTION);
|
|
2282
2352
|
|
|
2283
|
-
const impressions =
|
|
2353
|
+
const impressions = extractPayload(requests[0]).imp;
|
|
2284
2354
|
|
|
2285
2355
|
expect(impressions).to.be.an('array');
|
|
2286
2356
|
expect(impressions).to.have.lengthOf(1);
|
|
@@ -2290,24 +2360,15 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2290
2360
|
|
|
2291
2361
|
describe('buildRequestVideo', function () {
|
|
2292
2362
|
const request = spec.buildRequests(DEFAULT_VIDEO_VALID_BID, DEFAULT_OPTION);
|
|
2293
|
-
const
|
|
2294
|
-
|
|
2295
|
-
it('query object (version, siteID and request) should be correct', function () {
|
|
2296
|
-
expect(query.v).to.equal(VIDEO_ENDPOINT_VERSION);
|
|
2297
|
-
expect(query.s).to.equal(DEFAULT_VIDEO_VALID_BID[0].params.siteId);
|
|
2298
|
-
expect(query.r).to.exist;
|
|
2299
|
-
expect(query.ac).to.equal('j');
|
|
2300
|
-
expect(query.sd).to.equal(1);
|
|
2301
|
-
expect(query.nf).to.equal(1);
|
|
2302
|
-
});
|
|
2363
|
+
const payloadData = request[0].data;
|
|
2303
2364
|
|
|
2304
2365
|
it('auction type should be set correctly', function () {
|
|
2305
|
-
const at =
|
|
2366
|
+
const at = payloadData.at;
|
|
2306
2367
|
expect(at).to.equal(1);
|
|
2307
2368
|
})
|
|
2308
2369
|
|
|
2309
2370
|
it('impression should have correct format and value', function () {
|
|
2310
|
-
const impression =
|
|
2371
|
+
const impression = payloadData.imp[0];
|
|
2311
2372
|
|
|
2312
2373
|
expect(impression.id).to.equal(DEFAULT_VIDEO_VALID_BID[0].bidId);
|
|
2313
2374
|
expect(impression.video.w).to.equal(DEFAULT_VIDEO_VALID_BID[0].params.size[0]);
|
|
@@ -2326,7 +2387,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2326
2387
|
bid.mediaTypes.video.context = 'outstream';
|
|
2327
2388
|
bid.mediaTypes.video.placement = 2;
|
|
2328
2389
|
const request = spec.buildRequests([bid], {})[0];
|
|
2329
|
-
const impression =
|
|
2390
|
+
const impression = extractPayload(request).imp[0];
|
|
2330
2391
|
|
|
2331
2392
|
expect(impression.id).to.equal(DEFAULT_VIDEO_VALID_BID[0].bidId);
|
|
2332
2393
|
expect(impression.video.placement).to.equal(2);
|
|
@@ -2336,7 +2397,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2336
2397
|
const bid = utils.deepClone(DEFAULT_VIDEO_VALID_BID[0]);
|
|
2337
2398
|
bid.params.id = 50;
|
|
2338
2399
|
const request = spec.buildRequests([bid], {})[0];
|
|
2339
|
-
const impression =
|
|
2400
|
+
const impression = extractPayload(request).imp[0];
|
|
2340
2401
|
|
|
2341
2402
|
expect(impression.ext.sid).to.equal('50');
|
|
2342
2403
|
});
|
|
@@ -2345,7 +2406,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2345
2406
|
const bid = utils.deepClone(DEFAULT_VIDEO_VALID_BID[0]);
|
|
2346
2407
|
bid.mediaTypes.video.context = 'instream';
|
|
2347
2408
|
const request = spec.buildRequests([bid], {})[0];
|
|
2348
|
-
const impression =
|
|
2409
|
+
const impression = extractPayload(request).imp[0];
|
|
2349
2410
|
|
|
2350
2411
|
expect(impression.id).to.equal(DEFAULT_VIDEO_VALID_BID[0].bidId);
|
|
2351
2412
|
expect(impression.video.placement).to.equal(1);
|
|
@@ -2355,7 +2416,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2355
2416
|
const bid = utils.deepClone(DEFAULT_VIDEO_VALID_BID[0]);
|
|
2356
2417
|
bid.mediaTypes.video.context = 'outstream';
|
|
2357
2418
|
const request = spec.buildRequests([bid], {})[0];
|
|
2358
|
-
const impression =
|
|
2419
|
+
const impression = extractPayload(request).imp[0];
|
|
2359
2420
|
|
|
2360
2421
|
expect(impression.id).to.equal(DEFAULT_VIDEO_VALID_BID[0].bidId);
|
|
2361
2422
|
expect(impression.video.placement).to.equal(4);
|
|
@@ -2365,7 +2426,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2365
2426
|
const bid = utils.deepClone(DEFAULT_VIDEO_VALID_BID[0]);
|
|
2366
2427
|
bid.mediaTypes.video.context = 'not-valid';
|
|
2367
2428
|
const request = spec.buildRequests([bid], {})[0];
|
|
2368
|
-
const impression =
|
|
2429
|
+
const impression = extractPayload(request).imp[0];
|
|
2369
2430
|
expect(impression.video.placement).to.be.undefined;
|
|
2370
2431
|
});
|
|
2371
2432
|
|
|
@@ -2375,7 +2436,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2375
2436
|
bid.mediaTypes.video.protocols = [1];
|
|
2376
2437
|
bid.mediaTypes.video.mimes = ['video/override'];
|
|
2377
2438
|
const request = spec.buildRequests([bid], {})[0];
|
|
2378
|
-
const impression =
|
|
2439
|
+
const impression = extractPayload(request).imp[0];
|
|
2379
2440
|
|
|
2380
2441
|
expect(impression.video.protocols[0]).to.equal(2);
|
|
2381
2442
|
expect(impression.video.mimes[0]).to.not.equal('video/override');
|
|
@@ -2386,7 +2447,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2386
2447
|
bid.mediaTypes.video.context = 'outstream';
|
|
2387
2448
|
bid.mediaTypes.video.random = true;
|
|
2388
2449
|
const request = spec.buildRequests([bid], {})[0];
|
|
2389
|
-
const impression =
|
|
2450
|
+
const impression = extractPayload(request).imp[0];
|
|
2390
2451
|
|
|
2391
2452
|
expect(impression.video.random).to.not.exist;
|
|
2392
2453
|
});
|
|
@@ -2401,7 +2462,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2401
2462
|
bid.mediaTypes.video.api = 2;
|
|
2402
2463
|
bid.mediaTypes.video.pos = 0;
|
|
2403
2464
|
const request = spec.buildRequests([bid], {})[0];
|
|
2404
|
-
const impression =
|
|
2465
|
+
const impression = extractPayload(request).imp[0];
|
|
2405
2466
|
|
|
2406
2467
|
expect(impression.video.protocols[0]).to.equal(6);
|
|
2407
2468
|
expect(impression.video.api).to.equal(2);
|
|
@@ -2418,15 +2479,14 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2418
2479
|
}
|
|
2419
2480
|
};
|
|
2420
2481
|
const requests = spec.buildRequests(validBids, DEFAULT_OPTION);
|
|
2421
|
-
const { ext: { gpid } } =
|
|
2482
|
+
const { ext: { gpid } } = extractPayload(requests[0]).imp[0];
|
|
2422
2483
|
expect(gpid).to.equal(GPID);
|
|
2423
2484
|
});
|
|
2424
2485
|
|
|
2425
2486
|
it('should build video request when if video obj is not provided at params level', () => {
|
|
2426
2487
|
const request = spec.buildRequests([DEFAULT_VIDEO_VALID_BID_NO_VIDEO_PARAMS[0]], {});
|
|
2427
|
-
const videoImpression =
|
|
2488
|
+
const videoImpression = extractPayload(request[0]).imp[0];
|
|
2428
2489
|
|
|
2429
|
-
expect(JSON.parse(request[0].data.v)).to.equal(VIDEO_ENDPOINT_VERSION);
|
|
2430
2490
|
expect(videoImpression.id).to.equal(DEFAULT_VIDEO_VALID_BID_NO_VIDEO_PARAMS[0].bidId);
|
|
2431
2491
|
expect(videoImpression.video.w).to.equal(DEFAULT_VIDEO_VALID_BID_NO_VIDEO_PARAMS[0].mediaTypes.video.playerSize[0][0]);
|
|
2432
2492
|
expect(videoImpression.video.h).to.equal(DEFAULT_VIDEO_VALID_BID_NO_VIDEO_PARAMS[0].mediaTypes.video.playerSize[0][1]);
|
|
@@ -2440,23 +2500,18 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2440
2500
|
};
|
|
2441
2501
|
|
|
2442
2502
|
const request = spec.buildRequests([bid]);
|
|
2443
|
-
const videoImpression =
|
|
2503
|
+
const videoImpression = extractPayload(request[0]).imp[0];
|
|
2444
2504
|
|
|
2445
2505
|
expect(videoImpression.video.placement).to.eq(5);
|
|
2446
2506
|
})
|
|
2447
2507
|
});
|
|
2448
2508
|
|
|
2449
2509
|
describe('buildRequestNative', function () {
|
|
2450
|
-
it('should build request with expected params', function() {
|
|
2451
|
-
const request = spec.buildRequests(DEFAULT_NATIVE_VALID_BID, DEFAULT_OPTION);
|
|
2452
|
-
const query = request[0].data;
|
|
2510
|
+
it('should build request with expected params', function () {
|
|
2511
|
+
const request = spec.buildRequests(DEFAULT_NATIVE_VALID_BID, DEFAULT_OPTION)[0];
|
|
2453
2512
|
|
|
2454
|
-
expect(
|
|
2455
|
-
expect(
|
|
2456
|
-
expect(query.r).to.exist;
|
|
2457
|
-
expect(query.ac).to.equal('j');
|
|
2458
|
-
expect(query.sd).to.equal(1);
|
|
2459
|
-
expect(JSON.parse(query.r).at).to.equal(1);
|
|
2513
|
+
expect(request.data).to.exist;
|
|
2514
|
+
expect(request.method).to.equal('POST')
|
|
2460
2515
|
});
|
|
2461
2516
|
|
|
2462
2517
|
it('should send gpid in request if ortb2Imp.ext.gpid exists', function () {
|
|
@@ -2468,40 +2523,40 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2468
2523
|
}
|
|
2469
2524
|
};
|
|
2470
2525
|
const requests = spec.buildRequests(bids, DEFAULT_OPTION);
|
|
2471
|
-
const { ext: { gpid } } =
|
|
2526
|
+
const { ext: { gpid } } = extractPayload(requests[0]).imp[0];
|
|
2472
2527
|
expect(gpid).to.equal(GPID);
|
|
2473
2528
|
});
|
|
2474
2529
|
|
|
2475
|
-
it('should build request with required asset properties with default values', function() {
|
|
2530
|
+
it('should build request with required asset properties with default values', function () {
|
|
2476
2531
|
const request = spec.buildRequests(DEFAULT_NATIVE_VALID_BID, DEFAULT_OPTION);
|
|
2477
|
-
const nativeImpression =
|
|
2532
|
+
const nativeImpression = extractPayload(request[0]).imp[0];
|
|
2478
2533
|
|
|
2479
2534
|
expect(request[0].data.hasOwnProperty('v')).to.equal(false);
|
|
2480
2535
|
expect(nativeImpression.id).to.equal(DEFAULT_NATIVE_VALID_BID[0].bidId);
|
|
2481
2536
|
expect(nativeImpression.native).to.deep.equal(DEFAULT_NATIVE_IMP);
|
|
2482
2537
|
});
|
|
2483
2538
|
|
|
2484
|
-
it('should set imp.ext.sid for native imps if params.id exist', function() {
|
|
2539
|
+
it('should set imp.ext.sid for native imps if params.id exist', function () {
|
|
2485
2540
|
const bid = utils.deepClone(DEFAULT_NATIVE_VALID_BID);
|
|
2486
2541
|
bid[0].params.id = 'abc'
|
|
2487
2542
|
const request = spec.buildRequests(bid, DEFAULT_OPTION);
|
|
2488
|
-
const nativeImpression =
|
|
2543
|
+
const nativeImpression = extractPayload(request[0]).imp[0];
|
|
2489
2544
|
|
|
2490
2545
|
expect(nativeImpression.id).to.equal(DEFAULT_NATIVE_VALID_BID[0].bidId);
|
|
2491
2546
|
expect(nativeImpression.ext.sid).to.equal('abc');
|
|
2492
2547
|
});
|
|
2493
2548
|
|
|
2494
|
-
it('should build request with given asset properties', function() {
|
|
2549
|
+
it('should build request with given asset properties', function () {
|
|
2495
2550
|
let bid = utils.deepClone(DEFAULT_NATIVE_VALID_BID)
|
|
2496
2551
|
bid[0].nativeOrtbRequest = {
|
|
2497
|
-
assets: [{id: 0, required: 0, title: {len: 140}}, {id: 1, required: 0, video: {mimes: ['javascript'], minduration: 10, maxduration: 60, protocols: [1]}}]
|
|
2552
|
+
assets: [{ id: 0, required: 0, title: { len: 140 } }, { id: 1, required: 0, video: { mimes: ['javascript'], minduration: 10, maxduration: 60, protocols: [1] } }]
|
|
2498
2553
|
}
|
|
2499
2554
|
const request = spec.buildRequests(bid, DEFAULT_OPTION);
|
|
2500
|
-
const nativeImpression =
|
|
2501
|
-
expect(nativeImpression.native).to.deep.equal({request: '{"assets":[{"id":0,"required":0,"title":{"len":140}},{"id":1,"required":0,"video":{"mimes":["javascript"],"minduration":10,"maxduration":60,"protocols":[1]}}],"eventtrackers":[{"event":1,"methods":[1,2]}],"privacy":1}', ver: '1.2'});
|
|
2555
|
+
const nativeImpression = extractPayload(request[0]).imp[0];
|
|
2556
|
+
expect(nativeImpression.native).to.deep.equal({ request: '{"assets":[{"id":0,"required":0,"title":{"len":140}},{"id":1,"required":0,"video":{"mimes":["javascript"],"minduration":10,"maxduration":60,"protocols":[1]}}],"eventtrackers":[{"event":1,"methods":[1,2]}],"privacy":1}', ver: '1.2' });
|
|
2502
2557
|
});
|
|
2503
2558
|
|
|
2504
|
-
it('should build request with all possible Prebid asset properties', function() {
|
|
2559
|
+
it('should build request with all possible Prebid asset properties', function () {
|
|
2505
2560
|
let bid = utils.deepClone(DEFAULT_NATIVE_VALID_BID)
|
|
2506
2561
|
bid[0].nativeOrtbRequest = {
|
|
2507
2562
|
'ver': '1.2',
|
|
@@ -2626,17 +2681,16 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2626
2681
|
]
|
|
2627
2682
|
}
|
|
2628
2683
|
const request = spec.buildRequests(bid, DEFAULT_OPTION);
|
|
2629
|
-
const nativeImpression =
|
|
2630
|
-
expect(nativeImpression.native).to.deep.equal({request: '{"ver":"1.2","assets":[{"id":0,"required":0,"title":{"len":140}},{"id":1,"required":0,"data":{"type":2}},{"id":2,"required":0,"data":{"type":10}},{"id":3,"required":0,"data":{"type":1}},{"id":4,"required":0,"img":{"type":1}},{"id":5,"required":0,"img":{"type":3}},{"id":6,"required":0},{"id":7,"required":0,"data":{"type":11}},{"id":8,"required":0},{"id":9,"required":0},{"id":10,"required":0,"data":{"type":12}},{"id":11,"required":0,"data":{"type":3}},{"id":12,"required":0,"data":{"type":5}},{"id":13,"required":0,"data":{"type":4}},{"id":14,"required":0,"data":{"type":6}},{"id":15,"required":0,"data":{"type":7}},{"id":16,"required":0,"data":{"type":9}},{"id":17,"required":0,"data":{"type":8}}],"eventtrackers":[{"event":1,"methods":[1,2]}],"privacy":1}', ver: '1.2'});
|
|
2684
|
+
const nativeImpression = extractPayload(request[0]).imp[0];
|
|
2685
|
+
expect(nativeImpression.native).to.deep.equal({ request: '{"ver":"1.2","assets":[{"id":0,"required":0,"title":{"len":140}},{"id":1,"required":0,"data":{"type":2}},{"id":2,"required":0,"data":{"type":10}},{"id":3,"required":0,"data":{"type":1}},{"id":4,"required":0,"img":{"type":1}},{"id":5,"required":0,"img":{"type":3}},{"id":6,"required":0},{"id":7,"required":0,"data":{"type":11}},{"id":8,"required":0},{"id":9,"required":0},{"id":10,"required":0,"data":{"type":12}},{"id":11,"required":0,"data":{"type":3}},{"id":12,"required":0,"data":{"type":5}},{"id":13,"required":0,"data":{"type":4}},{"id":14,"required":0,"data":{"type":6}},{"id":15,"required":0,"data":{"type":7}},{"id":16,"required":0,"data":{"type":9}},{"id":17,"required":0,"data":{"type":8}}],"eventtrackers":[{"event":1,"methods":[1,2]}],"privacy":1}', ver: '1.2' });
|
|
2631
2686
|
})
|
|
2632
2687
|
});
|
|
2633
2688
|
|
|
2634
2689
|
describe('buildRequestMultiFormat', function () {
|
|
2635
2690
|
it('only banner bidder params set', function () {
|
|
2636
2691
|
const request = spec.buildRequests(DEFAULT_MULTIFORMAT_BANNER_VALID_BID, {})
|
|
2637
|
-
const bannerImpression =
|
|
2638
|
-
expect(
|
|
2639
|
-
expect(JSON.parse(request[0].data.v)).to.equal(BANNER_ENDPOINT_VERSION);
|
|
2692
|
+
const bannerImpression = extractPayload(request[0]).imp[0];
|
|
2693
|
+
expect(extractPayload(request[0]).imp).to.have.lengthOf(1);
|
|
2640
2694
|
expect(bannerImpression.id).to.equal(DEFAULT_MULTIFORMAT_BANNER_VALID_BID[0].bidId);
|
|
2641
2695
|
expect(bannerImpression.banner.format[0].w).to.equal(DEFAULT_MULTIFORMAT_BANNER_VALID_BID[0].params.size[0]);
|
|
2642
2696
|
expect(bannerImpression.banner.format[0].h).to.equal(DEFAULT_MULTIFORMAT_BANNER_VALID_BID[0].params.size[1]);
|
|
@@ -2645,9 +2699,8 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2645
2699
|
describe('only video bidder params set', function () {
|
|
2646
2700
|
it('should generate video impression', function () {
|
|
2647
2701
|
const request = spec.buildRequests(DEFAULT_MULTIFORMAT_VIDEO_VALID_BID, {});
|
|
2648
|
-
const videoImp =
|
|
2649
|
-
expect(
|
|
2650
|
-
expect(JSON.parse(request[1].data.v)).to.equal(VIDEO_ENDPOINT_VERSION);
|
|
2702
|
+
const videoImp = extractPayload(request[1]).imp[0];
|
|
2703
|
+
expect(extractPayload(request[1]).imp).to.have.lengthOf(1);
|
|
2651
2704
|
expect(videoImp.id).to.equal(DEFAULT_MULTIFORMAT_VIDEO_VALID_BID[0].bidId);
|
|
2652
2705
|
expect(videoImp.video.w).to.equal(DEFAULT_MULTIFORMAT_VIDEO_VALID_BID[0].params.size[0]);
|
|
2653
2706
|
expect(videoImp.video.h).to.equal(DEFAULT_MULTIFORMAT_VIDEO_VALID_BID[0].params.size[1]);
|
|
@@ -2659,10 +2712,9 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2659
2712
|
const request = spec.buildRequests(bids, {});
|
|
2660
2713
|
|
|
2661
2714
|
it('should return valid banner requests', function () {
|
|
2662
|
-
const impressions =
|
|
2715
|
+
const impressions = extractPayload(request[0]).imp;
|
|
2663
2716
|
|
|
2664
2717
|
expect(impressions).to.have.lengthOf(2);
|
|
2665
|
-
expect(JSON.parse(request[0].data.v)).to.equal(BANNER_ENDPOINT_VERSION);
|
|
2666
2718
|
|
|
2667
2719
|
impressions.map((impression, index) => {
|
|
2668
2720
|
const bid = bids[index];
|
|
@@ -2682,17 +2734,16 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2682
2734
|
});
|
|
2683
2735
|
|
|
2684
2736
|
it('should return valid banner and video requests', function () {
|
|
2685
|
-
const videoImpression =
|
|
2737
|
+
const videoImpression = extractPayload(request[1]).imp[0];
|
|
2686
2738
|
|
|
2687
|
-
expect(
|
|
2688
|
-
expect(JSON.parse(request[1].data.v)).to.equal(VIDEO_ENDPOINT_VERSION);
|
|
2739
|
+
expect(extractPayload(request[1]).imp).to.have.lengthOf(1);
|
|
2689
2740
|
expect(videoImpression.id).to.equal(DEFAULT_MULTIFORMAT_VIDEO_VALID_BID[0].bidId);
|
|
2690
2741
|
expect(videoImpression.video.w).to.equal(DEFAULT_MULTIFORMAT_VIDEO_VALID_BID[0].mediaTypes.video.playerSize[0][0]);
|
|
2691
2742
|
expect(videoImpression.video.h).to.equal(DEFAULT_MULTIFORMAT_VIDEO_VALID_BID[0].mediaTypes.video.playerSize[0][1]);
|
|
2692
2743
|
});
|
|
2693
2744
|
|
|
2694
2745
|
it('should contain all correct IXdiag properties', function () {
|
|
2695
|
-
const diagObj =
|
|
2746
|
+
const diagObj = extractPayload(request[0]).ext.ixdiag;
|
|
2696
2747
|
expect(diagObj.iu).to.equal(0);
|
|
2697
2748
|
expect(diagObj.nu).to.equal(0);
|
|
2698
2749
|
expect(diagObj.ou).to.equal(2);
|
|
@@ -2706,9 +2757,51 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2706
2757
|
expect(diagObj.adunitcode).to.equal(DEFAULT_MULTIFORMAT_VIDEO_VALID_BID[0].adUnitCode)
|
|
2707
2758
|
});
|
|
2708
2759
|
});
|
|
2760
|
+
|
|
2761
|
+
describe('siteId overrides', function () {
|
|
2762
|
+
it('should use siteId override', function () {
|
|
2763
|
+
const validBids = DEFAULT_MULTIFORMAT_VALID_BID;
|
|
2764
|
+
const request = spec.buildRequests(validBids, {});
|
|
2765
|
+
const bannerImps = request[0].data.imp[0];
|
|
2766
|
+
const videoImps = request[1].data.imp[0];
|
|
2767
|
+
const nativeImps = request[2].data.imp[0];
|
|
2768
|
+
expect(videoImps.ext.siteID).to.equal('1111');
|
|
2769
|
+
bannerImps.banner.format.map(({ ext }) => {
|
|
2770
|
+
expect(ext.siteID).to.equal('2222');
|
|
2771
|
+
});
|
|
2772
|
+
expect(nativeImps.ext.siteID).to.equal('3333');
|
|
2773
|
+
});
|
|
2774
|
+
|
|
2775
|
+
it('should use default siteId if overrides are not provided', function () {
|
|
2776
|
+
const validBids = DEFAULT_MULTIFORMAT_VALID_BID;
|
|
2777
|
+
delete validBids[0].params.banner;
|
|
2778
|
+
delete validBids[0].params.video;
|
|
2779
|
+
delete validBids[0].params.native;
|
|
2780
|
+
const request = spec.buildRequests(validBids, {});
|
|
2781
|
+
const bannerImps = request[0].data.imp[0];
|
|
2782
|
+
const videoImps = request[1].data.imp[0];
|
|
2783
|
+
const nativeImps = request[2].data.imp[0];
|
|
2784
|
+
expect(videoImps.ext.siteID).to.equal('456');
|
|
2785
|
+
bannerImps.banner.format.map(({ ext }) => {
|
|
2786
|
+
expect(ext.siteID).to.equal('456');
|
|
2787
|
+
});
|
|
2788
|
+
expect(nativeImps.ext.siteID).to.equal('456');
|
|
2789
|
+
});
|
|
2790
|
+
});
|
|
2709
2791
|
});
|
|
2710
2792
|
|
|
2711
2793
|
describe('interpretResponse', function () {
|
|
2794
|
+
// generate bidderRequest with real buildRequest logic for intepretResponse testing
|
|
2795
|
+
let bannerBidderRequest
|
|
2796
|
+
let videoBidderRequest
|
|
2797
|
+
let nativeBidderRequest
|
|
2798
|
+
|
|
2799
|
+
beforeEach(() => {
|
|
2800
|
+
bannerBidderRequest = spec.buildRequests(DEFAULT_BANNER_VALID_BID, {})[0]
|
|
2801
|
+
videoBidderRequest = spec.buildRequests(DEFAULT_VIDEO_VALID_BID_MEDIUM_SIZE, {})[0]
|
|
2802
|
+
nativeBidderRequest = spec.buildRequests(DEFAULT_NATIVE_VALID_BID, {})[0]
|
|
2803
|
+
});
|
|
2804
|
+
|
|
2712
2805
|
it('should get correct bid response for banner ad', function () {
|
|
2713
2806
|
const expectedParse = [
|
|
2714
2807
|
{
|
|
@@ -2730,7 +2823,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2730
2823
|
}
|
|
2731
2824
|
}
|
|
2732
2825
|
];
|
|
2733
|
-
const result = spec.interpretResponse({ body: DEFAULT_BANNER_BID_RESPONSE },
|
|
2826
|
+
const result = spec.interpretResponse({ body: DEFAULT_BANNER_BID_RESPONSE }, bannerBidderRequest);
|
|
2734
2827
|
expect(result[0]).to.deep.equal(expectedParse[0]);
|
|
2735
2828
|
});
|
|
2736
2829
|
|
|
@@ -2754,7 +2847,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2754
2847
|
}
|
|
2755
2848
|
}
|
|
2756
2849
|
];
|
|
2757
|
-
const result = spec.interpretResponse({ body: DEFAULT_BANNER_BID_RESPONSE_WITHOUT_ADOMAIN },
|
|
2850
|
+
const result = spec.interpretResponse({ body: DEFAULT_BANNER_BID_RESPONSE_WITHOUT_ADOMAIN }, bannerBidderRequest);
|
|
2758
2851
|
expect(result[0]).to.deep.equal(expectedParse[0]);
|
|
2759
2852
|
});
|
|
2760
2853
|
|
|
@@ -2781,7 +2874,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2781
2874
|
}
|
|
2782
2875
|
}
|
|
2783
2876
|
];
|
|
2784
|
-
const result = spec.interpretResponse({ body: bidResponse },
|
|
2877
|
+
const result = spec.interpretResponse({ body: bidResponse }, bannerBidderRequest);
|
|
2785
2878
|
});
|
|
2786
2879
|
|
|
2787
2880
|
it('should set Japanese price correctly', function () {
|
|
@@ -2807,7 +2900,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2807
2900
|
}
|
|
2808
2901
|
}
|
|
2809
2902
|
];
|
|
2810
|
-
const result = spec.interpretResponse({ body: bidResponse },
|
|
2903
|
+
const result = spec.interpretResponse({ body: bidResponse }, bannerBidderRequest);
|
|
2811
2904
|
expect(result[0]).to.deep.equal(expectedParse[0]);
|
|
2812
2905
|
});
|
|
2813
2906
|
|
|
@@ -2836,7 +2929,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2836
2929
|
}
|
|
2837
2930
|
}
|
|
2838
2931
|
];
|
|
2839
|
-
const result = spec.interpretResponse({ body: bidResponse },
|
|
2932
|
+
const result = spec.interpretResponse({ body: bidResponse }, bannerBidderRequest);
|
|
2840
2933
|
|
|
2841
2934
|
expect(result[0].dealId).to.equal(expectedParse[0].dealId);
|
|
2842
2935
|
});
|
|
@@ -2863,7 +2956,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2863
2956
|
}
|
|
2864
2957
|
}
|
|
2865
2958
|
];
|
|
2866
|
-
const result = spec.interpretResponse({ body: bidResponse },
|
|
2959
|
+
const result = spec.interpretResponse({ body: bidResponse }, bannerBidderRequest);
|
|
2867
2960
|
expect(result[0]).to.deep.equal(expectedParse[0]);
|
|
2868
2961
|
});
|
|
2869
2962
|
|
|
@@ -2891,7 +2984,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2891
2984
|
}
|
|
2892
2985
|
}
|
|
2893
2986
|
];
|
|
2894
|
-
const result = spec.interpretResponse({ body: bidResponse },
|
|
2987
|
+
const result = spec.interpretResponse({ body: bidResponse }, bannerBidderRequest);
|
|
2895
2988
|
expect(result[0].dealId).to.deep.equal(expectedParse[0].dealId);
|
|
2896
2989
|
});
|
|
2897
2990
|
|
|
@@ -2928,7 +3021,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2928
3021
|
}
|
|
2929
3022
|
];
|
|
2930
3023
|
const result = spec.interpretResponse({ body: DEFAULT_VIDEO_BID_RESPONSE }, {
|
|
2931
|
-
data:
|
|
3024
|
+
data: videoBidderRequest.data, validBidRequests: ONE_VIDEO
|
|
2932
3025
|
});
|
|
2933
3026
|
|
|
2934
3027
|
expect(result[0]).to.deep.equal(expectedParse[0]);
|
|
@@ -2936,14 +3029,14 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2936
3029
|
|
|
2937
3030
|
it('should set bid[].renderer if renderer not defined at mediaType.video level', function () {
|
|
2938
3031
|
const bid = spec.interpretResponse({ body: DEFAULT_VIDEO_BID_RESPONSE }, {
|
|
2939
|
-
data:
|
|
3032
|
+
data: videoBidderRequest.data, validBidRequests: DEFAULT_MULTIFORMAT_BANNER_VALID_BID
|
|
2940
3033
|
});
|
|
2941
3034
|
expect(bid[0].renderer).to.exist;
|
|
2942
3035
|
});
|
|
2943
3036
|
|
|
2944
3037
|
it('should set renderer URL by parsing video response', function () {
|
|
2945
3038
|
const bid = spec.interpretResponse({ body: DEFAULT_VIDEO_BID_RESPONSE }, {
|
|
2946
|
-
data:
|
|
3039
|
+
data: videoBidderRequest.data, validBidRequests: DEFAULT_MULTIFORMAT_BANNER_VALID_BID
|
|
2947
3040
|
});
|
|
2948
3041
|
expect(bid[0].renderer.url).to.equal(DEFAULT_VIDEO_BID_RESPONSE.ext.videoplayerurl);
|
|
2949
3042
|
});
|
|
@@ -2952,10 +3045,10 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2952
3045
|
let outstreamAdUnit = utils.deepClone(DEFAULT_MULTIFORMAT_BANNER_VALID_BID);
|
|
2953
3046
|
outstreamAdUnit[0].mediaTypes.video.renderer = {
|
|
2954
3047
|
url: 'test',
|
|
2955
|
-
render: function() {}
|
|
3048
|
+
render: function () { }
|
|
2956
3049
|
};
|
|
2957
3050
|
const bid = spec.interpretResponse({ body: DEFAULT_VIDEO_BID_RESPONSE }, {
|
|
2958
|
-
data:
|
|
3051
|
+
data: videoBidderRequest.data, validBidRequests: outstreamAdUnit
|
|
2959
3052
|
});
|
|
2960
3053
|
expect(bid[0].renderer).to.be.undefined;
|
|
2961
3054
|
});
|
|
@@ -2964,10 +3057,10 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2964
3057
|
let outstreamAdUnit = utils.deepClone(DEFAULT_MULTIFORMAT_BANNER_VALID_BID);
|
|
2965
3058
|
outstreamAdUnit[0].renderer = {
|
|
2966
3059
|
url: 'test',
|
|
2967
|
-
render: function() {}
|
|
3060
|
+
render: function () { }
|
|
2968
3061
|
};
|
|
2969
3062
|
const bid = spec.interpretResponse({ body: DEFAULT_VIDEO_BID_RESPONSE }, {
|
|
2970
|
-
data:
|
|
3063
|
+
data: videoBidderRequest.data, validBidRequests: outstreamAdUnit
|
|
2971
3064
|
});
|
|
2972
3065
|
expect(bid[0].renderer).to.be.undefined;
|
|
2973
3066
|
});
|
|
@@ -2978,7 +3071,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2978
3071
|
url: 'test'
|
|
2979
3072
|
};
|
|
2980
3073
|
const bid = spec.interpretResponse({ body: DEFAULT_VIDEO_BID_RESPONSE }, {
|
|
2981
|
-
data:
|
|
3074
|
+
data: videoBidderRequest.data, validBidRequests: outstreamAdUnit
|
|
2982
3075
|
});
|
|
2983
3076
|
expect(bid[0].renderer).to.exist;
|
|
2984
3077
|
});
|
|
@@ -2987,11 +3080,11 @@ describe('IndexexchangeAdapter', function () {
|
|
|
2987
3080
|
let outstreamAdUnit = utils.deepClone(DEFAULT_MULTIFORMAT_BANNER_VALID_BID);
|
|
2988
3081
|
outstreamAdUnit[0].mediaTypes.video.renderer = {
|
|
2989
3082
|
url: 'test',
|
|
2990
|
-
render: function() {},
|
|
3083
|
+
render: function () { },
|
|
2991
3084
|
backupOnly: true
|
|
2992
3085
|
};
|
|
2993
3086
|
const bid = spec.interpretResponse({ body: DEFAULT_VIDEO_BID_RESPONSE }, {
|
|
2994
|
-
data:
|
|
3087
|
+
data: videoBidderRequest.data, validBidRequests: outstreamAdUnit
|
|
2995
3088
|
});
|
|
2996
3089
|
expect(bid[0].renderer).to.exist;
|
|
2997
3090
|
});
|
|
@@ -3029,7 +3122,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
3029
3122
|
}
|
|
3030
3123
|
];
|
|
3031
3124
|
const result = spec.interpretResponse({ body: DEFAULT_VIDEO_BID_RESPONSE_WITH_MTYPE_SET }, {
|
|
3032
|
-
data:
|
|
3125
|
+
data: videoBidderRequest.data, validBidRequests: ONE_VIDEO
|
|
3033
3126
|
});
|
|
3034
3127
|
|
|
3035
3128
|
expect(result[0]).to.deep.equal(expectedParse[0]);
|
|
@@ -3038,10 +3131,11 @@ describe('IndexexchangeAdapter', function () {
|
|
|
3038
3131
|
it('bidrequest should not have page if options is undefined', function () {
|
|
3039
3132
|
const options = {};
|
|
3040
3133
|
const validBidWithoutreferInfo = spec.buildRequests(DEFAULT_BANNER_VALID_BID, options);
|
|
3041
|
-
const requestWithoutreferInfo =
|
|
3134
|
+
const requestWithoutreferInfo = extractPayload(validBidWithoutreferInfo[0]);
|
|
3042
3135
|
|
|
3136
|
+
const expectedURL = IX_SECURE_ENDPOINT + '?s=' + DEFAULT_BANNER_VALID_BID[0].params.siteId
|
|
3043
3137
|
expect(requestWithoutreferInfo.site.page).to.be.undefined;
|
|
3044
|
-
expect(validBidWithoutreferInfo[0].url).to.equal(
|
|
3138
|
+
expect(validBidWithoutreferInfo[0].url).to.equal(expectedURL);
|
|
3045
3139
|
});
|
|
3046
3140
|
|
|
3047
3141
|
it('bidrequest should not have page if options.refererInfo is an empty object', function () {
|
|
@@ -3049,10 +3143,11 @@ describe('IndexexchangeAdapter', function () {
|
|
|
3049
3143
|
refererInfo: {}
|
|
3050
3144
|
};
|
|
3051
3145
|
const validBidWithoutreferInfo = spec.buildRequests(DEFAULT_BANNER_VALID_BID, options);
|
|
3052
|
-
const requestWithoutreferInfo =
|
|
3146
|
+
const requestWithoutreferInfo = extractPayload(validBidWithoutreferInfo[0]);
|
|
3053
3147
|
|
|
3148
|
+
const expectedURL = IX_SECURE_ENDPOINT + '?s=' + DEFAULT_BANNER_VALID_BID[0].params.siteId
|
|
3054
3149
|
expect(requestWithoutreferInfo.site.page).to.be.undefined;
|
|
3055
|
-
expect(validBidWithoutreferInfo[0].url).to.equal(
|
|
3150
|
+
expect(validBidWithoutreferInfo[0].url).to.equal(expectedURL);
|
|
3056
3151
|
});
|
|
3057
3152
|
|
|
3058
3153
|
it('bidrequest should sent to secure endpoint if page url is secure', function () {
|
|
@@ -3062,10 +3157,11 @@ describe('IndexexchangeAdapter', function () {
|
|
|
3062
3157
|
}
|
|
3063
3158
|
};
|
|
3064
3159
|
const validBidWithoutreferInfo = spec.buildRequests(DEFAULT_BANNER_VALID_BID, options);
|
|
3065
|
-
const requestWithoutreferInfo =
|
|
3160
|
+
const requestWithoutreferInfo = extractPayload(validBidWithoutreferInfo[0]);
|
|
3066
3161
|
|
|
3162
|
+
const expectedURL = IX_SECURE_ENDPOINT + '?s=' + DEFAULT_BANNER_VALID_BID[0].params.siteId
|
|
3067
3163
|
expect(requestWithoutreferInfo.site.page).to.equal(options.refererInfo.page);
|
|
3068
|
-
expect(validBidWithoutreferInfo[0].url).to.equal(
|
|
3164
|
+
expect(validBidWithoutreferInfo[0].url).to.equal(expectedURL);
|
|
3069
3165
|
});
|
|
3070
3166
|
|
|
3071
3167
|
it('should set bid[].ttl to seatbid[].bid[].exp value from response', function () {
|
|
@@ -3073,16 +3169,16 @@ describe('IndexexchangeAdapter', function () {
|
|
|
3073
3169
|
const VIDEO_RESPONSE_WITH_EXP = utils.deepClone(DEFAULT_VIDEO_BID_RESPONSE);
|
|
3074
3170
|
VIDEO_RESPONSE_WITH_EXP.seatbid[0].bid[0].exp = 200;
|
|
3075
3171
|
BANNER_RESPONSE_WITH_EXP.seatbid[0].bid[0].exp = 100;
|
|
3076
|
-
const bannerResult = spec.interpretResponse({ body: BANNER_RESPONSE_WITH_EXP },
|
|
3077
|
-
const videoResult = spec.interpretResponse({ body: VIDEO_RESPONSE_WITH_EXP },
|
|
3172
|
+
const bannerResult = spec.interpretResponse({ body: BANNER_RESPONSE_WITH_EXP }, bannerBidderRequest);
|
|
3173
|
+
const videoResult = spec.interpretResponse({ body: VIDEO_RESPONSE_WITH_EXP }, videoBidderRequest);
|
|
3078
3174
|
|
|
3079
3175
|
expect(bannerResult[0].ttl).to.equal(100);
|
|
3080
3176
|
expect(videoResult[0].ttl).to.equal(200);
|
|
3081
3177
|
});
|
|
3082
3178
|
|
|
3083
3179
|
it('should default bid[].ttl if seat[].bid[].exp is not in the resposne', function () {
|
|
3084
|
-
const bannerResult = spec.interpretResponse({ body: DEFAULT_BANNER_BID_RESPONSE },
|
|
3085
|
-
const videoResult = spec.interpretResponse({ body: DEFAULT_VIDEO_BID_RESPONSE },
|
|
3180
|
+
const bannerResult = spec.interpretResponse({ body: DEFAULT_BANNER_BID_RESPONSE }, bannerBidderRequest);
|
|
3181
|
+
const videoResult = spec.interpretResponse({ body: DEFAULT_VIDEO_BID_RESPONSE }, videoBidderRequest);
|
|
3086
3182
|
|
|
3087
3183
|
expect(bannerResult[0].ttl).to.equal(300);
|
|
3088
3184
|
expect(videoResult[0].ttl).to.equal(3600);
|
|
@@ -3174,7 +3270,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
3174
3270
|
ttl: 3600
|
|
3175
3271
|
}
|
|
3176
3272
|
];
|
|
3177
|
-
const result = spec.interpretResponse({ body: DEFAULT_NATIVE_BID_RESPONSE },
|
|
3273
|
+
const result = spec.interpretResponse({ body: DEFAULT_NATIVE_BID_RESPONSE }, nativeBidderRequest);
|
|
3178
3274
|
expect(result[0]).to.deep.equal(expectedParse[0]);
|
|
3179
3275
|
});
|
|
3180
3276
|
});
|
|
@@ -3182,7 +3278,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
3182
3278
|
describe('bidrequest consent', function () {
|
|
3183
3279
|
it('should have consent info if gdprApplies and consentString exist', function () {
|
|
3184
3280
|
const validBidWithConsent = spec.buildRequests(DEFAULT_BANNER_VALID_BID, DEFAULT_OPTION);
|
|
3185
|
-
const requestWithConsent =
|
|
3281
|
+
const requestWithConsent = extractPayload(validBidWithConsent[0]);
|
|
3186
3282
|
|
|
3187
3283
|
expect(requestWithConsent.regs.ext.gdpr).to.equal(1);
|
|
3188
3284
|
expect(requestWithConsent.user.ext.consent).to.equal('3huaa11=qu3198ae');
|
|
@@ -3196,7 +3292,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
3196
3292
|
}
|
|
3197
3293
|
};
|
|
3198
3294
|
const validBidWithConsent = spec.buildRequests(DEFAULT_BANNER_VALID_BID, options);
|
|
3199
|
-
const requestWithConsent =
|
|
3295
|
+
const requestWithConsent = extractPayload(validBidWithConsent[0]);
|
|
3200
3296
|
|
|
3201
3297
|
expect(requestWithConsent.regs.ext.gdpr).to.equal(1);
|
|
3202
3298
|
expect(requestWithConsent.user).to.be.undefined;
|
|
@@ -3210,7 +3306,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
3210
3306
|
}
|
|
3211
3307
|
};
|
|
3212
3308
|
const validBidWithConsent = spec.buildRequests(DEFAULT_BANNER_VALID_BID, options);
|
|
3213
|
-
const requestWithConsent =
|
|
3309
|
+
const requestWithConsent = extractPayload(validBidWithConsent[0]);
|
|
3214
3310
|
|
|
3215
3311
|
expect(requestWithConsent.regs).to.be.undefined;
|
|
3216
3312
|
expect(requestWithConsent.user.ext.consent).to.equal('3huaa11=qu3198ae');
|
|
@@ -3219,7 +3315,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
3219
3315
|
it('should not have consent info if options.gdprConsent is undefined', function () {
|
|
3220
3316
|
const options = {};
|
|
3221
3317
|
const validBidWithConsent = spec.buildRequests(DEFAULT_BANNER_VALID_BID, options);
|
|
3222
|
-
const requestWithConsent =
|
|
3318
|
+
const requestWithConsent = extractPayload(validBidWithConsent[0]);
|
|
3223
3319
|
|
|
3224
3320
|
expect(requestWithConsent.regs).to.be.undefined;
|
|
3225
3321
|
expect(requestWithConsent.user).to.be.undefined;
|
|
@@ -3230,7 +3326,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
3230
3326
|
uspConsent: '1YYN'
|
|
3231
3327
|
};
|
|
3232
3328
|
const validBidWithUspConsent = spec.buildRequests(DEFAULT_BANNER_VALID_BID, options);
|
|
3233
|
-
const requestWithUspConsent =
|
|
3329
|
+
const requestWithUspConsent = extractPayload(validBidWithUspConsent[0]);
|
|
3234
3330
|
|
|
3235
3331
|
expect(requestWithUspConsent.regs.ext.us_privacy).to.equal('1YYN');
|
|
3236
3332
|
});
|
|
@@ -3238,7 +3334,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
3238
3334
|
it('should not have us_privacy if uspConsent undefined', function () {
|
|
3239
3335
|
const options = {};
|
|
3240
3336
|
const validBidWithUspConsent = spec.buildRequests(DEFAULT_BANNER_VALID_BID, options);
|
|
3241
|
-
const requestWithUspConsent =
|
|
3337
|
+
const requestWithUspConsent = extractPayload(validBidWithUspConsent[0]);
|
|
3242
3338
|
|
|
3243
3339
|
expect(requestWithUspConsent.regs).to.be.undefined;
|
|
3244
3340
|
});
|
|
@@ -3252,7 +3348,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
3252
3348
|
uspConsent: '1YYN'
|
|
3253
3349
|
};
|
|
3254
3350
|
const validBidWithConsent = spec.buildRequests(DEFAULT_BANNER_VALID_BID, options);
|
|
3255
|
-
const requestWithConsent =
|
|
3351
|
+
const requestWithConsent = extractPayload(validBidWithConsent[0]);
|
|
3256
3352
|
expect(requestWithConsent.regs.ext.gdpr).to.equal(1);
|
|
3257
3353
|
expect(requestWithConsent.regs.ext.us_privacy).to.equal('1YYN');
|
|
3258
3354
|
});
|
|
@@ -3266,7 +3362,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
3266
3362
|
};
|
|
3267
3363
|
|
|
3268
3364
|
const validBidWithConsent = spec.buildRequests(DEFAULT_BANNER_VALID_BID, options);
|
|
3269
|
-
const requestWithConsent =
|
|
3365
|
+
const requestWithConsent = extractPayload(validBidWithConsent[0]);
|
|
3270
3366
|
expect(requestWithConsent.user.ext.consented_providers_settings.consented_providers).to.equal('1~1.35.41.101');
|
|
3271
3367
|
expect(requestWithConsent.user.ext.consent).to.equal('3huaa11=qu3198ae');
|
|
3272
3368
|
});
|
|
@@ -3279,7 +3375,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
3279
3375
|
};
|
|
3280
3376
|
|
|
3281
3377
|
const validBidWithConsent = spec.buildRequests(DEFAULT_BANNER_VALID_BID, options);
|
|
3282
|
-
const requestWithConsent =
|
|
3378
|
+
const requestWithConsent = extractPayload(validBidWithConsent[0]);
|
|
3283
3379
|
expect(utils.deepAccess(requestWithConsent, 'user.ext.consented_providers_settings')).to.not.exist;
|
|
3284
3380
|
expect(utils.deepAccess(requestWithConsent, 'user.ext.consent')).to.not.exist;
|
|
3285
3381
|
});
|
|
@@ -3287,21 +3383,21 @@ describe('IndexexchangeAdapter', function () {
|
|
|
3287
3383
|
it('should set coppa to 1 in config when enabled', () => {
|
|
3288
3384
|
config.setConfig({ coppa: true })
|
|
3289
3385
|
const bid = spec.buildRequests(DEFAULT_BANNER_VALID_BID, DEFAULT_OPTION);
|
|
3290
|
-
const r =
|
|
3386
|
+
const r = extractPayload(bid[0]);
|
|
3291
3387
|
|
|
3292
3388
|
expect(r.regs.coppa).to.equal(1);
|
|
3293
3389
|
});
|
|
3294
3390
|
it('should not set coppa in config when disabled', () => {
|
|
3295
3391
|
config.setConfig({ coppa: false })
|
|
3296
3392
|
const bid = spec.buildRequests(DEFAULT_BANNER_VALID_BID, DEFAULT_OPTION);
|
|
3297
|
-
const r =
|
|
3393
|
+
const r = extractPayload(bid[0]);
|
|
3298
3394
|
|
|
3299
3395
|
expect(r.regs.coppa).to.be.undefined;
|
|
3300
3396
|
});
|
|
3301
3397
|
it('should not set coppa when not specified in config', () => {
|
|
3302
3398
|
config.resetConfig();
|
|
3303
3399
|
const bid = spec.buildRequests(DEFAULT_BANNER_VALID_BID, DEFAULT_OPTION);
|
|
3304
|
-
const r =
|
|
3400
|
+
const r = extractPayload(bid[0]);
|
|
3305
3401
|
|
|
3306
3402
|
expect(r.regs.coppa).to.be.undefined;
|
|
3307
3403
|
});
|
|
@@ -3403,125 +3499,97 @@ describe('IndexexchangeAdapter', function () {
|
|
|
3403
3499
|
expect(FEATURE_TOGGLES.featureToggles).to.deep.equal({});
|
|
3404
3500
|
});
|
|
3405
3501
|
|
|
3406
|
-
it('should
|
|
3502
|
+
it('should set request size limit to 32KB when its feature enabled', () => {
|
|
3407
3503
|
sandbox.stub(storage, 'localStorageIsEnabled').returns(true);
|
|
3408
|
-
serverResponse.body.ext.features.
|
|
3504
|
+
serverResponse.body.ext.features.pbjs_use_32kb_size_limit = {
|
|
3409
3505
|
activated: true
|
|
3410
3506
|
};
|
|
3411
3507
|
FEATURE_TOGGLES.setFeatureToggles(serverResponse);
|
|
3412
|
-
const
|
|
3413
|
-
|
|
3414
|
-
request: spec.buildRequests(DEFAULT_BANNER_VALID_BID, DEFAULT_OPTION)[0],
|
|
3415
|
-
siteId: DEFAULT_BANNER_VALID_BID[0].params.siteId
|
|
3416
|
-
},
|
|
3417
|
-
video: {
|
|
3418
|
-
request: spec.buildRequests(DEFAULT_VIDEO_VALID_BID, DEFAULT_OPTION)[0],
|
|
3419
|
-
siteId: DEFAULT_VIDEO_VALID_BID[0].params.siteId
|
|
3420
|
-
},
|
|
3421
|
-
native: {
|
|
3422
|
-
request: spec.buildRequests(DEFAULT_NATIVE_VALID_BID, DEFAULT_OPTION)[0],
|
|
3423
|
-
siteId: DEFAULT_NATIVE_VALID_BID[0].params.siteId
|
|
3424
|
-
}
|
|
3425
|
-
};
|
|
3508
|
+
const bid = utils.deepClone(DEFAULT_MULTIFORMAT_VIDEO_VALID_BID[0]);
|
|
3509
|
+
bid.bidderRequestId = Array(10000).join('#');
|
|
3426
3510
|
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
expect(request.option.contentType).to.equal('text/plain');
|
|
3432
|
-
expect(request.url).to.be.equal(`${IX_SECURE_ENDPOINT}?s=${siteId}`);
|
|
3433
|
-
expect(request.data.r).to.be.undefined;
|
|
3434
|
-
expect(request.data.ac).to.be.undefined;
|
|
3435
|
-
expect(request.data.sd).to.be.undefined;
|
|
3436
|
-
expect(request.data.v).to.be.undefined;
|
|
3437
|
-
expect(request.data.nf).to.be.undefined;
|
|
3438
|
-
});
|
|
3511
|
+
expect(spec.isBidRequestValid(bid)).to.be.true;
|
|
3512
|
+
spec.buildRequests([bid], {});
|
|
3513
|
+
const lsData = JSON.parse(storage.getDataFromLocalStorage(LOCAL_STORAGE_FEATURE_TOGGLES_KEY));
|
|
3514
|
+
expect(lsData.features.pbjs_use_32kb_size_limit.activated).to.be.true;
|
|
3439
3515
|
});
|
|
3440
3516
|
|
|
3441
|
-
it('should
|
|
3517
|
+
it('6 ad units should generate only 2 requests if 32kb size limit FT is enabled', function () {
|
|
3442
3518
|
sandbox.stub(storage, 'localStorageIsEnabled').returns(true);
|
|
3519
|
+
serverResponse.body.ext.features.pbjs_use_32kb_size_limit = {
|
|
3520
|
+
activated: true
|
|
3521
|
+
};
|
|
3443
3522
|
serverResponse.body.ext.features.pbjs_enable_post = {
|
|
3444
|
-
activated:
|
|
3523
|
+
activated: true
|
|
3445
3524
|
};
|
|
3446
3525
|
FEATURE_TOGGLES.setFeatureToggles(serverResponse);
|
|
3447
|
-
const builtRequests = {
|
|
3448
|
-
banner: {
|
|
3449
|
-
request: spec.buildRequests(DEFAULT_BANNER_VALID_BID, DEFAULT_OPTION)[0],
|
|
3450
|
-
siteId: DEFAULT_BANNER_VALID_BID[0].params.siteId
|
|
3451
|
-
},
|
|
3452
|
-
video: {
|
|
3453
|
-
request: spec.buildRequests(DEFAULT_VIDEO_VALID_BID, DEFAULT_OPTION)[0],
|
|
3454
|
-
siteId: DEFAULT_VIDEO_VALID_BID[0].params.siteId
|
|
3455
|
-
},
|
|
3456
|
-
native: {
|
|
3457
|
-
request: spec.buildRequests(DEFAULT_NATIVE_VALID_BID, DEFAULT_OPTION)[0],
|
|
3458
|
-
siteId: DEFAULT_NATIVE_VALID_BID[0].params.siteId
|
|
3459
|
-
}
|
|
3460
|
-
};
|
|
3461
3526
|
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
expect(request.data.ac).to.equal('j');
|
|
3469
|
-
expect(request.data.sd).to.equal(1);
|
|
3470
|
-
expect(request.data.s).to.equal(siteId);
|
|
3471
|
-
if (reqType == 'video') {
|
|
3472
|
-
expect(request.data.nf).to.equal(1);
|
|
3473
|
-
}
|
|
3527
|
+
const bid1 = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]);
|
|
3528
|
+
bid1.mediaTypes.banner.sizes = LARGE_SET_OF_SIZES;
|
|
3529
|
+
bid1.params.siteId = '121';
|
|
3530
|
+
bid1.adUnitCode = 'div-gpt-1'
|
|
3531
|
+
bid1.transactionId = 'tr1';
|
|
3532
|
+
bid1.bidId = '2f6g5s5e';
|
|
3474
3533
|
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3534
|
+
const bid2 = utils.deepClone(bid1);
|
|
3535
|
+
bid2.transactionId = 'tr2';
|
|
3536
|
+
|
|
3537
|
+
const bid3 = utils.deepClone(bid1);
|
|
3538
|
+
bid3.transactionId = 'tr3';
|
|
3539
|
+
|
|
3540
|
+
const bid4 = utils.deepClone(bid1);
|
|
3541
|
+
bid4.transactionId = 'tr4';
|
|
3542
|
+
|
|
3543
|
+
const bid5 = utils.deepClone(bid1);
|
|
3544
|
+
bid5.transactionId = 'tr5';
|
|
3545
|
+
|
|
3546
|
+
const bid6 = utils.deepClone(bid1);
|
|
3547
|
+
bid6.transactionId = 'tr6';
|
|
3548
|
+
|
|
3549
|
+
const requests = spec.buildRequests([bid1, bid2, bid3, bid4, bid5, bid6], DEFAULT_OPTION);
|
|
3550
|
+
|
|
3551
|
+
expect(requests).to.be.an('array');
|
|
3552
|
+
// 32KB size limit causes only 2 requests to get generated.
|
|
3553
|
+
expect(requests).to.have.lengthOf(2);
|
|
3554
|
+
for (let request of requests) {
|
|
3555
|
+
expect(request.method).to.equal('POST');
|
|
3556
|
+
}
|
|
3479
3557
|
});
|
|
3480
3558
|
|
|
3481
|
-
it('should
|
|
3559
|
+
it('4 ad units should generate only 1 requests if 32kb size limit FT is enabled', function () {
|
|
3560
|
+
sandbox.stub(storage, 'localStorageIsEnabled').returns(true);
|
|
3561
|
+
serverResponse.body.ext.features.pbjs_use_32kb_size_limit = {
|
|
3562
|
+
activated: true
|
|
3563
|
+
};
|
|
3482
3564
|
serverResponse.body.ext.features.pbjs_enable_post = {
|
|
3483
3565
|
activated: true
|
|
3484
3566
|
};
|
|
3485
3567
|
FEATURE_TOGGLES.setFeatureToggles(serverResponse);
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
const
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
ad: '<a target="_blank" href="https://www.indexexchange.com"></a>',
|
|
3512
|
-
currency: 'USD',
|
|
3513
|
-
ttl: 300,
|
|
3514
|
-
netRevenue: true,
|
|
3515
|
-
meta: {
|
|
3516
|
-
networkId: 50,
|
|
3517
|
-
brandId: 303325,
|
|
3518
|
-
brandName: 'OECTA',
|
|
3519
|
-
advertiserDomains: ['www.abc.com']
|
|
3520
|
-
}
|
|
3521
|
-
}
|
|
3522
|
-
];
|
|
3523
|
-
const result = spec.interpretResponse({ body: DEFAULT_BANNER_BID_RESPONSE }, { data: postBiddderRequestData, validBidRequests: [] });
|
|
3524
|
-
expect(result[0]).to.deep.equal(expectedParse[0]);
|
|
3568
|
+
|
|
3569
|
+
const bid1 = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]);
|
|
3570
|
+
bid1.mediaTypes.banner.sizes = LARGE_SET_OF_SIZES;
|
|
3571
|
+
bid1.params.siteId = '121';
|
|
3572
|
+
bid1.adUnitCode = 'div-gpt-1'
|
|
3573
|
+
bid1.transactionId = 'tr1';
|
|
3574
|
+
bid1.bidId = '2f6g5s5e';
|
|
3575
|
+
|
|
3576
|
+
const bid2 = utils.deepClone(bid1);
|
|
3577
|
+
bid2.transactionId = 'tr2';
|
|
3578
|
+
|
|
3579
|
+
const bid3 = utils.deepClone(bid1);
|
|
3580
|
+
bid3.transactionId = 'tr3';
|
|
3581
|
+
|
|
3582
|
+
const bid4 = utils.deepClone(bid1);
|
|
3583
|
+
bid4.transactionId = 'tr4';
|
|
3584
|
+
|
|
3585
|
+
const requests = spec.buildRequests([bid1, bid2, bid3, bid4], DEFAULT_OPTION);
|
|
3586
|
+
|
|
3587
|
+
expect(requests).to.be.an('array');
|
|
3588
|
+
// 32KB size limit causes only 1 requests to get generated.
|
|
3589
|
+
expect(requests).to.have.lengthOf(1);
|
|
3590
|
+
for (let request of requests) {
|
|
3591
|
+
expect(request.method).to.equal('POST');
|
|
3592
|
+
}
|
|
3525
3593
|
});
|
|
3526
3594
|
});
|
|
3527
3595
|
|
|
@@ -3640,7 +3708,7 @@ describe('IndexexchangeAdapter', function () {
|
|
|
3640
3708
|
};
|
|
3641
3709
|
|
|
3642
3710
|
expect(spec.isBidRequestValid(bid)).to.be.true;
|
|
3643
|
-
spec.buildRequests([bid], {ortb2});
|
|
3711
|
+
spec.buildRequests([bid], { ortb2 });
|
|
3644
3712
|
expect(JSON.parse(localStorageValues[key])).to.deep.equal({ [TODAY]: { [ERROR_CODES.PB_FPD_EXCEEDS_MAX_SIZE]: 2 } });
|
|
3645
3713
|
});
|
|
3646
3714
|
|
|
@@ -3694,30 +3762,24 @@ describe('IndexexchangeAdapter', function () {
|
|
|
3694
3762
|
expect(spec.isBidRequestValid(request)).to.be.true;
|
|
3695
3763
|
|
|
3696
3764
|
const data = {
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
err: {
|
|
3708
|
-
'4': 8
|
|
3709
|
-
}
|
|
3765
|
+
id: '345',
|
|
3766
|
+
imp: [
|
|
3767
|
+
{
|
|
3768
|
+
id: '1a2b3c4e',
|
|
3769
|
+
}
|
|
3770
|
+
],
|
|
3771
|
+
ext: {
|
|
3772
|
+
ixdiag: {
|
|
3773
|
+
err: {
|
|
3774
|
+
'4': 8
|
|
3710
3775
|
}
|
|
3711
3776
|
}
|
|
3712
|
-
}
|
|
3777
|
+
}
|
|
3713
3778
|
};
|
|
3714
3779
|
|
|
3715
|
-
const
|
|
3716
|
-
DEFAULT_MULTIFORMAT_BANNER_VALID_BID[0],
|
|
3717
|
-
DEFAULT_MULTIFORMAT_VIDEO_VALID_BID[0]
|
|
3718
|
-
];
|
|
3780
|
+
const validBidRequest = DEFAULT_MULTIFORMAT_BANNER_VALID_BID[0];
|
|
3719
3781
|
|
|
3720
|
-
spec.interpretResponse({ body: DEFAULT_BANNER_BID_RESPONSE }, { data,
|
|
3782
|
+
spec.interpretResponse({ body: DEFAULT_BANNER_BID_RESPONSE }, { data, validBidRequest });
|
|
3721
3783
|
|
|
3722
3784
|
expect(localStorageValues[key]).to.be.undefined;
|
|
3723
3785
|
});
|