prebid.js 6.5.0 → 6.9.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/.eslintrc.js +8 -1
- package/integrationExamples/gpt/amp/creative.html +11 -33
- package/integrationExamples/gpt/weboramaRtdProvider_example.html +154 -115
- package/integrationExamples/gpt/x-domain/creative.html +63 -29
- package/modules/.submodules.json +2 -1
- package/modules/adagioBidAdapter.js +0 -8
- package/modules/adagioBidAdapter.md +1 -1
- package/modules/adbookpspBidAdapter.js +27 -10
- package/modules/adhashBidAdapter.js +3 -3
- package/modules/adkernelBidAdapter.js +2 -1
- package/modules/admanBidAdapter.js +10 -4
- package/modules/adomikAnalyticsAdapter.js +23 -11
- package/modules/adqueryIdSystem.js +103 -0
- package/modules/adqueryIdSystem.md +35 -0
- package/modules/appnexusBidAdapter.js +14 -2
- package/modules/asealBidAdapter.js +58 -0
- package/modules/asealBidAdapter.md +52 -0
- package/modules/bliinkBidAdapter.js +2 -1
- package/modules/brandmetricsRtdProvider.js +168 -0
- package/modules/brandmetricsRtdProvider.md +40 -0
- package/modules/colossussspBidAdapter.js +12 -8
- package/modules/colossussspBidAdapter.md +15 -1
- package/modules/compassBidAdapter.js +10 -3
- package/modules/consumableBidAdapter.md +1 -1
- package/modules/conversantBidAdapter.js +7 -0
- package/modules/criteoBidAdapter.js +10 -1
- package/modules/criteoIdSystem.js +29 -7
- package/modules/currency.js +26 -1
- package/modules/displayioBidAdapter.js +157 -0
- package/modules/displayioBidAdapter.md +148 -0
- package/modules/e_volutionBidAdapter.js +158 -0
- package/modules/glimpseBidAdapter.js +66 -44
- package/modules/gnetBidAdapter.js +3 -3
- package/modules/gnetBidAdapter.md +4 -4
- package/modules/gumgumBidAdapter.js +56 -42
- package/modules/idImportLibrary.js +45 -8
- package/modules/idImportLibrary.md +4 -0
- package/modules/improvedigitalBidAdapter.js +29 -2
- package/modules/interactiveOffersBidAdapter.js +9 -6
- package/modules/jwplayerRtdProvider.js +71 -6
- package/modules/jwplayerRtdProvider.md +27 -11
- package/modules/kargoBidAdapter.js +2 -2
- package/modules/lunamediahbBidAdapter.js +32 -4
- package/modules/nextMillenniumBidAdapter.js +3 -1
- package/modules/oguryBidAdapter.js +14 -14
- package/modules/onetagBidAdapter.js +4 -2
- package/modules/pilotxBidAdapter.js +147 -0
- package/modules/pilotxBidAdapter.md +50 -0
- package/modules/priceFloors.js +2 -1
- package/modules/proxistoreBidAdapter.js +0 -2
- package/modules/pubmaticAnalyticsAdapter.js +16 -0
- package/modules/richaudienceBidAdapter.js +10 -4
- package/modules/riseBidAdapter.js +18 -7
- package/modules/rtbhouseBidAdapter.js +14 -4
- package/modules/rtdModule/index.js +14 -15
- package/modules/rubiconAnalyticsAdapter.js +8 -2
- package/modules/seedingAllianceBidAdapter.js +3 -3
- package/modules/sharethroughBidAdapter.js +12 -17
- package/modules/showheroes-bsBidAdapter.js +13 -2
- package/modules/sortableAnalyticsAdapter.js +5 -4
- package/modules/sovrnBidAdapter.js +93 -18
- package/modules/sovrnBidAdapter.md +80 -2
- package/modules/synacormediaBidAdapter.js +31 -10
- package/modules/tappxBidAdapter.js +8 -5
- package/modules/teadsBidAdapter.js +1 -2
- package/modules/undertoneBidAdapter.js +17 -1
- package/modules/userId/eids.js +7 -1
- package/modules/userId/userId.md +8 -0
- package/modules/viewability.js +177 -0
- package/modules/viewability.md +87 -0
- package/modules/weboramaRtdProvider.js +264 -34
- package/modules/weboramaRtdProvider.md +110 -40
- package/modules/welectBidAdapter.js +106 -0
- package/modules/yahoosspBidAdapter.js +2 -0
- package/package.json +2 -1
- package/src/adRendering.js +38 -0
- package/src/adloader.js +2 -1
- package/src/auction.js +103 -73
- package/src/bidderSettings.js +69 -0
- package/src/hook.js +5 -1
- package/src/prebid.js +19 -21
- package/src/secureCreatives.js +131 -47
- package/src/targeting.js +3 -2
- package/src/utils.js +13 -10
- package/test/helpers/syncPromise.js +71 -0
- package/test/spec/auctionmanager_spec.js +179 -15
- package/test/spec/modules/adagioBidAdapter_spec.js +0 -10
- package/test/spec/modules/adbookpspBidAdapter_spec.js +17 -3
- package/test/spec/modules/adhashBidAdapter_spec.js +2 -2
- package/test/spec/modules/admanBidAdapter_spec.js +2 -2
- package/test/spec/modules/adomikAnalyticsAdapter_spec.js +3 -1
- package/test/spec/modules/adqueryIdSystem_spec.js +74 -0
- package/test/spec/modules/appnexusBidAdapter_spec.js +27 -0
- package/test/spec/modules/asealBidAdapter_spec.js +144 -0
- package/test/spec/modules/bliinkBidAdapter_spec.js +2 -0
- package/test/spec/modules/brandmetricsRtdProvider_spec.js +191 -0
- package/test/spec/modules/colossussspBidAdapter_spec.js +5 -2
- package/test/spec/modules/compassBidAdapter_spec.js +1 -0
- package/test/spec/modules/conversantBidAdapter_spec.js +54 -2
- package/test/spec/modules/criteoBidAdapter_spec.js +21 -0
- package/test/spec/modules/criteoIdSystem_spec.js +6 -3
- package/test/spec/modules/currency_spec.js +21 -6
- package/test/spec/modules/displayioBidAdapter_spec.js +239 -0
- package/test/spec/modules/e_volutionBidAdapter_spec.js +242 -0
- package/test/spec/modules/eids_spec.js +15 -0
- package/test/spec/modules/glimpseBidAdapter_spec.js +0 -18
- package/test/spec/modules/gnetBidAdapter_spec.js +6 -6
- package/test/spec/modules/gumgumBidAdapter_spec.js +46 -0
- package/test/spec/modules/idImportLibrary_spec.js +197 -10
- package/test/spec/modules/improvedigitalBidAdapter_spec.js +61 -0
- package/test/spec/modules/jwplayerRtdProvider_spec.js +195 -2
- package/test/spec/modules/kargoBidAdapter_spec.js +1 -1
- package/test/spec/modules/loglyliftBidAdapter_spec.js +1 -1
- package/test/spec/modules/lunamediahbBidAdapter_spec.js +27 -1
- package/test/spec/modules/nextMillenniumBidAdapter_spec.js +1 -1
- package/test/spec/modules/oguryBidAdapter_spec.js +69 -3
- package/test/spec/modules/pilotxBidAdapter_spec.js +244 -0
- package/test/spec/modules/pubmaticAnalyticsAdapter_spec.js +13 -1
- package/test/spec/modules/realTimeDataModule_spec.js +67 -5
- package/test/spec/modules/richaudienceBidAdapter_spec.js +40 -0
- package/test/spec/modules/riseBidAdapter_spec.js +31 -5
- package/test/spec/modules/rtbhouseBidAdapter_spec.js +20 -0
- package/test/spec/modules/rubiconAnalyticsAdapter_spec.js +61 -1
- package/test/spec/modules/sharethroughBidAdapter_spec.js +91 -6
- package/test/spec/modules/showheroes-bsBidAdapter_spec.js +2 -0
- package/test/spec/modules/sortableAnalyticsAdapter_spec.js +2 -3
- package/test/spec/modules/sovrnBidAdapter_spec.js +413 -333
- package/test/spec/modules/synacormediaBidAdapter_spec.js +70 -0
- package/test/spec/modules/tappxBidAdapter_spec.js +0 -19
- package/test/spec/modules/teadsBidAdapter_spec.js +14 -59
- package/test/spec/modules/undertoneBidAdapter_spec.js +55 -2
- package/test/spec/modules/userId_spec.js +68 -19
- package/test/spec/modules/viewability_spec.js +280 -0
- package/test/spec/modules/weboramaRtdProvider_spec.js +536 -20
- package/test/spec/modules/welectBidAdapter_spec.js +211 -0
- package/test/spec/modules/yahoosspBidAdapter_spec.js +10 -0
- package/test/spec/unit/core/bidderSettings_spec.js +123 -0
- package/test/spec/unit/pbjs_api_spec.js +21 -8
- package/test/spec/unit/secureCreatives_spec.js +143 -24
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { fetchTargetingForMediaId, getVatFromCache, extractPublisherParams,
|
|
2
2
|
formatTargetingResponse, getVatFromPlayer, enrichAdUnits, addTargetingToBid,
|
|
3
|
-
fetchTargetingInformation, jwplayerSubmodule } from 'modules/jwplayerRtdProvider.js';
|
|
3
|
+
fetchTargetingInformation, jwplayerSubmodule, getContentId, getContentData } from 'modules/jwplayerRtdProvider.js';
|
|
4
4
|
import { server } from 'test/mocks/xhr.js';
|
|
5
|
+
import {addOrtbSiteContent} from '../../../modules/jwplayerRtdProvider';
|
|
5
6
|
|
|
6
7
|
describe('jwplayerRtdProvider', function() {
|
|
7
8
|
const testIdForSuccess = 'test_id_for_success';
|
|
@@ -412,7 +413,7 @@ describe('jwplayerRtdProvider', function() {
|
|
|
412
413
|
});
|
|
413
414
|
});
|
|
414
415
|
|
|
415
|
-
describe('
|
|
416
|
+
describe('Extract Publisher Params', function () {
|
|
416
417
|
const config = { mediaID: 'test' };
|
|
417
418
|
|
|
418
419
|
it('should exclude adUnits that do not support instream video and do not specify jwTargeting', function () {
|
|
@@ -480,6 +481,198 @@ describe('jwplayerRtdProvider', function() {
|
|
|
480
481
|
})
|
|
481
482
|
});
|
|
482
483
|
|
|
484
|
+
describe('Get content id', function() {
|
|
485
|
+
it('prefixes jw_ to the media id', function () {
|
|
486
|
+
const mediaId = 'mediaId';
|
|
487
|
+
const contentId = getContentId(mediaId);
|
|
488
|
+
expect(contentId).to.equal('jw_mediaId');
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
it('returns undefined when media id is empty', function () {
|
|
492
|
+
let contentId = getContentId();
|
|
493
|
+
expect(contentId).to.be.undefined;
|
|
494
|
+
contentId = getContentId('');
|
|
495
|
+
expect(contentId).to.be.undefined;
|
|
496
|
+
contentId = getContentId(null);
|
|
497
|
+
expect(contentId).to.be.undefined;
|
|
498
|
+
});
|
|
499
|
+
});
|
|
500
|
+
|
|
501
|
+
describe('Get Content Data', function () {
|
|
502
|
+
it('returns undefined when segments are empty', function () {
|
|
503
|
+
let data = getContentData(null);
|
|
504
|
+
expect(data).to.be.undefined;
|
|
505
|
+
data = getContentData(undefined);
|
|
506
|
+
expect(data).to.be.undefined;
|
|
507
|
+
data = getContentData([]);
|
|
508
|
+
expect(data).to.be.undefined;
|
|
509
|
+
});
|
|
510
|
+
|
|
511
|
+
it('returns proper format', function () {
|
|
512
|
+
const segment1 = 'segment1';
|
|
513
|
+
const segment2 = 'segment2';
|
|
514
|
+
const segment3 = 'segment3';
|
|
515
|
+
const data = getContentData([segment1, segment2, segment3]);
|
|
516
|
+
expect(data).to.have.property('name', 'jwplayer');
|
|
517
|
+
expect(data.ext).to.have.property('segtax', 502);
|
|
518
|
+
expect(data.segment[0]).to.deep.equal({ id: segment1, value: segment1 });
|
|
519
|
+
expect(data.segment[1]).to.deep.equal({ id: segment2, value: segment2 });
|
|
520
|
+
expect(data.segment[2]).to.deep.equal({ id: segment3, value: segment3 });
|
|
521
|
+
});
|
|
522
|
+
});
|
|
523
|
+
|
|
524
|
+
describe(' Add Ortb Site Content', function () {
|
|
525
|
+
it('should maintain object structure when id and data params are empty', function () {
|
|
526
|
+
const bid = {
|
|
527
|
+
ortb2: {
|
|
528
|
+
site: {
|
|
529
|
+
content: {
|
|
530
|
+
id: 'randomId'
|
|
531
|
+
},
|
|
532
|
+
random: {
|
|
533
|
+
random_sub: 'randomSub'
|
|
534
|
+
}
|
|
535
|
+
},
|
|
536
|
+
app: {
|
|
537
|
+
content: {
|
|
538
|
+
id: 'appId'
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
};
|
|
543
|
+
addOrtbSiteContent(bid);
|
|
544
|
+
expect(bid).to.have.nested.property('ortb2.site.content.id', 'randomId');
|
|
545
|
+
expect(bid).to.have.nested.property('ortb2.site.random.random_sub', 'randomSub');
|
|
546
|
+
expect(bid).to.have.nested.property('ortb2.app.content.id', 'appId');
|
|
547
|
+
});
|
|
548
|
+
|
|
549
|
+
it('should create a structure compliant with the oRTB 2 spec', function() {
|
|
550
|
+
const bid = {};
|
|
551
|
+
const expectedId = 'expectedId';
|
|
552
|
+
const expectedData = { datum: 'datum' };
|
|
553
|
+
addOrtbSiteContent(bid, expectedId, expectedData);
|
|
554
|
+
expect(bid).to.have.nested.property('ortb2.site.content.id', expectedId);
|
|
555
|
+
expect(bid).to.have.nested.property('ortb2.site.content.data');
|
|
556
|
+
expect(bid.ortb2.site.content.data[0]).to.be.deep.equal(expectedData);
|
|
557
|
+
});
|
|
558
|
+
|
|
559
|
+
it('should respect existing structure when adding adding fields', function () {
|
|
560
|
+
const bid = {
|
|
561
|
+
ortb2: {
|
|
562
|
+
site: {
|
|
563
|
+
content: {
|
|
564
|
+
id: 'oldId'
|
|
565
|
+
},
|
|
566
|
+
random: {
|
|
567
|
+
random_sub: 'randomSub'
|
|
568
|
+
}
|
|
569
|
+
},
|
|
570
|
+
app: {
|
|
571
|
+
content: {
|
|
572
|
+
id: 'appId'
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
};
|
|
577
|
+
|
|
578
|
+
const expectedId = 'expectedId';
|
|
579
|
+
const expectedData = { datum: 'datum' };
|
|
580
|
+
addOrtbSiteContent(bid, expectedId, expectedData);
|
|
581
|
+
expect(bid).to.have.nested.property('ortb2.site.random.random_sub', 'randomSub');
|
|
582
|
+
expect(bid).to.have.nested.property('ortb2.app.content.id', 'appId');
|
|
583
|
+
expect(bid).to.have.nested.property('ortb2.site.content.id', expectedId);
|
|
584
|
+
expect(bid).to.have.nested.property('ortb2.site.content.data');
|
|
585
|
+
expect(bid.ortb2.site.content.data[0]).to.be.deep.equal(expectedData);
|
|
586
|
+
});
|
|
587
|
+
|
|
588
|
+
it('should set content id', function () {
|
|
589
|
+
const bid = {};
|
|
590
|
+
const expectedId = 'expectedId';
|
|
591
|
+
addOrtbSiteContent(bid, expectedId);
|
|
592
|
+
expect(bid).to.have.nested.property('ortb2.site.content.id', expectedId);
|
|
593
|
+
});
|
|
594
|
+
|
|
595
|
+
it('should override content id', function () {
|
|
596
|
+
const bid = {
|
|
597
|
+
ortb2: {
|
|
598
|
+
site: {
|
|
599
|
+
content: {
|
|
600
|
+
id: 'oldId'
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
};
|
|
605
|
+
|
|
606
|
+
const expectedId = 'expectedId';
|
|
607
|
+
addOrtbSiteContent(bid, expectedId);
|
|
608
|
+
expect(bid).to.have.nested.property('ortb2.site.content.id', expectedId);
|
|
609
|
+
});
|
|
610
|
+
|
|
611
|
+
it('should keep previous content id when not set', function () {
|
|
612
|
+
const previousId = 'oldId';
|
|
613
|
+
const bid = {
|
|
614
|
+
ortb2: {
|
|
615
|
+
site: {
|
|
616
|
+
content: {
|
|
617
|
+
id: previousId,
|
|
618
|
+
data: [{ datum: 'first_datum' }]
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
};
|
|
623
|
+
|
|
624
|
+
addOrtbSiteContent(bid, null, { datum: 'new_datum' });
|
|
625
|
+
expect(bid).to.have.nested.property('ortb2.site.content.id', previousId);
|
|
626
|
+
});
|
|
627
|
+
|
|
628
|
+
it('should set content data', function () {
|
|
629
|
+
const bid = {};
|
|
630
|
+
const expectedData = { datum: 'datum' };
|
|
631
|
+
addOrtbSiteContent(bid, null, expectedData);
|
|
632
|
+
expect(bid).to.have.nested.property('ortb2.site.content.data');
|
|
633
|
+
expect(bid.ortb2.site.content.data).to.have.length(1);
|
|
634
|
+
expect(bid.ortb2.site.content.data[0]).to.be.deep.equal(expectedData);
|
|
635
|
+
});
|
|
636
|
+
|
|
637
|
+
it('should append content data', function () {
|
|
638
|
+
const bid = {
|
|
639
|
+
ortb2: {
|
|
640
|
+
site: {
|
|
641
|
+
content: {
|
|
642
|
+
data: [{ datum: 'first_datum' }]
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
};
|
|
647
|
+
|
|
648
|
+
const expectedData = { datum: 'datum' };
|
|
649
|
+
addOrtbSiteContent(bid, null, expectedData);
|
|
650
|
+
expect(bid).to.have.nested.property('ortb2.site.content.data');
|
|
651
|
+
expect(bid.ortb2.site.content.data).to.have.length(2);
|
|
652
|
+
expect(bid.ortb2.site.content.data.pop()).to.be.deep.equal(expectedData);
|
|
653
|
+
});
|
|
654
|
+
|
|
655
|
+
it('should keep previous data when not set', function () {
|
|
656
|
+
const expectedId = 'expectedId';
|
|
657
|
+
const expectedData = { datum: 'first_datum' };
|
|
658
|
+
const bid = {
|
|
659
|
+
ortb2: {
|
|
660
|
+
site: {
|
|
661
|
+
content: {
|
|
662
|
+
data: [expectedData]
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
};
|
|
667
|
+
|
|
668
|
+
addOrtbSiteContent(bid, expectedId);
|
|
669
|
+
expect(bid).to.have.nested.property('ortb2.site.content.data');
|
|
670
|
+
expect(bid.ortb2.site.content.data).to.have.length(1);
|
|
671
|
+
expect(bid.ortb2.site.content.data[0]).to.be.deep.equal(expectedData);
|
|
672
|
+
expect(bid).to.have.nested.property('ortb2.site.content.id', expectedId);
|
|
673
|
+
});
|
|
674
|
+
});
|
|
675
|
+
|
|
483
676
|
describe('Add Targeting to Bid', function () {
|
|
484
677
|
const targeting = {foo: 'bar'};
|
|
485
678
|
|
|
@@ -109,7 +109,7 @@ describe('loglyliftBidAdapter', function () {
|
|
|
109
109
|
expect(data.bidId).to.equal(nativeBidRequests[0].bidId);
|
|
110
110
|
expect(data.mediaTypes).to.deep.equal(nativeBidRequests[0].mediaTypes);
|
|
111
111
|
expect(data.params).to.deep.equal(nativeBidRequests[0].params);
|
|
112
|
-
expect(data.prebidJsVersion).to.equal('
|
|
112
|
+
expect(data.prebidJsVersion).to.equal('$prebid.version$');
|
|
113
113
|
expect(data.url).to.exist;
|
|
114
114
|
expect(data.domain).to.exist;
|
|
115
115
|
expect(data.referer).to.equal(bidderRequest.refererInfo.referer);
|
|
@@ -80,7 +80,7 @@ describe('LunamediaHBBidAdapter', function () {
|
|
|
80
80
|
expect(data).to.be.an('object');
|
|
81
81
|
let placement = data['placements'][0];
|
|
82
82
|
expect(placement).to.be.an('object');
|
|
83
|
-
expect(placement).to.have.keys('placementId', 'bidId', 'traffic', 'wPlayer', 'hPlayer', 'schain');
|
|
83
|
+
expect(placement).to.have.keys('placementId', 'bidId', 'traffic', 'wPlayer', 'hPlayer', 'schain', 'videoContext');
|
|
84
84
|
expect(placement.traffic).to.equal(VIDEO);
|
|
85
85
|
expect(placement.wPlayer).to.equal(playerSize[0]);
|
|
86
86
|
expect(placement.hPlayer).to.equal(playerSize[1]);
|
|
@@ -301,4 +301,30 @@ describe('LunamediaHBBidAdapter', function () {
|
|
|
301
301
|
expect(serverResponses).to.be.an('array').that.is.empty;
|
|
302
302
|
});
|
|
303
303
|
});
|
|
304
|
+
|
|
305
|
+
describe('getUserSyncs', function() {
|
|
306
|
+
it('Should return array of objects with proper sync config , include GDPR', function() {
|
|
307
|
+
const syncData = spec.getUserSyncs({}, {}, {
|
|
308
|
+
consentString: 'ALL',
|
|
309
|
+
gdprApplies: true,
|
|
310
|
+
}, {});
|
|
311
|
+
expect(syncData).to.be.an('array').which.is.not.empty;
|
|
312
|
+
expect(syncData[0]).to.be.an('object')
|
|
313
|
+
expect(syncData[0].type).to.be.a('string')
|
|
314
|
+
expect(syncData[0].type).to.equal('image')
|
|
315
|
+
expect(syncData[0].url).to.be.a('string')
|
|
316
|
+
expect(syncData[0].url).to.equal('https://cookie.lmgssp.com/image?pbjs=1&gdpr=1&gdpr_consent=ALL&coppa=0')
|
|
317
|
+
});
|
|
318
|
+
it('Should return array of objects with proper sync config , include CCPA', function() {
|
|
319
|
+
const syncData = spec.getUserSyncs({}, {}, {}, {
|
|
320
|
+
consentString: '1---'
|
|
321
|
+
});
|
|
322
|
+
expect(syncData).to.be.an('array').which.is.not.empty;
|
|
323
|
+
expect(syncData[0]).to.be.an('object')
|
|
324
|
+
expect(syncData[0].type).to.be.a('string')
|
|
325
|
+
expect(syncData[0].type).to.equal('image')
|
|
326
|
+
expect(syncData[0].url).to.be.a('string')
|
|
327
|
+
expect(syncData[0].url).to.equal('https://cookie.lmgssp.com/image?pbjs=1&ccpa_consent=1---&coppa=0')
|
|
328
|
+
});
|
|
329
|
+
});
|
|
304
330
|
});
|
|
@@ -40,7 +40,7 @@ describe('nextMillenniumBidAdapterTests', function() {
|
|
|
40
40
|
|
|
41
41
|
it('Check if refresh_count param is incremented', function() {
|
|
42
42
|
const request = spec.buildRequests(bidRequestData);
|
|
43
|
-
expect(JSON.parse(request[0].data).refresh_count).to.equal(3);
|
|
43
|
+
expect(JSON.parse(request[0].data).ext.nextMillennium.refresh_count).to.equal(3);
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
it('Test getUserSyncs function', function () {
|
|
@@ -268,6 +268,10 @@ describe('OguryBidAdapter', function () {
|
|
|
268
268
|
ext: {
|
|
269
269
|
consent: bidderRequest.gdprConsent.consentString
|
|
270
270
|
},
|
|
271
|
+
},
|
|
272
|
+
ext: {
|
|
273
|
+
prebidversion: '$prebid.version$',
|
|
274
|
+
adapterversion: '1.2.9'
|
|
271
275
|
}
|
|
272
276
|
};
|
|
273
277
|
|
|
@@ -296,7 +300,59 @@ describe('OguryBidAdapter', function () {
|
|
|
296
300
|
...expectedRequestObject,
|
|
297
301
|
regs: {
|
|
298
302
|
ext: {
|
|
299
|
-
gdpr:
|
|
303
|
+
gdpr: 0
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
user: {
|
|
307
|
+
ext: {
|
|
308
|
+
consent: ''
|
|
309
|
+
},
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
const validBidRequests = bidRequests
|
|
314
|
+
|
|
315
|
+
const request = spec.buildRequests(validBidRequests, bidderRequestWithoutGdpr);
|
|
316
|
+
expect(request.data).to.deep.equal(expectedRequestObjectWithoutGdpr);
|
|
317
|
+
expect(request.data.regs.ext.gdpr).to.be.a('number');
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
it('should not add gdpr infos if gdprConsent is undefined', () => {
|
|
321
|
+
const bidderRequestWithoutGdpr = {
|
|
322
|
+
...bidderRequest,
|
|
323
|
+
gdprConsent: undefined,
|
|
324
|
+
}
|
|
325
|
+
const expectedRequestObjectWithoutGdpr = {
|
|
326
|
+
...expectedRequestObject,
|
|
327
|
+
regs: {
|
|
328
|
+
ext: {
|
|
329
|
+
gdpr: 0
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
user: {
|
|
333
|
+
ext: {
|
|
334
|
+
consent: ''
|
|
335
|
+
},
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
const validBidRequests = bidRequests
|
|
340
|
+
|
|
341
|
+
const request = spec.buildRequests(validBidRequests, bidderRequestWithoutGdpr);
|
|
342
|
+
expect(request.data).to.deep.equal(expectedRequestObjectWithoutGdpr);
|
|
343
|
+
expect(request.data.regs.ext.gdpr).to.be.a('number');
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
it('should not add tcString and turn off gdpr-applies if consentString and gdprApplies are undefined', () => {
|
|
347
|
+
const bidderRequestWithoutGdpr = {
|
|
348
|
+
...bidderRequest,
|
|
349
|
+
gdprConsent: { consentString: undefined, gdprApplies: undefined },
|
|
350
|
+
}
|
|
351
|
+
const expectedRequestObjectWithoutGdpr = {
|
|
352
|
+
...expectedRequestObject,
|
|
353
|
+
regs: {
|
|
354
|
+
ext: {
|
|
355
|
+
gdpr: 0
|
|
300
356
|
},
|
|
301
357
|
},
|
|
302
358
|
user: {
|
|
@@ -425,7 +481,9 @@ describe('OguryBidAdapter', function () {
|
|
|
425
481
|
meta: {
|
|
426
482
|
advertiserDomains: openRtbBidResponse.body.seatbid[0].bid[0].adomain
|
|
427
483
|
},
|
|
428
|
-
nurl: openRtbBidResponse.body.seatbid[0].bid[0].nurl
|
|
484
|
+
nurl: openRtbBidResponse.body.seatbid[0].bid[0].nurl,
|
|
485
|
+
adapterVersion: '1.2.9',
|
|
486
|
+
prebidVersion: '$prebid.version$'
|
|
429
487
|
}, {
|
|
430
488
|
requestId: openRtbBidResponse.body.seatbid[0].bid[1].impid,
|
|
431
489
|
cpm: openRtbBidResponse.body.seatbid[0].bid[1].price,
|
|
@@ -440,7 +498,9 @@ describe('OguryBidAdapter', function () {
|
|
|
440
498
|
meta: {
|
|
441
499
|
advertiserDomains: openRtbBidResponse.body.seatbid[0].bid[1].adomain
|
|
442
500
|
},
|
|
443
|
-
nurl: openRtbBidResponse.body.seatbid[0].bid[1].nurl
|
|
501
|
+
nurl: openRtbBidResponse.body.seatbid[0].bid[1].nurl,
|
|
502
|
+
adapterVersion: '1.2.9',
|
|
503
|
+
prebidVersion: '$prebid.version$'
|
|
444
504
|
}]
|
|
445
505
|
|
|
446
506
|
let request = spec.buildRequests(bidRequests, bidderRequest);
|
|
@@ -486,6 +546,11 @@ describe('OguryBidAdapter', function () {
|
|
|
486
546
|
expect(requests.length).to.equal(0);
|
|
487
547
|
})
|
|
488
548
|
|
|
549
|
+
it('Should not create nurl request if bid contains undefined nurl', function() {
|
|
550
|
+
spec.onBidWon({ nurl: undefined })
|
|
551
|
+
expect(requests.length).to.equal(0);
|
|
552
|
+
})
|
|
553
|
+
|
|
489
554
|
it('Should create nurl request if bid nurl', function() {
|
|
490
555
|
spec.onBidWon({ nurl })
|
|
491
556
|
expect(requests.length).to.equal(1);
|
|
@@ -561,6 +626,7 @@ describe('OguryBidAdapter', function () {
|
|
|
561
626
|
expect(requests.length).to.equal(1);
|
|
562
627
|
expect(requests[0].url).to.equal(TIMEOUT_URL);
|
|
563
628
|
expect(requests[0].method).to.equal('POST');
|
|
629
|
+
expect(JSON.parse(requests[0].requestBody).location).to.equal(window.location.href);
|
|
564
630
|
})
|
|
565
631
|
});
|
|
566
632
|
});
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
// import or require modules necessary for the test, e.g.:
|
|
2
|
+
import { expect } from 'chai'; // may prefer 'assert' in place of 'expect'
|
|
3
|
+
import { spec } from '../../../modules/pilotxBidAdapter.js';
|
|
4
|
+
|
|
5
|
+
describe('pilotxAdapter', function () {
|
|
6
|
+
describe('isBidRequestValid', function () {
|
|
7
|
+
let banner;
|
|
8
|
+
beforeEach(function () {
|
|
9
|
+
banner = {
|
|
10
|
+
bidder: 'pilotx',
|
|
11
|
+
adUnitCode: 'adunit-test',
|
|
12
|
+
mediaTypes: { banner: {} },
|
|
13
|
+
sizes: [[300, 250], [468, 60]],
|
|
14
|
+
bidId: '2de8c82e30665a',
|
|
15
|
+
params: {
|
|
16
|
+
placementId: '1'
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('should return false if sizes is empty', function () {
|
|
22
|
+
banner.sizes = []
|
|
23
|
+
expect(spec.isBidRequestValid(banner)).to.equal(false);
|
|
24
|
+
});
|
|
25
|
+
it('should return true if all is valid/ is not empty', function () {
|
|
26
|
+
expect(spec.isBidRequestValid(banner)).to.equal(true);
|
|
27
|
+
});
|
|
28
|
+
it('should return false if there is no placement id found', function () {
|
|
29
|
+
banner.params = {}
|
|
30
|
+
expect(spec.isBidRequestValid(banner)).to.equal(false);
|
|
31
|
+
});
|
|
32
|
+
it('should return false if sizes is empty', function () {
|
|
33
|
+
banner.sizes = []
|
|
34
|
+
expect(spec.isBidRequestValid(banner)).to.equal(false);
|
|
35
|
+
});
|
|
36
|
+
it('should return false for no size and empty params', function() {
|
|
37
|
+
const emptySizes = {
|
|
38
|
+
bidder: 'pilotx',
|
|
39
|
+
adUnitCode: 'adunit-test',
|
|
40
|
+
mediaTypes: { banner: {} },
|
|
41
|
+
bidId: '2de8c82e30665a',
|
|
42
|
+
params: {
|
|
43
|
+
placementId: '1',
|
|
44
|
+
sizes: []
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
expect(spec.isBidRequestValid(emptySizes)).to.equal(false);
|
|
48
|
+
})
|
|
49
|
+
it('should return true for no size and valid size params', function() {
|
|
50
|
+
const emptySizes = {
|
|
51
|
+
bidder: 'pilotx',
|
|
52
|
+
adUnitCode: 'adunit-test',
|
|
53
|
+
mediaTypes: { banner: {} },
|
|
54
|
+
bidId: '2de8c82e30665a',
|
|
55
|
+
params: {
|
|
56
|
+
placementId: '1',
|
|
57
|
+
sizes: [[300, 250], [468, 60]]
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
expect(spec.isBidRequestValid(emptySizes)).to.equal(true);
|
|
61
|
+
})
|
|
62
|
+
it('should return false for no size items', function() {
|
|
63
|
+
const emptySizes = {
|
|
64
|
+
bidder: 'pilotx',
|
|
65
|
+
adUnitCode: 'adunit-test',
|
|
66
|
+
mediaTypes: { banner: {} },
|
|
67
|
+
bidId: '2de8c82e30665a',
|
|
68
|
+
params: {
|
|
69
|
+
placementId: '1'
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
expect(spec.isBidRequestValid(emptySizes)).to.equal(false);
|
|
73
|
+
})
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
describe('buildRequests', function () {
|
|
77
|
+
const mockRequest = { refererInfo: {} };
|
|
78
|
+
const mockRequestGDPR = {
|
|
79
|
+
refererInfo: {},
|
|
80
|
+
gdprConsent: {
|
|
81
|
+
consentString: 'BOJ/P2HOJ/P2HABABMAAAAAZ+A==',
|
|
82
|
+
gdprApplies: true
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
}
|
|
86
|
+
const mockVideo1 = [{
|
|
87
|
+
adUnitCode: 'video1',
|
|
88
|
+
auctionId: '01618029-7ae9-4e98-a73a-1ed0c817f414',
|
|
89
|
+
bidId: '2a59588c0114fa',
|
|
90
|
+
bidRequestsCount: 1,
|
|
91
|
+
bidder: 'pilotx',
|
|
92
|
+
bidderRequestId: '1f6b4ba2039726',
|
|
93
|
+
bidderRequestsCount: 1,
|
|
94
|
+
bidderWinsCount: 0,
|
|
95
|
+
crumbs: { pubcid: 'de5240ef-ff80-4b55-8837-26a11cfbf64c' },
|
|
96
|
+
mediaTypes: {
|
|
97
|
+
video: {
|
|
98
|
+
context: 'instream',
|
|
99
|
+
mimes: ['video/mp4'],
|
|
100
|
+
playbackmethod: [2],
|
|
101
|
+
playerSize: [[640, 480]],
|
|
102
|
+
protocols: [1, 2, 3, 4, 5, 6, 7, 8],
|
|
103
|
+
skip: 1
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
ortb2Imp: {
|
|
107
|
+
ext: {
|
|
108
|
+
data: {
|
|
109
|
+
pbadslot: 'video1'
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
params: { placementId: '379' },
|
|
114
|
+
sizes: [[640, 480]],
|
|
115
|
+
src: 'client',
|
|
116
|
+
transactionId: 'fec9f2ff-da13-4921-8437-8d679c2be7fe',
|
|
117
|
+
}];
|
|
118
|
+
const mockVideo2 = [{
|
|
119
|
+
adUnitCode: 'video1',
|
|
120
|
+
auctionId: '01618029-7ae9-4e98-a73a-1ed0c817f414',
|
|
121
|
+
bidId: '2a59588c0114fa',
|
|
122
|
+
bidRequestsCount: 1,
|
|
123
|
+
bidder: 'pilotx',
|
|
124
|
+
bidderRequestId: '1f6b4ba2039726',
|
|
125
|
+
bidderRequestsCount: 1,
|
|
126
|
+
bidderWinsCount: 0,
|
|
127
|
+
crumbs: { pubcid: 'de5240ef-ff80-4b55-8837-26a11cfbf64c' },
|
|
128
|
+
mediaTypes: {
|
|
129
|
+
video: {
|
|
130
|
+
context: 'instream',
|
|
131
|
+
mimes: ['video/mp4'],
|
|
132
|
+
playbackmethod: [2],
|
|
133
|
+
playerSize: [[640, 480]],
|
|
134
|
+
protocols: [1, 2, 3, 4, 5, 6, 7, 8],
|
|
135
|
+
skip: 1
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
ortb2Imp: {
|
|
139
|
+
ext: {
|
|
140
|
+
data: {
|
|
141
|
+
pbadslot: 'video1'
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
params: { placementId: '379' },
|
|
146
|
+
sizes: [640, 480],
|
|
147
|
+
src: 'client',
|
|
148
|
+
transactionId: 'fec9f2ff-da13-4921-8437-8d679c2be7fe',
|
|
149
|
+
}];
|
|
150
|
+
it('should return correct response', function () {
|
|
151
|
+
const builtRequest = spec.buildRequests(mockVideo1, mockRequest)
|
|
152
|
+
let builtRequestData = builtRequest.data
|
|
153
|
+
let data = JSON.parse(builtRequestData)
|
|
154
|
+
expect(data['379'].bidId).to.equal(mockVideo1[0].bidId)
|
|
155
|
+
});
|
|
156
|
+
it('should return correct response for only array of size', function () {
|
|
157
|
+
const builtRequest = spec.buildRequests(mockVideo2, mockRequest)
|
|
158
|
+
let builtRequestData = builtRequest.data
|
|
159
|
+
let data = JSON.parse(builtRequestData)
|
|
160
|
+
expect(data['379'].sizes[0][0]).to.equal(mockVideo2[0].sizes[0])
|
|
161
|
+
expect(data['379'].sizes[0][1]).to.equal(mockVideo2[0].sizes[1])
|
|
162
|
+
});
|
|
163
|
+
it('should be valid and pass gdpr items correctly', function () {
|
|
164
|
+
const builtRequest = spec.buildRequests(mockVideo2, mockRequestGDPR)
|
|
165
|
+
let builtRequestData = builtRequest.data
|
|
166
|
+
let data = JSON.parse(builtRequestData)
|
|
167
|
+
expect(data['379'].gdprConsentString).to.equal(mockRequestGDPR.gdprConsent.consentString)
|
|
168
|
+
expect(data['379'].gdprConsentRequired).to.equal(mockRequestGDPR.gdprConsent.gdprApplies)
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
describe('interpretResponse', function () {
|
|
172
|
+
const bidRequest = {}
|
|
173
|
+
const serverResponse = {
|
|
174
|
+
cpm: 2.5,
|
|
175
|
+
creativeId: 'V9060',
|
|
176
|
+
currency: 'US',
|
|
177
|
+
height: 480,
|
|
178
|
+
mediaType: 'video',
|
|
179
|
+
netRevenue: false,
|
|
180
|
+
requestId: '273b39c74069cb',
|
|
181
|
+
ttl: 3000,
|
|
182
|
+
vastUrl: 'http://testadserver.com/ads?&k=60cd901ad8ab70c9cedf373cb17b93b8&pid=379&tid=91342717',
|
|
183
|
+
width: 640
|
|
184
|
+
}
|
|
185
|
+
const serverResponseVideo = {
|
|
186
|
+
body: serverResponse
|
|
187
|
+
}
|
|
188
|
+
const serverResponse2 = {
|
|
189
|
+
cpm: 2.5,
|
|
190
|
+
creativeId: 'V9060',
|
|
191
|
+
currency: 'US',
|
|
192
|
+
height: 480,
|
|
193
|
+
mediaType: 'banner',
|
|
194
|
+
netRevenue: false,
|
|
195
|
+
requestId: '273b39c74069cb',
|
|
196
|
+
ttl: 3000,
|
|
197
|
+
vastUrl: 'http://testadserver.com/ads?&k=60cd901ad8ab70c9cedf373cb17b93b8&pid=379&tid=91342717',
|
|
198
|
+
width: 640
|
|
199
|
+
}
|
|
200
|
+
const serverResponseBanner = {
|
|
201
|
+
body: serverResponse2
|
|
202
|
+
}
|
|
203
|
+
it('should be valid from bidRequest for video', function () {
|
|
204
|
+
const bidResponses = spec.interpretResponse(serverResponseVideo, bidRequest)
|
|
205
|
+
expect(bidResponses[0].requestId).to.equal(serverResponse.requestId)
|
|
206
|
+
expect(bidResponses[0].cpm).to.equal(serverResponse.cpm)
|
|
207
|
+
expect(bidResponses[0].width).to.equal(serverResponse.width)
|
|
208
|
+
expect(bidResponses[0].height).to.equal(serverResponse.height)
|
|
209
|
+
expect(bidResponses[0].creativeId).to.equal(serverResponse.creativeId)
|
|
210
|
+
expect(bidResponses[0].currency).to.equal(serverResponse.currency)
|
|
211
|
+
expect(bidResponses[0].netRevenue).to.equal(serverResponse.netRevenue)
|
|
212
|
+
expect(bidResponses[0].ttl).to.equal(serverResponse.ttl)
|
|
213
|
+
expect(bidResponses[0].vastUrl).to.equal(serverResponse.vastUrl)
|
|
214
|
+
expect(bidResponses[0].mediaType).to.equal(serverResponse.mediaType)
|
|
215
|
+
expect(bidResponses[0].meta.mediaType).to.equal(serverResponse.mediaType)
|
|
216
|
+
});
|
|
217
|
+
it('should be valid from bidRequest for banner', function () {
|
|
218
|
+
const bidResponses = spec.interpretResponse(serverResponseBanner, bidRequest)
|
|
219
|
+
expect(bidResponses[0].requestId).to.equal(serverResponse2.requestId)
|
|
220
|
+
expect(bidResponses[0].cpm).to.equal(serverResponse2.cpm)
|
|
221
|
+
expect(bidResponses[0].width).to.equal(serverResponse2.width)
|
|
222
|
+
expect(bidResponses[0].height).to.equal(serverResponse2.height)
|
|
223
|
+
expect(bidResponses[0].creativeId).to.equal(serverResponse2.creativeId)
|
|
224
|
+
expect(bidResponses[0].currency).to.equal(serverResponse2.currency)
|
|
225
|
+
expect(bidResponses[0].netRevenue).to.equal(serverResponse2.netRevenue)
|
|
226
|
+
expect(bidResponses[0].ttl).to.equal(serverResponse2.ttl)
|
|
227
|
+
expect(bidResponses[0].ad).to.equal(serverResponse2.ad)
|
|
228
|
+
expect(bidResponses[0].mediaType).to.equal(serverResponse2.mediaType)
|
|
229
|
+
expect(bidResponses[0].meta.mediaType).to.equal(serverResponse2.mediaType)
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
describe('setPlacementID', function () {
|
|
233
|
+
const multiplePlacementIds = ['380', '381']
|
|
234
|
+
it('should be valid with an array of placement ids passed', function () {
|
|
235
|
+
const placementID = spec.setPlacementID(multiplePlacementIds)
|
|
236
|
+
expect(placementID).to.equal('380#381')
|
|
237
|
+
});
|
|
238
|
+
it('should be valid with single placement ID passed', function () {
|
|
239
|
+
const placementID = spec.setPlacementID('381')
|
|
240
|
+
expect(placementID).to.equal('381')
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
// Add other `describe` or `it` blocks as necessary
|
|
244
|
+
});
|