prebid.js 6.7.0 → 6.11.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/{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 +0 -8
- package/modules/adagioBidAdapter.md +1 -1
- package/modules/adkernelBidAdapter.js +2 -1
- package/modules/adnuntiusRtdProvider.js +96 -0
- package/modules/adnuntiusRtdProvider.md +41 -0
- package/modules/adotBidAdapter.js +516 -567
- package/modules/adotBidAdapter.md +6 -44
- package/modules/adpod.js +12 -14
- package/modules/adyoulikeBidAdapter.js +2 -0
- package/modules/appnexusBidAdapter.js +14 -2
- package/modules/asealBidAdapter.js +58 -0
- package/modules/asealBidAdapter.md +52 -0
- package/modules/brandmetricsRtdProvider.js +168 -0
- package/modules/brandmetricsRtdProvider.md +40 -0
- package/modules/conversantBidAdapter.js +7 -0
- package/modules/criteoBidAdapter.js +9 -0
- package/modules/currency.js +27 -5
- 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/gridBidAdapter.js +15 -1
- package/modules/gumgumBidAdapter.js +52 -38
- 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/imRtdProvider.js +10 -0
- package/modules/improvedigitalBidAdapter.js +5 -0
- package/modules/interactiveOffersBidAdapter.js +9 -6
- package/modules/iqzoneBidAdapter.js +10 -3
- package/modules/iqzoneBidAdapter.md +16 -0
- package/modules/ixBidAdapter.js +2 -6
- package/modules/kubientBidAdapter.js +50 -19
- 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 +0 -5
- package/modules/medianetAnalyticsAdapter.js +1 -1
- package/modules/mediasquareBidAdapter.js +9 -1
- package/modules/nextMillenniumBidAdapter.js +1 -0
- package/modules/oguryBidAdapter.js +7 -14
- package/modules/prebidServerBidAdapter/index.js +61 -39
- package/modules/priceFloors.js +20 -12
- package/modules/pubmaticBidAdapter.js +1 -1
- package/modules/richaudienceBidAdapter.js +8 -3
- package/modules/riseBidAdapter.js +17 -6
- package/modules/rtbhouseBidAdapter.js +2 -0
- package/modules/rubiconAnalyticsAdapter.js +5 -0
- package/modules/rubiconBidAdapter.js +2 -2
- package/modules/sizeMappingV2.js +1 -8
- package/modules/sortableAnalyticsAdapter.js +5 -4
- package/modules/sovrnBidAdapter.js +93 -18
- package/modules/sovrnBidAdapter.md +80 -2
- package/modules/sspBCBidAdapter.js +53 -20
- 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/userId.md +17 -2
- package/modules/vibrantmediaBidAdapter.js +220 -0
- package/modules/vibrantmediaBidAdapter.md +92 -0
- package/modules/vidoomyBidAdapter.js +8 -0
- package/modules/vidoomyBidAdapter.md +4 -2
- package/modules/weboramaRtdProvider.js +264 -34
- package/modules/weboramaRtdProvider.md +110 -40
- package/modules/yahoosspBidAdapter.js +3 -1
- package/modules/yieldoneBidAdapter.js +6 -0
- package/package.json +2 -1
- package/src/adRendering.js +38 -0
- package/src/adapterManager.js +24 -19
- package/src/adapters/bidderFactory.js +14 -11
- package/src/adloader.js +2 -1
- package/src/auction.js +138 -115
- package/src/auctionIndex.js +85 -0
- package/src/auctionManager.js +3 -0
- package/src/bidderSettings.js +69 -0
- package/src/bidfactory.js +18 -6
- package/src/native.js +29 -21
- package/src/prebid.js +3 -19
- package/src/secureCreatives.js +128 -45
- package/src/targeting.js +11 -2
- package/src/utils.js +14 -17
- package/src/video.js +10 -11
- 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 +268 -89
- package/test/spec/config_spec.js +24 -1
- package/test/spec/modules/adagioBidAdapter_spec.js +0 -10
- package/test/spec/modules/adnuntiusRtdProvider_spec.js +145 -0
- package/test/spec/modules/adotBidAdapter_spec.js +294 -3124
- package/test/spec/modules/adpod_spec.js +91 -156
- package/test/spec/modules/adyoulikeBidAdapter_spec.js +4 -0
- 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/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/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/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/imRtdProvider_spec.js +30 -1
- package/test/spec/modules/improvedigitalBidAdapter_spec.js +19 -0
- package/test/spec/modules/iqzoneBidAdapter_spec.js +1 -0
- package/test/spec/modules/ixBidAdapter_spec.js +1 -1
- package/test/spec/modules/kubientBidAdapter_spec.js +182 -84
- 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 +9 -5
- package/test/spec/modules/mediasquareBidAdapter_spec.js +25 -1
- package/test/spec/modules/oguryBidAdapter_spec.js +63 -5
- package/test/spec/modules/prebidServerBidAdapter_spec.js +43 -6
- package/test/spec/modules/priceFloors_spec.js +83 -24
- package/test/spec/modules/pubmaticBidAdapter_spec.js +40 -0
- package/test/spec/modules/riseBidAdapter_spec.js +30 -4
- package/test/spec/modules/rubiconAnalyticsAdapter_spec.js +31 -1
- package/test/spec/modules/rubiconBidAdapter_spec.js +1 -1
- 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/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 +39 -39
- package/test/spec/modules/vibrantmediaBidAdapter_spec.js +1237 -0
- package/test/spec/modules/vidoomyBidAdapter_spec.js +7 -1
- package/test/spec/modules/weboramaRtdProvider_spec.js +536 -20
- package/test/spec/modules/yahoosspBidAdapter_spec.js +10 -0
- package/test/spec/modules/yieldoneBidAdapter_spec.js +33 -0
- package/test/spec/native_spec.js +62 -40
- package/test/spec/unit/core/adapterManager_spec.js +22 -0
- 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 +80 -42
- 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
|
@@ -62,6 +62,7 @@ describe('dspxAdapter', function () {
|
|
|
62
62
|
'bidId': '30b31c1838de1e1',
|
|
63
63
|
'bidderRequestId': '22edbae2733bf61',
|
|
64
64
|
'auctionId': '1d1a030790a475',
|
|
65
|
+
'adUnitCode': 'testDiv1',
|
|
65
66
|
'userId': {
|
|
66
67
|
'netId': '123',
|
|
67
68
|
'uid2': '456'
|
|
@@ -98,7 +99,8 @@ describe('dspxAdapter', function () {
|
|
|
98
99
|
],
|
|
99
100
|
'bidId': '30b31c1838de1e3',
|
|
100
101
|
'bidderRequestId': '22edbae2733bf69',
|
|
101
|
-
'auctionId': '1d1a030790a477'
|
|
102
|
+
'auctionId': '1d1a030790a477',
|
|
103
|
+
'adUnitCode': 'testDiv2'
|
|
102
104
|
},
|
|
103
105
|
{
|
|
104
106
|
'bidder': 'dspx',
|
|
@@ -120,13 +122,15 @@ describe('dspxAdapter', function () {
|
|
|
120
122
|
|
|
121
123
|
'bidId': '30b31c1838de1e4',
|
|
122
124
|
'bidderRequestId': '22edbae2733bf67',
|
|
123
|
-
'auctionId': '1d1a030790a478'
|
|
125
|
+
'auctionId': '1d1a030790a478',
|
|
126
|
+
'adUnitCode': 'testDiv3'
|
|
124
127
|
},
|
|
125
128
|
{
|
|
126
129
|
'bidder': 'dspx',
|
|
127
130
|
'params': {
|
|
128
131
|
'placement': '101',
|
|
129
|
-
'devMode': true
|
|
132
|
+
'devMode': true,
|
|
133
|
+
'vastFormat': 'vast4'
|
|
130
134
|
},
|
|
131
135
|
'mediaTypes': {
|
|
132
136
|
'video': {
|
|
@@ -136,7 +140,8 @@ describe('dspxAdapter', function () {
|
|
|
136
140
|
},
|
|
137
141
|
'bidId': '30b31c1838de1e41',
|
|
138
142
|
'bidderRequestId': '22edbae2733bf67',
|
|
139
|
-
'auctionId': '1d1a030790a478'
|
|
143
|
+
'auctionId': '1d1a030790a478',
|
|
144
|
+
'adUnitCode': 'testDiv4'
|
|
140
145
|
}
|
|
141
146
|
|
|
142
147
|
];
|
|
@@ -157,16 +162,16 @@ describe('dspxAdapter', function () {
|
|
|
157
162
|
it('sends bid request to our endpoint via GET', function () {
|
|
158
163
|
expect(request1.method).to.equal('GET');
|
|
159
164
|
expect(request1.url).to.equal(ENDPOINT_URL);
|
|
160
|
-
let data = request1.data.replace(/rnd=\d+\&/g, '').replace(/ref=.*\&bid/g, 'bid');
|
|
161
|
-
expect(data).to.equal('_f=
|
|
165
|
+
let data = request1.data.replace(/rnd=\d+\&/g, '').replace(/ref=.*\&bid/g, 'bid').replace(/pbver=.*?&/g, 'pbver=test&');
|
|
166
|
+
expect(data).to.equal('_f=auto&alternative=prebid_js&inventory_item_id=6682&srw=300&srh=250&idt=100&bid_id=30b31c1838de1e1&pbver=test&pfilter%5Bfloorprice%5D=1000000&pfilter%5Bprivate_auction%5D=0&pfilter%5Bgeo%5D%5Bcountry%5D=DE&pfilter%5Bgdpr_consent%5D=BOJ%2FP2HOJ%2FP2HABABMAAAAAZ%2BA%3D%3D&pfilter%5Bgdpr%5D=true&bcat=IAB2%2CIAB4&dvt=desktop&did_netid=123&did_uid2=456&auctionId=1d1a030790a475&pbcode=testDiv1&media_types%5Bbanner%5D=300x250');
|
|
162
167
|
});
|
|
163
168
|
|
|
164
169
|
var request2 = spec.buildRequests([bidRequests[1]], bidderRequest)[0];
|
|
165
170
|
it('sends bid request to our DEV endpoint via GET', function () {
|
|
166
171
|
expect(request2.method).to.equal('GET');
|
|
167
172
|
expect(request2.url).to.equal(ENDPOINT_URL_DEV);
|
|
168
|
-
let data = request2.data.replace(/rnd=\d+\&/g, '').replace(/ref=.*\&bid/g, 'bid');
|
|
169
|
-
expect(data).to.equal('_f=
|
|
173
|
+
let data = request2.data.replace(/rnd=\d+\&/g, '').replace(/ref=.*\&bid/g, 'bid').replace(/pbver=.*?&/g, 'pbver=test&');
|
|
174
|
+
expect(data).to.equal('_f=auto&alternative=prebid_js&inventory_item_id=101&srw=300&srh=250&idt=100&bid_id=30b31c1838de1e2&pbver=test&pfilter%5Bgdpr_consent%5D=BOJ%2FP2HOJ%2FP2HABABMAAAAAZ%2BA%3D%3D&pfilter%5Bgdpr%5D=true&prebidDevMode=1&auctionId=1d1a030790a476&media_types%5Bbanner%5D=300x250');
|
|
170
175
|
});
|
|
171
176
|
|
|
172
177
|
// Without gdprConsent
|
|
@@ -179,23 +184,23 @@ describe('dspxAdapter', function () {
|
|
|
179
184
|
it('sends bid request without gdprConsent to our endpoint via GET', function () {
|
|
180
185
|
expect(request3.method).to.equal('GET');
|
|
181
186
|
expect(request3.url).to.equal(ENDPOINT_URL);
|
|
182
|
-
let data = request3.data.replace(/rnd=\d+\&/g, '').replace(/ref=.*\&bid/g, 'bid');
|
|
183
|
-
expect(data).to.equal('_f=
|
|
187
|
+
let data = request3.data.replace(/rnd=\d+\&/g, '').replace(/ref=.*\&bid/g, 'bid').replace(/pbver=.*?&/g, 'pbver=test&');
|
|
188
|
+
expect(data).to.equal('_f=auto&alternative=prebid_js&inventory_item_id=6682&srw=300&srh=250&idt=100&bid_id=30b31c1838de1e3&pbver=test&pfilter%5Bfloorprice%5D=1000000&pfilter%5Bprivate_auction%5D=0&pfilter%5Bgeo%5D%5Bcountry%5D=DE&bcat=IAB2%2CIAB4&dvt=desktop&auctionId=1d1a030790a477&pbcode=testDiv2&media_types%5Bbanner%5D=300x250');
|
|
184
189
|
});
|
|
185
190
|
|
|
186
191
|
var request4 = spec.buildRequests([bidRequests[3]], bidderRequestWithoutGdpr)[0];
|
|
187
192
|
it('sends bid request without gdprConsent to our DEV endpoint via GET', function () {
|
|
188
193
|
expect(request4.method).to.equal('GET');
|
|
189
194
|
expect(request4.url).to.equal(ENDPOINT_URL_DEV);
|
|
190
|
-
let data = request4.data.replace(/rnd=\d+\&/g, '').replace(/ref=.*\&bid/g, 'bid');
|
|
191
|
-
expect(data).to.equal('_f=
|
|
195
|
+
let data = request4.data.replace(/rnd=\d+\&/g, '').replace(/ref=.*\&bid/g, 'bid').replace(/pbver=.*?&/g, 'pbver=test&');
|
|
196
|
+
expect(data).to.equal('_f=auto&alternative=prebid_js&inventory_item_id=101&srw=300&srh=250&idt=100&bid_id=30b31c1838de1e4&pbver=test&prebidDevMode=1&auctionId=1d1a030790a478&pbcode=testDiv3&media_types%5Bvideo%5D=640x480&media_types%5Bbanner%5D=300x250');
|
|
192
197
|
});
|
|
193
198
|
|
|
194
199
|
var request5 = spec.buildRequests([bidRequests[4]], bidderRequestWithoutGdpr)[0];
|
|
195
|
-
it('sends bid video request to our
|
|
200
|
+
it('sends bid video request to our endpoint via GET', function () {
|
|
196
201
|
expect(request5.method).to.equal('GET');
|
|
197
|
-
let data = request5.data.replace(/rnd=\d+\&/g, '').replace(/ref=.*\&bid/g, 'bid');
|
|
198
|
-
expect(data).to.equal('_f=
|
|
202
|
+
let data = request5.data.replace(/rnd=\d+\&/g, '').replace(/ref=.*\&bid/g, 'bid').replace(/pbver=.*?&/g, 'pbver=test&');
|
|
203
|
+
expect(data).to.equal('_f=auto&alternative=prebid_js&inventory_item_id=101&srw=640&srh=480&idt=100&bid_id=30b31c1838de1e41&pbver=test&vf=vast4&prebidDevMode=1&auctionId=1d1a030790a478&pbcode=testDiv4&media_types%5Bvideo%5D=640x480');
|
|
199
204
|
});
|
|
200
205
|
});
|
|
201
206
|
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import {expect} from 'chai';
|
|
2
|
+
import {spec} from '../../../modules/e_volutionBidAdapter.js';
|
|
3
|
+
|
|
4
|
+
describe('EvolutionTechBidAdapter', function () {
|
|
5
|
+
let bid = {
|
|
6
|
+
bidId: '23fhj33i987f',
|
|
7
|
+
bidder: 'e_volution',
|
|
8
|
+
params: {
|
|
9
|
+
placementId: 0
|
|
10
|
+
},
|
|
11
|
+
mediaTypes: {
|
|
12
|
+
banner: {
|
|
13
|
+
sizes: [[300, 250]],
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
describe('isBidRequestValid', function () {
|
|
19
|
+
it('Should return true if there are bidId, params and placementId parameters present', function () {
|
|
20
|
+
expect(spec.isBidRequestValid(bid)).to.be.true;
|
|
21
|
+
});
|
|
22
|
+
it('Should return false if at least one of parameters is not present', function () {
|
|
23
|
+
delete bid.params.placementId;
|
|
24
|
+
expect(spec.isBidRequestValid(bid)).to.be.false;
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
describe('buildRequests', function () {
|
|
29
|
+
let serverRequest = spec.buildRequests([bid]);
|
|
30
|
+
it('Creates a ServerRequest object with method, URL and data', function () {
|
|
31
|
+
expect(serverRequest).to.exist;
|
|
32
|
+
expect(serverRequest.method).to.exist;
|
|
33
|
+
expect(serverRequest.url).to.exist;
|
|
34
|
+
expect(serverRequest.data).to.exist;
|
|
35
|
+
});
|
|
36
|
+
it('Returns POST method', function () {
|
|
37
|
+
expect(serverRequest.method).to.equal('POST');
|
|
38
|
+
});
|
|
39
|
+
it('Returns valid URL', function () {
|
|
40
|
+
expect(serverRequest.url).to.equal('https://service.e-volution.ai/?c=o&m=multi');
|
|
41
|
+
});
|
|
42
|
+
it('Returns valid data if array of bids is valid', function () {
|
|
43
|
+
let data = serverRequest.data;
|
|
44
|
+
expect(data).to.be.an('object');
|
|
45
|
+
expect(data).to.have.all.keys('deviceWidth', 'deviceHeight', 'language', 'secure', 'host', 'page', 'placements');
|
|
46
|
+
expect(data.deviceWidth).to.be.a('number');
|
|
47
|
+
expect(data.deviceHeight).to.be.a('number');
|
|
48
|
+
expect(data.language).to.be.a('string');
|
|
49
|
+
expect(data.secure).to.be.within(0, 1);
|
|
50
|
+
expect(data.host).to.be.a('string');
|
|
51
|
+
expect(data.page).to.be.a('string');
|
|
52
|
+
let placement = data['placements'][0];
|
|
53
|
+
expect(placement).to.have.keys('placementId', 'bidId', 'traffic', 'sizes', 'bidfloor');
|
|
54
|
+
expect(placement.placementId).to.equal(0);
|
|
55
|
+
expect(placement.bidId).to.equal('23fhj33i987f');
|
|
56
|
+
expect(placement.traffic).to.equal('banner');
|
|
57
|
+
});
|
|
58
|
+
it('Returns empty data if no valid requests are passed', function () {
|
|
59
|
+
serverRequest = spec.buildRequests([]);
|
|
60
|
+
let data = serverRequest.data;
|
|
61
|
+
expect(data.placements).to.be.an('array').that.is.empty;
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
describe('interpretResponse', function () {
|
|
65
|
+
it('Should interpret banner response', function () {
|
|
66
|
+
const banner = {
|
|
67
|
+
body: [{
|
|
68
|
+
mediaType: 'banner',
|
|
69
|
+
width: 300,
|
|
70
|
+
height: 250,
|
|
71
|
+
cpm: 0.4,
|
|
72
|
+
ad: 'Test',
|
|
73
|
+
requestId: '23fhj33i987f',
|
|
74
|
+
ttl: 120,
|
|
75
|
+
creativeId: '2',
|
|
76
|
+
netRevenue: true,
|
|
77
|
+
currency: 'USD',
|
|
78
|
+
dealId: '1',
|
|
79
|
+
meta: {}
|
|
80
|
+
}]
|
|
81
|
+
};
|
|
82
|
+
let bannerResponses = spec.interpretResponse(banner);
|
|
83
|
+
expect(bannerResponses).to.be.an('array').that.is.not.empty;
|
|
84
|
+
let dataItem = bannerResponses[0];
|
|
85
|
+
expect(dataItem).to.have.all.keys('requestId', 'cpm', 'width', 'height', 'ad', 'ttl', 'creativeId',
|
|
86
|
+
'netRevenue', 'currency', 'dealId', 'mediaType', 'meta');
|
|
87
|
+
expect(dataItem.requestId).to.equal('23fhj33i987f');
|
|
88
|
+
expect(dataItem.cpm).to.equal(0.4);
|
|
89
|
+
expect(dataItem.width).to.equal(300);
|
|
90
|
+
expect(dataItem.height).to.equal(250);
|
|
91
|
+
expect(dataItem.ad).to.equal('Test');
|
|
92
|
+
expect(dataItem.ttl).to.equal(120);
|
|
93
|
+
expect(dataItem.creativeId).to.equal('2');
|
|
94
|
+
expect(dataItem.netRevenue).to.be.true;
|
|
95
|
+
expect(dataItem.currency).to.equal('USD');
|
|
96
|
+
});
|
|
97
|
+
it('Should interpret video response', function () {
|
|
98
|
+
const video = {
|
|
99
|
+
body: [{
|
|
100
|
+
vastUrl: 'test.com',
|
|
101
|
+
mediaType: 'video',
|
|
102
|
+
cpm: 0.5,
|
|
103
|
+
requestId: '23fhj33i987f',
|
|
104
|
+
ttl: 120,
|
|
105
|
+
creativeId: '2',
|
|
106
|
+
netRevenue: true,
|
|
107
|
+
currency: 'USD',
|
|
108
|
+
dealId: '1',
|
|
109
|
+
meta: {}
|
|
110
|
+
}]
|
|
111
|
+
};
|
|
112
|
+
let videoResponses = spec.interpretResponse(video);
|
|
113
|
+
expect(videoResponses).to.be.an('array').that.is.not.empty;
|
|
114
|
+
|
|
115
|
+
let dataItem = videoResponses[0];
|
|
116
|
+
expect(dataItem).to.have.all.keys('requestId', 'cpm', 'vastUrl', 'ttl', 'creativeId',
|
|
117
|
+
'netRevenue', 'currency', 'dealId', 'mediaType', 'meta');
|
|
118
|
+
expect(dataItem.requestId).to.equal('23fhj33i987f');
|
|
119
|
+
expect(dataItem.cpm).to.equal(0.5);
|
|
120
|
+
expect(dataItem.vastUrl).to.equal('test.com');
|
|
121
|
+
expect(dataItem.ttl).to.equal(120);
|
|
122
|
+
expect(dataItem.creativeId).to.equal('2');
|
|
123
|
+
expect(dataItem.netRevenue).to.be.true;
|
|
124
|
+
expect(dataItem.currency).to.equal('USD');
|
|
125
|
+
});
|
|
126
|
+
it('Should interpret native response', function () {
|
|
127
|
+
const native = {
|
|
128
|
+
body: [{
|
|
129
|
+
mediaType: 'native',
|
|
130
|
+
native: {
|
|
131
|
+
clickUrl: 'test.com',
|
|
132
|
+
title: 'Test',
|
|
133
|
+
image: 'test.com',
|
|
134
|
+
impressionTrackers: ['test.com'],
|
|
135
|
+
},
|
|
136
|
+
ttl: 120,
|
|
137
|
+
cpm: 0.4,
|
|
138
|
+
requestId: '23fhj33i987f',
|
|
139
|
+
creativeId: '2',
|
|
140
|
+
netRevenue: true,
|
|
141
|
+
currency: 'USD',
|
|
142
|
+
meta: {}
|
|
143
|
+
}]
|
|
144
|
+
};
|
|
145
|
+
let nativeResponses = spec.interpretResponse(native);
|
|
146
|
+
expect(nativeResponses).to.be.an('array').that.is.not.empty;
|
|
147
|
+
|
|
148
|
+
let dataItem = nativeResponses[0];
|
|
149
|
+
expect(dataItem).to.have.keys('requestId', 'cpm', 'ttl', 'creativeId', 'netRevenue', 'currency', 'mediaType', 'native', 'meta');
|
|
150
|
+
expect(dataItem.native).to.have.keys('clickUrl', 'impressionTrackers', 'title', 'image')
|
|
151
|
+
expect(dataItem.requestId).to.equal('23fhj33i987f');
|
|
152
|
+
expect(dataItem.cpm).to.equal(0.4);
|
|
153
|
+
expect(dataItem.native.clickUrl).to.equal('test.com');
|
|
154
|
+
expect(dataItem.native.title).to.equal('Test');
|
|
155
|
+
expect(dataItem.native.image).to.equal('test.com');
|
|
156
|
+
expect(dataItem.native.impressionTrackers).to.be.an('array').that.is.not.empty;
|
|
157
|
+
expect(dataItem.native.impressionTrackers[0]).to.equal('test.com');
|
|
158
|
+
expect(dataItem.ttl).to.equal(120);
|
|
159
|
+
expect(dataItem.creativeId).to.equal('2');
|
|
160
|
+
expect(dataItem.netRevenue).to.be.true;
|
|
161
|
+
expect(dataItem.currency).to.equal('USD');
|
|
162
|
+
});
|
|
163
|
+
it('Should return an empty array if invalid banner response is passed', function () {
|
|
164
|
+
const invBanner = {
|
|
165
|
+
body: [{
|
|
166
|
+
width: 300,
|
|
167
|
+
cpm: 0.4,
|
|
168
|
+
ad: 'Test',
|
|
169
|
+
requestId: '23fhj33i987f',
|
|
170
|
+
ttl: 120,
|
|
171
|
+
creativeId: '2',
|
|
172
|
+
netRevenue: true,
|
|
173
|
+
currency: 'USD',
|
|
174
|
+
dealId: '1'
|
|
175
|
+
}]
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
let serverResponses = spec.interpretResponse(invBanner);
|
|
179
|
+
expect(serverResponses).to.be.an('array').that.is.empty;
|
|
180
|
+
});
|
|
181
|
+
it('Should return an empty array if invalid video response is passed', function () {
|
|
182
|
+
const invVideo = {
|
|
183
|
+
body: [{
|
|
184
|
+
mediaType: 'video',
|
|
185
|
+
cpm: 0.5,
|
|
186
|
+
requestId: '23fhj33i987f',
|
|
187
|
+
ttl: 120,
|
|
188
|
+
creativeId: '2',
|
|
189
|
+
netRevenue: true,
|
|
190
|
+
currency: 'USD',
|
|
191
|
+
dealId: '1'
|
|
192
|
+
}]
|
|
193
|
+
};
|
|
194
|
+
let serverResponses = spec.interpretResponse(invVideo);
|
|
195
|
+
expect(serverResponses).to.be.an('array').that.is.empty;
|
|
196
|
+
});
|
|
197
|
+
it('Should return an empty array if invalid native response is passed', function () {
|
|
198
|
+
const invNative = {
|
|
199
|
+
body: [{
|
|
200
|
+
mediaType: 'native',
|
|
201
|
+
clickUrl: 'test.com',
|
|
202
|
+
title: 'Test',
|
|
203
|
+
impressionTrackers: ['test.com'],
|
|
204
|
+
ttl: 120,
|
|
205
|
+
requestId: '23fhj33i987f',
|
|
206
|
+
creativeId: '2',
|
|
207
|
+
netRevenue: true,
|
|
208
|
+
currency: 'USD',
|
|
209
|
+
}]
|
|
210
|
+
};
|
|
211
|
+
let serverResponses = spec.interpretResponse(invNative);
|
|
212
|
+
expect(serverResponses).to.be.an('array').that.is.empty;
|
|
213
|
+
});
|
|
214
|
+
it('Should return an empty array if invalid response is passed', function () {
|
|
215
|
+
const invalid = {
|
|
216
|
+
body: [{
|
|
217
|
+
ttl: 120,
|
|
218
|
+
creativeId: '2',
|
|
219
|
+
netRevenue: true,
|
|
220
|
+
currency: 'USD',
|
|
221
|
+
dealId: '1'
|
|
222
|
+
}]
|
|
223
|
+
};
|
|
224
|
+
let serverResponses = spec.interpretResponse(invalid);
|
|
225
|
+
expect(serverResponses).to.be.an('array').that.is.empty;
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
describe('getUserSyncs', function () {
|
|
229
|
+
let userSync = spec.getUserSyncs();
|
|
230
|
+
it('Returns valid URL and type', function () {
|
|
231
|
+
if (spec.noSync) {
|
|
232
|
+
expect(userSync).to.be.equal(false);
|
|
233
|
+
} else {
|
|
234
|
+
expect(userSync).to.be.an('array').with.lengthOf(1);
|
|
235
|
+
expect(userSync[0].type).to.exist;
|
|
236
|
+
expect(userSync[0].url).to.exist;
|
|
237
|
+
expect(userSync[0].type).to.be.equal('image');
|
|
238
|
+
expect(userSync[0].url).to.be.equal('https://service.e-volution.ai/?c=o&m=sync');
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
});
|
|
@@ -240,9 +240,9 @@ describe('eids array generation for known sub-modules', function() {
|
|
|
240
240
|
});
|
|
241
241
|
});
|
|
242
242
|
|
|
243
|
-
it('
|
|
243
|
+
it('hadronId', function() {
|
|
244
244
|
const userId = {
|
|
245
|
-
|
|
245
|
+
hadronId: 'some-random-id-value'
|
|
246
246
|
};
|
|
247
247
|
const newEids = createEidsArray(userId);
|
|
248
248
|
expect(newEids.length).to.equal(1);
|
|
@@ -381,6 +381,24 @@ describe('TheMediaGrid Adapter', function () {
|
|
|
381
381
|
expect(payload.user.ext.eids).to.deep.equal(eids);
|
|
382
382
|
});
|
|
383
383
|
|
|
384
|
+
it('if userId is present payload must have user.ext param with right keys', function () {
|
|
385
|
+
const ortb2UserExtDevice = {
|
|
386
|
+
screenWidth: 1200,
|
|
387
|
+
screenHeight: 800,
|
|
388
|
+
language: 'ru'
|
|
389
|
+
};
|
|
390
|
+
const getConfigStub = sinon.stub(config, 'getConfig').callsFake(
|
|
391
|
+
arg => arg === 'ortb2.user.ext.device' ? ortb2UserExtDevice : null);
|
|
392
|
+
|
|
393
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
394
|
+
expect(request.data).to.be.an('string');
|
|
395
|
+
const payload = parseRequest(request.data);
|
|
396
|
+
expect(payload).to.have.property('user');
|
|
397
|
+
expect(payload.user).to.have.property('ext');
|
|
398
|
+
expect(payload.user.ext.device).to.deep.equal(ortb2UserExtDevice);
|
|
399
|
+
getConfigStub.restore();
|
|
400
|
+
});
|
|
401
|
+
|
|
384
402
|
it('if schain is present payload must have source.ext.schain param', function () {
|
|
385
403
|
const schain = {
|
|
386
404
|
complete: 1,
|
|
@@ -198,8 +198,8 @@ describe('gumgumAdapter', function () {
|
|
|
198
198
|
slotRequest.params.slot = invalidSlotId;
|
|
199
199
|
legacySlotRequest.params.inSlot = invalidSlotId;
|
|
200
200
|
|
|
201
|
-
req = spec.buildRequests([
|
|
202
|
-
legReq = spec.buildRequests([
|
|
201
|
+
req = spec.buildRequests([slotRequest])[0];
|
|
202
|
+
legReq = spec.buildRequests([legacySlotRequest])[0];
|
|
203
203
|
|
|
204
204
|
expect(req.data.si).to.equal(invalidSlotId);
|
|
205
205
|
expect(legReq.data.si).to.equal(invalidSlotId);
|
|
@@ -544,6 +544,52 @@ describe('gumgumAdapter', function () {
|
|
|
544
544
|
const bidRequest = spec.buildRequests(bidRequests)[0];
|
|
545
545
|
expect(!!bidRequest.data.lt).to.be.true;
|
|
546
546
|
});
|
|
547
|
+
|
|
548
|
+
it('should handle no gg params', function () {
|
|
549
|
+
const bidRequest = spec.buildRequests(bidRequests, { refererInfo: { referer: 'https://www.prebid.org/?param1=foo¶m2=bar¶m3=baz' } })[0];
|
|
550
|
+
|
|
551
|
+
// no params are in object
|
|
552
|
+
expect(bidRequest.data.hasOwnProperty('eAdBuyId')).to.be.false;
|
|
553
|
+
expect(bidRequest.data.hasOwnProperty('adBuyId')).to.be.false;
|
|
554
|
+
expect(bidRequest.data.hasOwnProperty('ggdeal')).to.be.false;
|
|
555
|
+
});
|
|
556
|
+
|
|
557
|
+
it('should handle encrypted ad buy id', function () {
|
|
558
|
+
const bidRequest = spec.buildRequests(bidRequests, { refererInfo: { referer: 'https://www.prebid.org/?param1=foo&ggad=bar¶m3=baz' } })[0];
|
|
559
|
+
|
|
560
|
+
// correct params are in object
|
|
561
|
+
expect(bidRequest.data.hasOwnProperty('eAdBuyId')).to.be.true;
|
|
562
|
+
expect(bidRequest.data.hasOwnProperty('adBuyId')).to.be.false;
|
|
563
|
+
expect(bidRequest.data.hasOwnProperty('ggdeal')).to.be.false;
|
|
564
|
+
|
|
565
|
+
// params are stripped from pu property
|
|
566
|
+
expect(bidRequest.data.pu.includes('ggad')).to.be.false;
|
|
567
|
+
});
|
|
568
|
+
|
|
569
|
+
it('should handle unencrypted ad buy id', function () {
|
|
570
|
+
const bidRequest = spec.buildRequests(bidRequests, { refererInfo: { referer: 'https://www.prebid.org/?param1=foo&ggad=123¶m3=baz' } })[0];
|
|
571
|
+
|
|
572
|
+
// correct params are in object
|
|
573
|
+
expect(bidRequest.data.hasOwnProperty('eAdBuyId')).to.be.false;
|
|
574
|
+
expect(bidRequest.data.hasOwnProperty('adBuyId')).to.be.true;
|
|
575
|
+
expect(bidRequest.data.hasOwnProperty('ggdeal')).to.be.false;
|
|
576
|
+
|
|
577
|
+
// params are stripped from pu property
|
|
578
|
+
expect(bidRequest.data.pu.includes('ggad')).to.be.false;
|
|
579
|
+
});
|
|
580
|
+
|
|
581
|
+
it('should handle multiple gg params', function () {
|
|
582
|
+
const bidRequest = spec.buildRequests(bidRequests, { refererInfo: { referer: 'https://www.prebid.org/?ggdeal=foo&ggad=bar¶m3=baz' } })[0];
|
|
583
|
+
|
|
584
|
+
// correct params are in object
|
|
585
|
+
expect(bidRequest.data.hasOwnProperty('eAdBuyId')).to.be.true;
|
|
586
|
+
expect(bidRequest.data.hasOwnProperty('adBuyId')).to.be.false;
|
|
587
|
+
expect(bidRequest.data.hasOwnProperty('ggdeal')).to.be.true;
|
|
588
|
+
|
|
589
|
+
// params are stripped from pu property
|
|
590
|
+
expect(bidRequest.data.pu.includes('ggad')).to.be.false;
|
|
591
|
+
expect(bidRequest.data.pu.includes('ggdeal')).to.be.false;
|
|
592
|
+
});
|
|
547
593
|
})
|
|
548
594
|
|
|
549
595
|
describe('interpretResponse', function () {
|
|
@@ -696,7 +742,7 @@ describe('gumgumAdapter', function () {
|
|
|
696
742
|
it('uses request size that nearest matches response size for in-screen', function () {
|
|
697
743
|
const request = { ...bidRequest };
|
|
698
744
|
const body = { ...serverResponse };
|
|
699
|
-
const expectedSize = [
|
|
745
|
+
const expectedSize = [300, 50];
|
|
700
746
|
let result;
|
|
701
747
|
|
|
702
748
|
request.pi = 2;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { hadronIdSubmodule, storage } from 'modules/hadronIdSystem.js';
|
|
2
|
+
import { server } from 'test/mocks/xhr.js';
|
|
3
|
+
import * as utils from 'src/utils.js';
|
|
4
|
+
|
|
5
|
+
describe('HadronIdSystem', function () {
|
|
6
|
+
describe('getId', function() {
|
|
7
|
+
let getDataFromLocalStorageStub;
|
|
8
|
+
|
|
9
|
+
beforeEach(function() {
|
|
10
|
+
getDataFromLocalStorageStub = sinon.stub(storage, 'getDataFromLocalStorage');
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
afterEach(function () {
|
|
14
|
+
getDataFromLocalStorageStub.restore();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('gets a hadronId', function() {
|
|
18
|
+
const config = {
|
|
19
|
+
params: {}
|
|
20
|
+
};
|
|
21
|
+
const callbackSpy = sinon.spy();
|
|
22
|
+
const callback = hadronIdSubmodule.getId(config).callback;
|
|
23
|
+
callback(callbackSpy);
|
|
24
|
+
const request = server.requests[0];
|
|
25
|
+
expect(request.url).to.eq(`https://id.hadron.ad.gt/api/v1/pbhid`);
|
|
26
|
+
request.respond(200, { 'Content-Type': 'application/json' }, JSON.stringify({ hadronId: 'testHadronId1' }));
|
|
27
|
+
expect(callbackSpy.lastCall.lastArg).to.deep.equal({hadronId: 'testHadronId1'});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('gets a cached hadronid', function() {
|
|
31
|
+
const config = {
|
|
32
|
+
params: {}
|
|
33
|
+
};
|
|
34
|
+
getDataFromLocalStorageStub.withArgs('auHadronId').returns('tstCachedHadronId1');
|
|
35
|
+
|
|
36
|
+
const callbackSpy = sinon.spy();
|
|
37
|
+
const callback = hadronIdSubmodule.getId(config).callback;
|
|
38
|
+
callback(callbackSpy);
|
|
39
|
+
expect(callbackSpy.lastCall.lastArg).to.deep.equal({hadronId: 'tstCachedHadronId1'});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('allows configurable id url', function() {
|
|
43
|
+
const config = {
|
|
44
|
+
params: {
|
|
45
|
+
url: 'https://hadronid.publync.com'
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const callbackSpy = sinon.spy();
|
|
49
|
+
const callback = hadronIdSubmodule.getId(config).callback;
|
|
50
|
+
callback(callbackSpy);
|
|
51
|
+
const request = server.requests[0];
|
|
52
|
+
expect(request.url).to.eq('https://hadronid.publync.com');
|
|
53
|
+
request.respond(200, { 'Content-Type': 'application/json' }, JSON.stringify({ hadronId: 'testHadronId1' }));
|
|
54
|
+
expect(callbackSpy.lastCall.lastArg).to.deep.equal({hadronId: 'testHadronId1'});
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
});
|