prebid.js 6.6.0 → 6.10.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/allowedModules.js +4 -7
- package/integrationExamples/gpt/amp/creative.html +11 -33
- package/integrationExamples/gpt/{haloRtdProvider_example.html → hadronRtdProvider_example.html} +9 -9
- package/integrationExamples/gpt/idImportLibrary_example.html +2 -2
- package/integrationExamples/gpt/userId_example.html +2 -2
- package/integrationExamples/gpt/weboramaRtdProvider_example.html +154 -115
- package/integrationExamples/gpt/x-domain/creative.html +63 -29
- package/modules/.submodules.json +3 -0
- package/modules/adagioBidAdapter.js +1 -9
- package/modules/adagioBidAdapter.md +1 -1
- package/modules/adbookpspBidAdapter.js +29 -12
- package/modules/adhashBidAdapter.js +4 -4
- package/modules/adkernelBidAdapter.js +2 -2
- package/modules/adlooxAnalyticsAdapter.js +1 -1
- package/modules/adlooxRtdProvider.js +1 -1
- package/modules/adnowBidAdapter.js +1 -1
- package/modules/adnuntiusRtdProvider.js +96 -0
- package/modules/adnuntiusRtdProvider.md +41 -0
- package/modules/adomikAnalyticsAdapter.js +2 -2
- package/modules/adotBidAdapter.js +1 -1
- package/modules/adpod.js +14 -17
- package/modules/adrelevantisBidAdapter.js +2 -2
- package/modules/adtargetBidAdapter.js +1 -1
- package/modules/adtelligentBidAdapter.js +1 -1
- package/modules/advangelistsBidAdapter.js +2 -2
- package/modules/adxpremiumAnalyticsAdapter.js +1 -1
- package/modules/adyoulikeBidAdapter.js +1 -1
- package/modules/afpBidAdapter.js +1 -1
- package/modules/appnexusBidAdapter.js +16 -4
- package/modules/asealBidAdapter.js +58 -0
- package/modules/asealBidAdapter.md +52 -0
- package/modules/beachfrontBidAdapter.js +2 -2
- package/modules/betweenBidAdapter.js +1 -1
- package/modules/bidViewability.js +1 -1
- package/modules/bluebillywigBidAdapter.js +1 -1
- package/modules/brandmetricsRtdProvider.js +168 -0
- package/modules/brandmetricsRtdProvider.md +40 -0
- package/modules/bridgewellBidAdapter.js +1 -1
- package/modules/browsiRtdProvider.js +2 -2
- package/modules/cleanmedianetBidAdapter.js +1 -1
- package/modules/colossussspBidAdapter.js +12 -8
- package/modules/colossussspBidAdapter.md +15 -1
- package/modules/compassBidAdapter.js +1 -1
- package/modules/connectIdSystem.js +1 -1
- package/modules/consentManagement.js +2 -3
- package/modules/consumableBidAdapter.md +1 -1
- package/modules/conversantBidAdapter.js +7 -0
- package/modules/craftBidAdapter.js +2 -2
- package/modules/criteoBidAdapter.js +10 -1
- package/modules/currency.js +27 -5
- package/modules/cwireBidAdapter.js +1 -1
- package/modules/dailyhuntBidAdapter.js +1 -1
- package/modules/dchain.js +1 -1
- package/modules/displayioBidAdapter.js +157 -0
- package/modules/displayioBidAdapter.md +148 -0
- package/modules/dspxBidAdapter.js +69 -29
- package/modules/dspxBidAdapter.md +2 -1
- package/modules/e_volutionBidAdapter.js +158 -0
- package/modules/emx_digitalBidAdapter.js +2 -2
- package/modules/fluctBidAdapter.js +0 -1
- package/modules/gamoshiBidAdapter.js +1 -1
- package/modules/gdprEnforcement.js +2 -2
- package/modules/glomexBidAdapter.js +1 -1
- package/modules/gnetBidAdapter.js +3 -3
- package/modules/gnetBidAdapter.md +4 -4
- package/modules/goldbachBidAdapter.js +2 -2
- package/modules/gptPreAuction.js +1 -1
- package/modules/gridBidAdapter.js +15 -1
- package/modules/gumgumBidAdapter.js +57 -43
- package/modules/hadronIdSystem.js +96 -0
- package/modules/hadronIdSystem.md +35 -0
- package/modules/hadronRtdProvider.js +254 -0
- package/modules/hadronRtdProvider.md +126 -0
- package/modules/haloIdSystem.md +4 -35
- package/modules/haloRtdProvider.md +3 -126
- package/modules/hybridBidAdapter.js +1 -1
- package/modules/improvedigitalBidAdapter.js +6 -1
- package/modules/insticatorBidAdapter.js +1 -1
- package/modules/interactiveOffersBidAdapter.js +9 -6
- package/modules/intersectionRtdProvider.js +1 -1
- package/modules/ixBidAdapter.js +2 -2
- package/modules/jwplayerRtdProvider.js +72 -7
- package/modules/jwplayerRtdProvider.md +27 -11
- package/modules/kargoBidAdapter.js +2 -2
- package/modules/livewrappedBidAdapter.js +1 -1
- package/modules/lunamediahbBidAdapter.js +32 -4
- package/modules/malltvBidAdapter.js +7 -3
- package/modules/malltvBidAdapter.md +64 -51
- package/modules/mass.js +3 -5
- package/modules/mediakeysBidAdapter.js +2 -2
- package/modules/medianetAnalyticsAdapter.js +2 -2
- package/modules/medianetRtdProvider.js +1 -1
- package/modules/mediasquareBidAdapter.js +1 -0
- package/modules/nextMillenniumBidAdapter.js +1 -0
- package/modules/nextrollBidAdapter.js +1 -1
- package/modules/oguryBidAdapter.js +7 -14
- package/modules/onetagBidAdapter.js +1 -1
- package/modules/openwebBidAdapter.js +1 -1
- package/modules/openxAnalyticsAdapter.js +2 -2
- package/modules/openxBidAdapter.js +1 -1
- package/modules/parrableIdSystem.js +1 -1
- package/modules/permutiveRtdProvider.js +1 -1
- package/modules/pilotxBidAdapter.js +147 -0
- package/modules/pilotxBidAdapter.md +50 -0
- package/modules/pixfutureBidAdapter.js +2 -2
- package/modules/prebidServerBidAdapter/index.js +63 -41
- package/modules/priceFloors.js +15 -14
- package/modules/pubmaticBidAdapter.js +1 -1
- package/modules/quantcastBidAdapter.js +1 -1
- package/modules/reconciliationRtdProvider.js +1 -1
- package/modules/richaudienceBidAdapter.js +7 -2
- package/modules/riseBidAdapter.js +17 -6
- package/modules/roxotAnalyticsAdapter.js +1 -1
- package/modules/rtbhouseBidAdapter.js +1 -1
- package/modules/rtdModule/index.js +9 -11
- package/modules/rubiconAnalyticsAdapter.js +8 -2
- package/modules/rubiconBidAdapter.js +1 -1
- package/modules/saambaaBidAdapter.js +420 -420
- package/modules/seedingAllianceBidAdapter.js +3 -3
- package/modules/sharethroughBidAdapter.js +12 -17
- package/modules/sigmoidAnalyticsAdapter.js +1 -1
- package/modules/sirdataRtdProvider.js +1 -1
- package/modules/sizeMappingV2.js +2 -9
- package/modules/smarticoBidAdapter.js +1 -1
- package/modules/sortableAnalyticsAdapter.js +5 -4
- package/modules/sovrnAnalyticsAdapter.js +2 -2
- package/modules/sovrnBidAdapter.js +93 -18
- package/modules/sovrnBidAdapter.md +80 -2
- package/modules/sspBCBidAdapter.js +54 -21
- package/modules/synacormediaBidAdapter.js +32 -11
- package/modules/targetVideoBidAdapter.js +1 -1
- package/modules/telariaBidAdapter.js +22 -29
- package/modules/trustpidSystem.js +197 -0
- package/modules/trustpidSystem.md +45 -0
- package/modules/undertoneBidAdapter.js +17 -1
- package/modules/userId/eids.js +16 -1
- package/modules/userId/eids.md +10 -2
- package/modules/userId/index.js +2 -2
- package/modules/userId/userId.md +17 -2
- package/modules/ventesBidAdapter.js +1 -1
- package/modules/verizonMediaIdSystem.js +1 -1
- package/modules/vibrantmediaBidAdapter.js +220 -0
- package/modules/vibrantmediaBidAdapter.md +92 -0
- package/modules/viewability.js +177 -0
- package/modules/viewability.md +87 -0
- package/modules/viewdeosDXBidAdapter.js +1 -1
- package/modules/voxBidAdapter.js +1 -1
- package/modules/waardexBidAdapter.js +1 -1
- package/modules/weboramaRtdProvider.js +264 -34
- package/modules/weboramaRtdProvider.md +110 -40
- package/modules/widespaceBidAdapter.js +2 -2
- package/modules/winrBidAdapter.js +7 -7
- package/modules/yahoosspBidAdapter.js +3 -1
- package/modules/yieldlabBidAdapter.js +1 -1
- package/modules/yieldmoBidAdapter.js +2 -2
- package/modules/yieldoneBidAdapter.js +6 -0
- package/modules/yuktamediaAnalyticsAdapter.js +1 -1
- package/package.json +3 -1
- package/plugins/poly/arrayFrom.js +3 -0
- package/plugins/poly/find.js +3 -0
- package/plugins/poly/findIndex.js +3 -0
- package/plugins/poly/includes.js +3 -0
- package/plugins/poly/package.json +8 -0
- package/src/Renderer.js +1 -1
- package/src/adRendering.js +38 -0
- package/src/adapterManager.js +33 -28
- package/src/adapters/bidderFactory.js +13 -11
- package/src/adloader.js +3 -2
- package/src/auction.js +140 -117
- package/src/auctionIndex.js +85 -0
- package/src/auctionManager.js +4 -1
- package/src/bidderSettings.js +69 -0
- package/src/bidfactory.js +18 -6
- package/src/config.js +3 -4
- package/src/cpmBucketManager.js +1 -1
- package/src/native.js +30 -22
- package/src/prebid.js +4 -20
- package/src/secureCreatives.js +133 -49
- package/src/sizeMapping.js +1 -1
- package/src/storageManager.js +1 -1
- package/src/targeting.js +13 -4
- package/src/userSync.js +1 -1
- package/src/utils.js +16 -19
- package/src/video.js +11 -12
- package/src/videoCache.js +10 -9
- package/test/fixtures/fixtures.js +2 -1
- package/test/helpers/indexStub.js +28 -0
- package/test/helpers/syncPromise.js +71 -0
- package/test/spec/auctionmanager_spec.js +269 -90
- package/test/spec/config_spec.js +24 -1
- package/test/spec/e2e/longform/basic_w_bidderSettings.spec.js +1 -1
- package/test/spec/e2e/longform/basic_w_custom_adserver_translation.spec.js +1 -1
- package/test/spec/e2e/longform/basic_w_priceGran.spec.js +1 -1
- package/test/spec/e2e/longform/basic_w_requireExactDuration.spec.js +1 -1
- package/test/spec/e2e/longform/basic_wo_brandCategoryExclusion.spec.js +1 -1
- package/test/spec/e2e/longform/basic_wo_requireExactDuration.spec.js +1 -1
- 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/adnuntiusRtdProvider_spec.js +145 -0
- package/test/spec/modules/adpod_spec.js +91 -156
- package/test/spec/modules/afpBidAdapter_spec.js +1 -1
- package/test/spec/modules/appnexusBidAdapter_spec.js +27 -0
- package/test/spec/modules/asealBidAdapter_spec.js +144 -0
- package/test/spec/modules/brandmetricsRtdProvider_spec.js +191 -0
- package/test/spec/modules/colossussspBidAdapter_spec.js +5 -2
- package/test/spec/modules/conversantBidAdapter_spec.js +54 -2
- package/test/spec/modules/criteoBidAdapter_spec.js +21 -0
- package/test/spec/modules/currency_spec.js +36 -15
- package/test/spec/modules/deepintentDpesIdsystem_spec.js +1 -1
- package/test/spec/modules/displayioBidAdapter_spec.js +239 -0
- package/test/spec/modules/dspxBidAdapter_spec.js +20 -15
- package/test/spec/modules/e_volutionBidAdapter_spec.js +242 -0
- package/test/spec/modules/eids_spec.js +2 -2
- package/test/spec/modules/eplanningAnalyticsAdapter_spec.js +1 -1
- package/test/spec/modules/fintezaAnalyticsAdapter_spec.js +1 -1
- package/test/spec/modules/gnetBidAdapter_spec.js +6 -6
- package/test/spec/modules/gridBidAdapter_spec.js +18 -0
- package/test/spec/modules/gumgumBidAdapter_spec.js +49 -3
- package/test/spec/modules/hadronIdSystem_spec.js +57 -0
- package/test/spec/modules/hadronRtdProvider_spec.js +762 -0
- package/test/spec/modules/idxIdSystem_spec.js +1 -1
- package/test/spec/modules/improvedigitalBidAdapter_spec.js +19 -0
- package/test/spec/modules/jwplayerRtdProvider_spec.js +195 -2
- package/test/spec/modules/kargoBidAdapter_spec.js +1 -1
- package/test/spec/modules/lunamediahbBidAdapter_spec.js +27 -1
- package/test/spec/modules/mass_spec.js +2 -14
- package/test/spec/modules/mediakeysBidAdapter_spec.js +1 -1
- package/test/spec/modules/multibid_spec.js +1 -1
- package/test/spec/modules/oguryBidAdapter_spec.js +63 -5
- package/test/spec/modules/onetagBidAdapter_spec.js +1 -1
- package/test/spec/modules/openxAnalyticsAdapter_spec.js +1 -1
- package/test/spec/modules/parrableIdSystem_spec.js +1 -1
- package/test/spec/modules/pilotxBidAdapter_spec.js +244 -0
- package/test/spec/modules/prebidServerBidAdapter_spec.js +43 -6
- package/test/spec/modules/priceFloors_spec.js +37 -24
- package/test/spec/modules/pubmaticBidAdapter_spec.js +40 -0
- package/test/spec/modules/realTimeDataModule_spec.js +51 -2
- package/test/spec/modules/riseBidAdapter_spec.js +30 -4
- package/test/spec/modules/rubiconAnalyticsAdapter_spec.js +61 -1
- package/test/spec/modules/rubiconBidAdapter_spec.js +1 -1
- package/test/spec/modules/sharethroughBidAdapter_spec.js +91 -6
- package/test/spec/modules/sortableAnalyticsAdapter_spec.js +2 -3
- package/test/spec/modules/sovrnBidAdapter_spec.js +413 -333
- package/test/spec/modules/sspBCBidAdapter_spec.js +7 -7
- package/test/spec/modules/stroeerCoreBidAdapter_spec.js +1 -1
- package/test/spec/modules/synacormediaBidAdapter_spec.js +70 -0
- package/test/spec/modules/telariaBidAdapter_spec.js +1 -3
- package/test/spec/modules/trustpidSystem_spec.js +232 -0
- package/test/spec/modules/undertoneBidAdapter_spec.js +55 -2
- package/test/spec/modules/userId_spec.js +40 -40
- package/test/spec/modules/vibrantmediaBidAdapter_spec.js +1237 -0
- package/test/spec/modules/viewability_spec.js +280 -0
- package/test/spec/modules/weboramaRtdProvider_spec.js +536 -20
- package/test/spec/modules/widespaceBidAdapter_spec.js +1 -1
- package/test/spec/modules/yahoosspBidAdapter_spec.js +10 -0
- package/test/spec/modules/yieldoneBidAdapter_spec.js +33 -0
- package/test/spec/modules/zeotapIdPlusIdSystem_spec.js +1 -1
- package/test/spec/native_spec.js +62 -40
- package/test/spec/sizeMapping_spec.js +1 -1
- package/test/spec/unit/core/adapterManager_spec.js +24 -2
- package/test/spec/unit/core/auctionIndex_spec.js +129 -0
- package/test/spec/unit/core/bidderFactory_spec.js +65 -12
- package/test/spec/unit/core/bidderSettings_spec.js +123 -0
- package/test/spec/unit/core/targeting_spec.js +93 -0
- package/test/spec/unit/pbjs_api_spec.js +81 -43
- package/test/spec/unit/secureCreatives_spec.js +143 -24
- package/test/spec/videoCache_spec.js +18 -19
- package/test/spec/video_spec.js +51 -61
- package/webpack.conf.js +1 -1
|
@@ -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
|
+
});
|
|
@@ -9,6 +9,14 @@ import CONSTANTS from 'src/constants.json';
|
|
|
9
9
|
import { server } from 'test/mocks/xhr.js';
|
|
10
10
|
import { createEidsArray } from 'modules/userId/eids.js';
|
|
11
11
|
import {deepAccess, deepClone} from 'src/utils.js';
|
|
12
|
+
import 'modules/appnexusBidAdapter.js' // appnexus alias test
|
|
13
|
+
import 'modules/rubiconBidAdapter.js' // rubicon alias test
|
|
14
|
+
import 'src/prebid.js' // $$PREBID_GLOBAL$$.aliasBidder test
|
|
15
|
+
import 'modules/currency.js' // adServerCurrency test
|
|
16
|
+
import {hook} from '../../../src/hook.js';
|
|
17
|
+
import {decorateAdUnitsWithNativeParams} from '../../../src/native.js';
|
|
18
|
+
import {auctionManager} from '../../../src/auctionManager.js';
|
|
19
|
+
import {stubAuctionIndex} from '../../helpers/indexStub.js';
|
|
12
20
|
|
|
13
21
|
let CONFIG = {
|
|
14
22
|
accountId: '1',
|
|
@@ -448,6 +456,16 @@ describe('S2S Adapter', function () {
|
|
|
448
456
|
addBidResponse = sinon.spy(),
|
|
449
457
|
done = sinon.spy();
|
|
450
458
|
|
|
459
|
+
function prepRequest(req) {
|
|
460
|
+
req.ad_units.forEach((adUnit) => { delete adUnit.nativeParams });
|
|
461
|
+
decorateAdUnitsWithNativeParams(req.ad_units);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
before(() => {
|
|
465
|
+
hook.ready();
|
|
466
|
+
prepRequest(REQUEST);
|
|
467
|
+
});
|
|
468
|
+
|
|
451
469
|
beforeEach(function () {
|
|
452
470
|
config.resetConfig();
|
|
453
471
|
adapter = new Adapter();
|
|
@@ -1096,6 +1114,7 @@ describe('S2S Adapter', function () {
|
|
|
1096
1114
|
it('should not include ext.aspectratios if adunit\'s aspect_ratios do not define radio_width and ratio_height', () => {
|
|
1097
1115
|
const req = deepClone(REQUEST);
|
|
1098
1116
|
req.ad_units[0].mediaTypes.native.icon.aspect_ratios[0] = {'min_width': 1, 'min_height': 2};
|
|
1117
|
+
prepRequest(req);
|
|
1099
1118
|
adapter.callBids(req, BID_REQUESTS, addBidResponse, done, ajax);
|
|
1100
1119
|
const nativeReq = JSON.parse(JSON.parse(server.requests[0].requestBody).imp[0].native.request);
|
|
1101
1120
|
const icons = nativeReq.assets.map((a) => a.img).filter((img) => img && img.type === 1);
|
|
@@ -2404,11 +2423,8 @@ describe('S2S Adapter', function () {
|
|
|
2404
2423
|
});
|
|
2405
2424
|
|
|
2406
2425
|
it('handles OpenRTB native responses', function () {
|
|
2407
|
-
sinon.stub(
|
|
2408
|
-
|
|
2409
|
-
bidder: 'appnexus',
|
|
2410
|
-
bidId: '123'
|
|
2411
|
-
});
|
|
2426
|
+
const stub = sinon.stub(auctionManager, 'index');
|
|
2427
|
+
stub.get(() => stubAuctionIndex({adUnits: REQUEST.ad_units}));
|
|
2412
2428
|
const s2sConfig = Object.assign({}, CONFIG, {
|
|
2413
2429
|
endpoint: {
|
|
2414
2430
|
p1Consent: 'https://prebidserverurl/openrtb2/auction?querystring=param'
|
|
@@ -2431,7 +2447,28 @@ describe('S2S Adapter', function () {
|
|
|
2431
2447
|
expect(response).to.have.property('requestId', '123');
|
|
2432
2448
|
expect(response).to.have.property('cpm', 10);
|
|
2433
2449
|
|
|
2434
|
-
|
|
2450
|
+
stub.restore();
|
|
2451
|
+
});
|
|
2452
|
+
|
|
2453
|
+
it('does not (by default) allow bids that were not requested', function () {
|
|
2454
|
+
config.setConfig({ s2sConfig: CONFIG });
|
|
2455
|
+
adapter.callBids(REQUEST, BID_REQUESTS, addBidResponse, done, ajax);
|
|
2456
|
+
const response = deepClone(RESPONSE_OPENRTB);
|
|
2457
|
+
response.seatbid[0].seat = 'unknown';
|
|
2458
|
+
server.requests[0].respond(200, {}, JSON.stringify(response));
|
|
2459
|
+
|
|
2460
|
+
expect(addBidResponse.called).to.be.false;
|
|
2461
|
+
});
|
|
2462
|
+
|
|
2463
|
+
it('allows unrequested bids if config.allowUnknownBidderCodes', function () {
|
|
2464
|
+
const cfg = {...CONFIG, allowUnknownBidderCodes: true};
|
|
2465
|
+
config.setConfig({s2sConfig: cfg});
|
|
2466
|
+
adapter.callBids({...REQUEST, s2sConfig: cfg}, BID_REQUESTS, addBidResponse, done, ajax);
|
|
2467
|
+
const response = deepClone(RESPONSE_OPENRTB);
|
|
2468
|
+
response.seatbid[0].seat = 'unknown';
|
|
2469
|
+
server.requests[0].respond(200, {}, JSON.stringify(response));
|
|
2470
|
+
|
|
2471
|
+
expect(addBidResponse.calledWith(sinon.match.any, sinon.match({bidderCode: 'unknown'}))).to.be.true;
|
|
2435
2472
|
});
|
|
2436
2473
|
|
|
2437
2474
|
describe('on sync requested with no cookie', () => {
|
|
@@ -16,6 +16,10 @@ import {
|
|
|
16
16
|
} from 'modules/priceFloors.js';
|
|
17
17
|
import events from 'src/events.js';
|
|
18
18
|
import * as mockGpt from '../integration/faker/googletag.js';
|
|
19
|
+
import 'src/prebid.js';
|
|
20
|
+
import {createBid} from '../../../src/bidfactory.js';
|
|
21
|
+
import {auctionManager} from '../../../src/auctionManager.js';
|
|
22
|
+
import {stubAuctionIndex} from '../../helpers/indexStub.js';
|
|
19
23
|
|
|
20
24
|
describe('the price floors module', function () {
|
|
21
25
|
let logErrorSpy;
|
|
@@ -401,6 +405,7 @@ describe('the price floors module', function () {
|
|
|
401
405
|
});
|
|
402
406
|
describe('with gpt enabled', function () {
|
|
403
407
|
let gptFloorData;
|
|
408
|
+
let indexStub, adUnits;
|
|
404
409
|
beforeEach(function () {
|
|
405
410
|
gptFloorData = {
|
|
406
411
|
currency: 'USD',
|
|
@@ -426,10 +431,13 @@ describe('the price floors module', function () {
|
|
|
426
431
|
code: '/12345/sports/basketball',
|
|
427
432
|
divId: 'test_div_2'
|
|
428
433
|
});
|
|
434
|
+
indexStub = sinon.stub(auctionManager, 'index');
|
|
435
|
+
indexStub.get(() => stubAuctionIndex({adUnits}))
|
|
429
436
|
});
|
|
430
437
|
afterEach(function () {
|
|
431
438
|
// reset it so no lingering stuff from other test specs
|
|
432
439
|
mockGpt.reset();
|
|
440
|
+
indexStub.restore();
|
|
433
441
|
});
|
|
434
442
|
it('picks the right rule when looking for gptSlot', function () {
|
|
435
443
|
expect(getFirstMatchingFloor(gptFloorData, basicBidRequest)).to.deep.equal({
|
|
@@ -449,9 +457,10 @@ describe('the price floors module', function () {
|
|
|
449
457
|
matchingRule: '/12345/sports/basketball'
|
|
450
458
|
});
|
|
451
459
|
});
|
|
452
|
-
it('picks the gptSlot from the
|
|
453
|
-
const newBidRequest1 = { ...basicBidRequest };
|
|
454
|
-
|
|
460
|
+
it('picks the gptSlot from the adUnit and does not call the slotMatching', function () {
|
|
461
|
+
const newBidRequest1 = { ...basicBidRequest, transactionId: 'au1' };
|
|
462
|
+
adUnits = [{code: newBidRequest1.code, transactionId: 'au1'}];
|
|
463
|
+
utils.deepSetValue(adUnits[0], 'ortb2Imp.ext.data.adserver', {
|
|
455
464
|
name: 'gam',
|
|
456
465
|
adslot: '/12345/news/politics'
|
|
457
466
|
})
|
|
@@ -463,8 +472,9 @@ describe('the price floors module', function () {
|
|
|
463
472
|
matchingRule: '/12345/news/politics'
|
|
464
473
|
});
|
|
465
474
|
|
|
466
|
-
const newBidRequest2 = { ...basicBidRequest, adUnitCode: 'test_div_2' };
|
|
467
|
-
|
|
475
|
+
const newBidRequest2 = { ...basicBidRequest, adUnitCode: 'test_div_2', transactionId: 'au2' };
|
|
476
|
+
adUnits = [{code: newBidRequest2.adUnitCode, transactionId: newBidRequest2.transactionId}];
|
|
477
|
+
utils.deepSetValue(adUnits[0], 'ortb2Imp.ext.data.adserver', {
|
|
468
478
|
name: 'gam',
|
|
469
479
|
adslot: '/12345/news/weather'
|
|
470
480
|
})
|
|
@@ -1565,17 +1575,12 @@ describe('the price floors module', function () {
|
|
|
1565
1575
|
});
|
|
1566
1576
|
});
|
|
1567
1577
|
describe('bidResponseHook tests', function () {
|
|
1568
|
-
|
|
1569
|
-
let
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
adUnitCode: 'test_div_1',
|
|
1575
|
-
auctionId: '123456',
|
|
1576
|
-
bidId: '1111'
|
|
1577
|
-
}]
|
|
1578
|
-
};
|
|
1578
|
+
const AUCTION_ID = '123456';
|
|
1579
|
+
let returnedBidResponse, indexStub;
|
|
1580
|
+
let adUnit = {
|
|
1581
|
+
transactionId: 'au',
|
|
1582
|
+
code: 'test_div_1'
|
|
1583
|
+
}
|
|
1579
1584
|
let basicBidResponse = {
|
|
1580
1585
|
bidderCode: 'appnexus',
|
|
1581
1586
|
width: 300,
|
|
@@ -1583,38 +1588,46 @@ describe('the price floors module', function () {
|
|
|
1583
1588
|
cpm: 0.5,
|
|
1584
1589
|
mediaType: 'banner',
|
|
1585
1590
|
requestId: '1111',
|
|
1591
|
+
transactionId: 'au',
|
|
1586
1592
|
};
|
|
1587
1593
|
beforeEach(function () {
|
|
1588
1594
|
returnedBidResponse = {};
|
|
1595
|
+
indexStub = sinon.stub(auctionManager, 'index');
|
|
1596
|
+
indexStub.get(() => stubAuctionIndex({adUnits: [adUnit]}));
|
|
1589
1597
|
});
|
|
1598
|
+
|
|
1599
|
+
afterEach(() => {
|
|
1600
|
+
indexStub.restore();
|
|
1601
|
+
});
|
|
1602
|
+
|
|
1590
1603
|
function runBidResponse(bidResp = basicBidResponse) {
|
|
1591
1604
|
let next = (adUnitCode, bid) => {
|
|
1592
1605
|
returnedBidResponse = bid;
|
|
1593
1606
|
};
|
|
1594
|
-
addBidResponseHook
|
|
1607
|
+
addBidResponseHook(next, bidResp.adUnitCode, Object.assign(createBid(CONSTANTS.STATUS.GOOD, {auctionId: AUCTION_ID}), bidResp));
|
|
1595
1608
|
};
|
|
1596
1609
|
it('continues with the auction if not floors data is present without any flooring', function () {
|
|
1597
1610
|
runBidResponse();
|
|
1598
1611
|
expect(returnedBidResponse).to.not.haveOwnProperty('floorData');
|
|
1599
1612
|
});
|
|
1600
1613
|
it('if no matching rule it should not floor and should call log warn', function () {
|
|
1601
|
-
_floorDataForAuction[
|
|
1602
|
-
_floorDataForAuction[
|
|
1614
|
+
_floorDataForAuction[AUCTION_ID] = utils.deepClone(basicFloorConfig);
|
|
1615
|
+
_floorDataForAuction[AUCTION_ID].data.values = { 'video': 1.0 };
|
|
1603
1616
|
runBidResponse();
|
|
1604
1617
|
expect(returnedBidResponse).to.not.haveOwnProperty('floorData');
|
|
1605
1618
|
expect(logWarnSpy.calledOnce).to.equal(true);
|
|
1606
1619
|
});
|
|
1607
1620
|
it('if it finds a rule and floors should update the bid accordingly', function () {
|
|
1608
|
-
_floorDataForAuction[
|
|
1609
|
-
_floorDataForAuction[
|
|
1621
|
+
_floorDataForAuction[AUCTION_ID] = utils.deepClone(basicFloorConfig);
|
|
1622
|
+
_floorDataForAuction[AUCTION_ID].data.values = { 'banner': 1.0 };
|
|
1610
1623
|
runBidResponse();
|
|
1611
1624
|
expect(returnedBidResponse).to.haveOwnProperty('floorData');
|
|
1612
1625
|
expect(returnedBidResponse.status).to.equal(CONSTANTS.BID_STATUS.BID_REJECTED);
|
|
1613
1626
|
expect(returnedBidResponse.cpm).to.equal(0);
|
|
1614
1627
|
});
|
|
1615
1628
|
it('if it finds a rule and does not floor should update the bid accordingly', function () {
|
|
1616
|
-
_floorDataForAuction[
|
|
1617
|
-
_floorDataForAuction[
|
|
1629
|
+
_floorDataForAuction[AUCTION_ID] = utils.deepClone(basicFloorConfig);
|
|
1630
|
+
_floorDataForAuction[AUCTION_ID].data.values = { 'banner': 0.3 };
|
|
1618
1631
|
runBidResponse();
|
|
1619
1632
|
expect(returnedBidResponse).to.haveOwnProperty('floorData');
|
|
1620
1633
|
expect(returnedBidResponse.floorData).to.deep.equal({
|
|
@@ -1636,7 +1649,7 @@ describe('the price floors module', function () {
|
|
|
1636
1649
|
expect(returnedBidResponse.cpm).to.equal(0.5);
|
|
1637
1650
|
});
|
|
1638
1651
|
it('if should work with more complex rules and update accordingly', function () {
|
|
1639
|
-
_floorDataForAuction[
|
|
1652
|
+
_floorDataForAuction[AUCTION_ID] = {
|
|
1640
1653
|
...basicFloorConfig,
|
|
1641
1654
|
data: {
|
|
1642
1655
|
currency: 'USD',
|
|
@@ -3861,4 +3861,44 @@ describe('PubMatic adapter', function () {
|
|
|
3861
3861
|
})
|
|
3862
3862
|
});
|
|
3863
3863
|
});
|
|
3864
|
+
|
|
3865
|
+
describe('Video request params', function() {
|
|
3866
|
+
let sandbox, utilsMock, newVideoRequest;
|
|
3867
|
+
beforeEach(() => {
|
|
3868
|
+
utilsMock = sinon.mock(utils);
|
|
3869
|
+
sandbox = sinon.sandbox.create();
|
|
3870
|
+
sandbox.spy(utils, 'logWarn');
|
|
3871
|
+
newVideoRequest = utils.deepClone(videoBidRequests)
|
|
3872
|
+
});
|
|
3873
|
+
|
|
3874
|
+
afterEach(() => {
|
|
3875
|
+
utilsMock.restore();
|
|
3876
|
+
sandbox.restore();
|
|
3877
|
+
})
|
|
3878
|
+
|
|
3879
|
+
it('Should log warning if video params from mediaTypes and params obj of bid are not present', function () {
|
|
3880
|
+
delete newVideoRequest[0].mediaTypes.video;
|
|
3881
|
+
delete newVideoRequest[0].params.video;
|
|
3882
|
+
|
|
3883
|
+
let request = spec.buildRequests(newVideoRequest, {
|
|
3884
|
+
auctionId: 'new-auction-id'
|
|
3885
|
+
});
|
|
3886
|
+
|
|
3887
|
+
sinon.assert.calledOnce(utils.logWarn);
|
|
3888
|
+
expect(request).to.equal(undefined);
|
|
3889
|
+
});
|
|
3890
|
+
|
|
3891
|
+
it('Should consider video params from mediaType object of bid', function () {
|
|
3892
|
+
delete newVideoRequest[0].params.video;
|
|
3893
|
+
|
|
3894
|
+
let request = spec.buildRequests(newVideoRequest, {
|
|
3895
|
+
auctionId: 'new-auction-id'
|
|
3896
|
+
});
|
|
3897
|
+
let data = JSON.parse(request.data);
|
|
3898
|
+
expect(data.imp[0].video).to.exist;
|
|
3899
|
+
expect(data.imp[0]['video']['w']).to.equal(videoBidRequests[0].mediaTypes.video.playerSize[0]);
|
|
3900
|
+
expect(data.imp[0]['video']['h']).to.equal(videoBidRequests[0].mediaTypes.video.playerSize[1]);
|
|
3901
|
+
expect(data.imp[0]['video']['battr']).to.equal(undefined);
|
|
3902
|
+
});
|
|
3903
|
+
});
|
|
3864
3904
|
});
|
|
@@ -141,7 +141,56 @@ describe('Real time module', function () {
|
|
|
141
141
|
const adUnits = rtdModule.getAdUnitTargeting(auction);
|
|
142
142
|
assert.deepEqual(expectedAdUnits, adUnits)
|
|
143
143
|
done();
|
|
144
|
-
})
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
describe('setBidRequestData', () => {
|
|
147
|
+
let withWait, withoutWait;
|
|
148
|
+
|
|
149
|
+
function runSetBidRequestData() {
|
|
150
|
+
return new Promise((resolve) => {
|
|
151
|
+
rtdModule.setBidRequestsData(resolve, {bidRequest: {}});
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
beforeEach(() => {
|
|
156
|
+
withWait = {
|
|
157
|
+
submod: validSMWait,
|
|
158
|
+
cbTime: 0,
|
|
159
|
+
cbRan: false
|
|
160
|
+
};
|
|
161
|
+
withoutWait = {
|
|
162
|
+
submod: validSM,
|
|
163
|
+
cbTime: 0,
|
|
164
|
+
cbRan: false
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
[withWait, withoutWait].forEach((c) => {
|
|
168
|
+
c.submod.getBidRequestData = sinon.stub().callsFake((_, cb) => {
|
|
169
|
+
setTimeout(() => {
|
|
170
|
+
c.cbRan = true;
|
|
171
|
+
cb();
|
|
172
|
+
}, c.cbTime);
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
it('should allow non-priority submodules to run synchronously', () => {
|
|
178
|
+
withWait.cbTime = withoutWait.cbTime = 0;
|
|
179
|
+
return runSetBidRequestData().then(() => {
|
|
180
|
+
expect(withWait.cbRan).to.be.true;
|
|
181
|
+
expect(withoutWait.cbRan).to.be.true;
|
|
182
|
+
})
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
it('should not wait for non-priority submodules if priority ones complete first', () => {
|
|
186
|
+
withWait.cbTime = 10;
|
|
187
|
+
withoutWait.cbTime = 100;
|
|
188
|
+
return runSetBidRequestData().then(() => {
|
|
189
|
+
expect(withWait.cbRan).to.be.true;
|
|
190
|
+
expect(withoutWait.cbRan).to.be.false;
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
});
|
|
145
194
|
});
|
|
146
195
|
|
|
147
196
|
it('deep merge object', function () {
|
|
@@ -255,5 +304,5 @@ describe('Real time module', function () {
|
|
|
255
304
|
expect(providers[1][hook].called).to.be.true;
|
|
256
305
|
});
|
|
257
306
|
});
|
|
258
|
-
})
|
|
307
|
+
});
|
|
259
308
|
});
|
|
@@ -3,7 +3,7 @@ import { spec } from 'modules/riseBidAdapter.js';
|
|
|
3
3
|
import { newBidder } from 'src/adapters/bidderFactory.js';
|
|
4
4
|
import { config } from 'src/config.js';
|
|
5
5
|
import { VIDEO } from '../../../src/mediaTypes.js';
|
|
6
|
-
import
|
|
6
|
+
import * as utils from 'src/utils.js';
|
|
7
7
|
|
|
8
8
|
const ENDPOINT = 'https://hb.yellowblue.io/hb';
|
|
9
9
|
const TEST_ENDPOINT = 'https://hb.yellowblue.io/hb-test';
|
|
@@ -262,7 +262,7 @@ describe('riseAdapter', function () {
|
|
|
262
262
|
});
|
|
263
263
|
|
|
264
264
|
it('should set floor_price to getFloor.floor value if it is greater than params.floorPrice', function() {
|
|
265
|
-
const bid = deepClone(bidRequests[0]);
|
|
265
|
+
const bid = utils.deepClone(bidRequests[0]);
|
|
266
266
|
bid.getFloor = () => {
|
|
267
267
|
return {
|
|
268
268
|
currency: 'USD',
|
|
@@ -276,7 +276,7 @@ describe('riseAdapter', function () {
|
|
|
276
276
|
});
|
|
277
277
|
|
|
278
278
|
it('should set floor_price to params.floorPrice value if it is greater than getFloor.floor', function() {
|
|
279
|
-
const bid = deepClone(bidRequests[0]);
|
|
279
|
+
const bid = utils.deepClone(bidRequests[0]);
|
|
280
280
|
bid.getFloor = () => {
|
|
281
281
|
return {
|
|
282
282
|
currency: 'USD',
|
|
@@ -299,7 +299,8 @@ describe('riseAdapter', function () {
|
|
|
299
299
|
requestId: '21e12606d47ba7',
|
|
300
300
|
netRevenue: true,
|
|
301
301
|
currency: 'USD',
|
|
302
|
-
adomain: ['abc.com']
|
|
302
|
+
adomain: ['abc.com'],
|
|
303
|
+
nurl: 'http://example.com/win/1234',
|
|
303
304
|
};
|
|
304
305
|
|
|
305
306
|
it('should get correct bid response', function () {
|
|
@@ -315,6 +316,7 @@ describe('riseAdapter', function () {
|
|
|
315
316
|
ttl: TTL,
|
|
316
317
|
vastXml: '<VAST version="3.0"></VAST>',
|
|
317
318
|
mediaType: VIDEO,
|
|
319
|
+
nurl: 'http://example.com/win/1234',
|
|
318
320
|
meta: {
|
|
319
321
|
advertiserDomains: ['abc.com']
|
|
320
322
|
}
|
|
@@ -402,4 +404,28 @@ describe('riseAdapter', function () {
|
|
|
402
404
|
expect(syncs).to.deep.equal([]);
|
|
403
405
|
});
|
|
404
406
|
})
|
|
407
|
+
|
|
408
|
+
describe('onBidWon', function() {
|
|
409
|
+
beforeEach(function() {
|
|
410
|
+
sinon.stub(utils, 'triggerPixel');
|
|
411
|
+
});
|
|
412
|
+
afterEach(function() {
|
|
413
|
+
utils.triggerPixel.restore();
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
it('Should trigger pixel if bid nurl', function() {
|
|
417
|
+
const bid = {
|
|
418
|
+
'bidder': spec.code,
|
|
419
|
+
'adUnitCode': 'adunit-code',
|
|
420
|
+
'sizes': [['640', '480']],
|
|
421
|
+
'nurl': 'http://example.com/win/1234',
|
|
422
|
+
'params': {
|
|
423
|
+
'org': 'jdye8weeyirk00000001'
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
spec.onBidWon(bid);
|
|
428
|
+
expect(utils.triggerPixel.callCount).to.equal(1)
|
|
429
|
+
})
|
|
430
|
+
})
|
|
405
431
|
});
|