prebid.js 7.13.0 → 7.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/33acrossBidAdapter.js +1 -1
- package/dist/adagioBidAdapter.js +1 -1
- package/dist/adbookpspBidAdapter.js +1 -1
- package/dist/adgenerationBidAdapter.js +1 -1
- package/dist/adrelevantisBidAdapter.js +1 -1
- package/dist/adrinoBidAdapter.js +1 -1
- package/dist/adtelligentBidAdapter.js +1 -1
- package/dist/adtrgtmeBidAdapter.js +1 -1
- package/dist/adxcgBidAdapter.js +1 -1
- package/dist/ajaBidAdapter.js +1 -1
- package/dist/amxBidAdapter.js +1 -1
- package/dist/amxIdSystem.js +1 -1
- package/dist/appierAnalyticsAdapter.js +1 -1
- package/dist/appnexusBidAdapter.js +1 -1
- package/dist/asoBidAdapter.js +1 -1
- package/dist/axonixBidAdapter.js +1 -1
- package/dist/bidglassBidAdapter.js +1 -1
- package/dist/bidwatchAnalyticsAdapter.js +1 -1
- package/dist/big-richmediaBidAdapter.js +1 -1
- package/dist/bridgewellBidAdapter.js +1 -1
- package/dist/brightMountainMediaBidAdapter.js +1 -1
- package/dist/concertBidAdapter.js +1 -1
- package/dist/connectadBidAdapter.js +1 -1
- package/dist/consumableBidAdapter.js +1 -1
- package/dist/conversantBidAdapter.js +1 -1
- package/dist/craftBidAdapter.js +1 -1
- package/dist/criteoBidAdapter.js +1 -1
- package/dist/discoveryBidAdapter.js +1 -0
- package/dist/dspxBidAdapter.js +1 -1
- package/dist/eplanningBidAdapter.js +1 -1
- package/dist/finativeBidAdapter.js +1 -1
- package/dist/fledgeForGpt.js +1 -0
- package/dist/glimpseBidAdapter.js +1 -1
- package/dist/gmosspBidAdapter.js +1 -1
- package/dist/goldbachBidAdapter.js +1 -1
- package/dist/gridBidAdapter.js +1 -1
- package/dist/gridNMBidAdapter.js +1 -1
- package/dist/gumgumBidAdapter.js +1 -1
- package/dist/h12mediaBidAdapter.js +1 -1
- package/dist/id5IdSystem.js +1 -1
- package/dist/improvedigitalBidAdapter.js +1 -1
- package/dist/inmarBidAdapter.js +1 -1
- package/dist/insticatorBidAdapter.js +1 -1
- package/dist/invibesBidAdapter.js +1 -1
- package/dist/ixBidAdapter.js +1 -1
- package/dist/justpremiumBidAdapter.js +1 -1
- package/dist/kargoBidAdapter.js +1 -1
- package/dist/konduitAnalyticsAdapter.js +1 -1
- package/dist/kueezBidAdapter.js +1 -1
- package/dist/lassoBidAdapter.js +1 -1
- package/dist/lifestreetBidAdapter.js +1 -1
- package/dist/liveyieldAnalyticsAdapter.js +1 -1
- package/dist/logicadBidAdapter.js +1 -1
- package/dist/loglyliftBidAdapter.js +1 -1
- package/dist/malltvAnalyticsAdapter.js +1 -1
- package/dist/marsmediaBidAdapter.js +1 -1
- package/dist/mediafuseBidAdapter.js +1 -1
- package/dist/mediasquareBidAdapter.js +1 -1
- package/dist/mgidBidAdapter.js +1 -1
- package/dist/minutemediaBidAdapter.js +1 -1
- package/dist/not-for-prod/prebid.js +117 -114
- package/dist/oguryBidAdapter.js +1 -1
- package/dist/onetagBidAdapter.js +1 -1
- package/dist/ooloAnalyticsAdapter.js +1 -1
- package/dist/openxOrtbBidAdapter.js +1 -1
- package/dist/outbrainBidAdapter.js +1 -1
- package/dist/parrableIdSystem.js +1 -1
- package/dist/pixfutureBidAdapter.js +1 -1
- package/dist/prebid-core.js +1 -1
- package/dist/publinkIdSystem.js +1 -1
- package/dist/pubmaticBidAdapter.js +1 -1
- package/dist/pubwiseAnalyticsAdapter.js +1 -1
- package/dist/pxyzBidAdapter.js +1 -1
- package/dist/quantcastBidAdapter.js +1 -1
- package/dist/readpeakBidAdapter.js +1 -1
- package/dist/relaidoBidAdapter.js +1 -1
- package/dist/rhythmoneBidAdapter.js +1 -1
- package/dist/riseBidAdapter.js +1 -1
- package/dist/rubiconAnalyticsAdapter.js +1 -1
- package/dist/rubiconBidAdapter.js +1 -1
- package/dist/seedingAllianceBidAdapter.js +1 -1
- package/dist/seedtagBidAdapter.js +1 -1
- package/dist/sharethroughAnalyticsAdapter.js +1 -1
- package/dist/sharethroughBidAdapter.js +1 -1
- package/dist/shinezBidAdapter.js +1 -1
- package/dist/smaatoBidAdapter.js +1 -1
- package/dist/smartadserverBidAdapter.js +1 -1
- package/dist/smartxBidAdapter.js +1 -1
- package/dist/smilewantedBidAdapter.js +1 -1
- package/dist/sonobiBidAdapter.js +1 -1
- package/dist/sovrnAnalyticsAdapter.js +1 -1
- package/dist/sovrnBidAdapter.js +1 -1
- package/dist/spotxBidAdapter.js +1 -1
- package/dist/sspBCBidAdapter.js +1 -1
- package/dist/sublimeBidAdapter.js +1 -1
- package/dist/synacormediaBidAdapter.js +1 -1
- package/dist/taboolaBidAdapter.js +1 -1
- package/dist/targetVideoBidAdapter.js +1 -1
- package/dist/teadsBidAdapter.js +1 -1
- package/dist/trionBidAdapter.js +1 -1
- package/dist/tripleliftBidAdapter.js +1 -1
- package/dist/ttdBidAdapter.js +1 -1
- package/dist/ucfunnelAnalyticsAdapter.js +1 -1
- package/dist/underdogmediaBidAdapter.js +1 -1
- package/dist/undertoneBidAdapter.js +1 -1
- package/dist/vidazooBidAdapter.js +1 -1
- package/dist/videobyteBidAdapter.js +1 -1
- package/dist/visxBidAdapter.js +1 -1
- package/dist/vuukleBidAdapter.js +1 -1
- package/dist/widespaceBidAdapter.js +1 -1
- package/dist/winrBidAdapter.js +1 -1
- package/dist/xeBidAdapter.js +1 -0
- package/dist/yahoosspBidAdapter.js +1 -1
- package/dist/yieldlabBidAdapter.js +1 -1
- package/dist/yieldmoBidAdapter.js +1 -1
- package/dist/yieldoneAnalyticsAdapter.js +1 -1
- package/modules/adrinoBidAdapter.js +1 -1
- package/modules/adtelligentBidAdapter.js +1 -1
- package/modules/bidwatchAnalyticsAdapter.js +10 -2
- package/modules/discoveryBidAdapter.js +467 -0
- package/modules/discoveryBidAdapter.md +60 -0
- package/modules/fledgeForGpt.js +52 -0
- package/modules/fledgeForGpt.md +60 -0
- package/modules/invibesBidAdapter.js +22 -11
- package/modules/kargoBidAdapter.js +7 -0
- package/modules/onetagBidAdapter.js +2 -3
- package/modules/openxOrtbBidAdapter.js +28 -2
- package/modules/outbrainBidAdapter.js +6 -3
- package/modules/spotxBidAdapter.js +10 -26
- package/modules/taboolaBidAdapter.js +2 -2
- package/modules/taboolaBidAdapter.md +10 -8
- package/modules/xeBidAdapter.js +206 -0
- package/modules/xeBidAdapter.md +54 -0
- package/modules/yieldlabBidAdapter.js +34 -3
- package/modules/yieldmoBidAdapter.js +16 -1
- package/package.json +2 -2
- package/src/adapterManager.js +8 -0
- package/src/adapters/bidderFactory.js +34 -4
- package/src/debugging.js +14 -6
- package/src/refererDetection.js +1 -12
- package/src/utils.js +10 -2
- package/test/spec/modules/adrinoBidAdapter_spec.js +10 -0
- package/test/spec/modules/bidwatchAnalyticsAdapter_spec.js +2 -0
- package/test/spec/modules/discoveryBidAdapter_spec.js +92 -0
- package/test/spec/modules/enrichmentFpdModule_spec.js +1 -2
- package/test/spec/modules/fledge_spec.js +37 -0
- package/test/spec/modules/fpdModule_spec.js +1 -2
- package/test/spec/modules/invibesBidAdapter_spec.js +31 -2
- package/test/spec/modules/openxOrtbBidAdapter_spec.js +132 -18
- package/test/spec/modules/outbrainBidAdapter_spec.js +21 -0
- package/test/spec/modules/spotxBidAdapter_spec.js +30 -8
- package/test/spec/modules/taboolaBidAdapter_spec.js +77 -0
- package/test/spec/modules/xeBidAdapter_spec.js +450 -0
- package/test/spec/modules/yieldlabBidAdapter_spec.js +37 -0
- package/test/spec/modules/yieldmoBidAdapter_spec.js +43 -3
- package/test/spec/unit/core/adapterManager_spec.js +58 -0
- package/test/spec/unit/core/bidderFactory_spec.js +64 -0
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
import { expect } from 'chai';
|
|
2
|
+
import { config } from 'src/config.js';
|
|
3
|
+
import { spec, getBidFloor } from 'modules/xeBidAdapter.js';
|
|
4
|
+
import { deepClone } from 'src/utils';
|
|
5
|
+
import { createEidsArray } from 'modules/userId/eids.js';
|
|
6
|
+
|
|
7
|
+
const ENDPOINT = 'https://pbjs.xe.works/bid';
|
|
8
|
+
|
|
9
|
+
const defaultRequest = {
|
|
10
|
+
adUnitCode: 'test',
|
|
11
|
+
bidId: '1',
|
|
12
|
+
requestId: 'qwerty',
|
|
13
|
+
auctionId: 'auctionId',
|
|
14
|
+
transactionId: 'tr1',
|
|
15
|
+
mediaTypes: {
|
|
16
|
+
banner: {
|
|
17
|
+
sizes: [
|
|
18
|
+
[300, 250],
|
|
19
|
+
[300, 200]
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
bidder: 'xe',
|
|
24
|
+
params: {
|
|
25
|
+
env: 'xe',
|
|
26
|
+
placement: 'test-banner',
|
|
27
|
+
ext: {}
|
|
28
|
+
},
|
|
29
|
+
bidRequestsCount: 1
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const defaultRequestVideo = deepClone(defaultRequest);
|
|
33
|
+
defaultRequestVideo.mediaTypes = {
|
|
34
|
+
video: {
|
|
35
|
+
playerSize: [640, 480],
|
|
36
|
+
context: 'instream',
|
|
37
|
+
skipppable: true
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
describe('isBidRequestValid', function () {
|
|
42
|
+
it('should return false when request params is missing', function () {
|
|
43
|
+
const invalidRequest = deepClone(defaultRequest);
|
|
44
|
+
delete invalidRequest.params;
|
|
45
|
+
expect(spec.isBidRequestValid(invalidRequest)).to.equal(false);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('should return false when required env param is missing', function () {
|
|
49
|
+
const invalidRequest = deepClone(defaultRequest);
|
|
50
|
+
delete invalidRequest.params.env;
|
|
51
|
+
expect(spec.isBidRequestValid(invalidRequest)).to.equal(false);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('should return false when required placement param is missing', function () {
|
|
55
|
+
const invalidRequest = deepClone(defaultRequest);
|
|
56
|
+
delete invalidRequest.params.placement;
|
|
57
|
+
expect(spec.isBidRequestValid(invalidRequest)).to.equal(false);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('should return false when video.playerSize is missing', function () {
|
|
61
|
+
const invalidRequest = deepClone(defaultRequestVideo);
|
|
62
|
+
delete invalidRequest.mediaTypes.video.playerSize;
|
|
63
|
+
expect(spec.isBidRequestValid(invalidRequest)).to.equal(false);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('should return true when required params found', function () {
|
|
67
|
+
expect(spec.isBidRequestValid(defaultRequest)).to.equal(true);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
describe('buildRequests', function () {
|
|
72
|
+
beforeEach(function () {
|
|
73
|
+
config.resetConfig();
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('should send request with correct structure', function () {
|
|
77
|
+
const request = spec.buildRequests([defaultRequest], {});
|
|
78
|
+
expect(request.method).to.equal('POST');
|
|
79
|
+
expect(request.url).to.equal(ENDPOINT);
|
|
80
|
+
expect(request.options).to.have.property('contentType').and.to.equal('application/json');
|
|
81
|
+
expect(request).to.have.property('data');
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it('should build basic request structure', function () {
|
|
85
|
+
const request = JSON.parse(spec.buildRequests([defaultRequest], {}).data)[0];
|
|
86
|
+
expect(request).to.have.property('bidId').and.to.equal(defaultRequest.bidId);
|
|
87
|
+
expect(request).to.have.property('auctionId').and.to.equal(defaultRequest.auctionId);
|
|
88
|
+
expect(request).to.have.property('transactionId').and.to.equal(defaultRequest.transactionId);
|
|
89
|
+
expect(request).to.have.property('tz').and.to.equal(new Date().getTimezoneOffset());
|
|
90
|
+
expect(request).to.have.property('bc').and.to.equal(1);
|
|
91
|
+
expect(request).to.have.property('floor').and.to.equal(null);
|
|
92
|
+
expect(request).to.have.property('banner').and.to.deep.equal({ sizes: [[300, 250], [300, 200]] });
|
|
93
|
+
expect(request).to.have.property('gdprApplies').and.to.equal(0);
|
|
94
|
+
expect(request).to.have.property('consentString').and.to.equal('');
|
|
95
|
+
expect(request).to.have.property('userEids').and.to.deep.equal([]);
|
|
96
|
+
expect(request).to.have.property('usPrivacy').and.to.equal('');
|
|
97
|
+
expect(request).to.have.property('coppa').and.to.equal(0);
|
|
98
|
+
expect(request).to.have.property('sizes').and.to.deep.equal(['300x250', '300x200']);
|
|
99
|
+
expect(request).to.have.property('ext').and.to.deep.equal({});
|
|
100
|
+
expect(request).to.have.property('env').and.to.deep.equal({
|
|
101
|
+
env: 'xe',
|
|
102
|
+
placement: 'test-banner'
|
|
103
|
+
});
|
|
104
|
+
expect(request).to.have.property('device').and.to.deep.equal({
|
|
105
|
+
ua: navigator.userAgent,
|
|
106
|
+
lang: navigator.language
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it('should build request with schain', function () {
|
|
111
|
+
const schainRequest = deepClone(defaultRequest);
|
|
112
|
+
schainRequest.schain = {
|
|
113
|
+
validation: 'strict',
|
|
114
|
+
config: {
|
|
115
|
+
ver: '1.0'
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
const request = JSON.parse(spec.buildRequests([schainRequest], {}).data)[0];
|
|
119
|
+
expect(request).to.have.property('schain').and.to.deep.equal({
|
|
120
|
+
validation: 'strict',
|
|
121
|
+
config: {
|
|
122
|
+
ver: '1.0'
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it('should build request with location', function () {
|
|
128
|
+
const bidderRequest = {
|
|
129
|
+
refererInfo: {
|
|
130
|
+
page: 'page',
|
|
131
|
+
location: 'location',
|
|
132
|
+
domain: 'domain',
|
|
133
|
+
ref: 'ref',
|
|
134
|
+
isAmp: false
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
const request = JSON.parse(spec.buildRequests([defaultRequest], bidderRequest).data)[0];
|
|
138
|
+
expect(request).to.have.property('location');
|
|
139
|
+
const location = request.location;
|
|
140
|
+
expect(location).to.have.property('page').and.to.equal('page');
|
|
141
|
+
expect(location).to.have.property('location').and.to.equal('location');
|
|
142
|
+
expect(location).to.have.property('domain').and.to.equal('domain');
|
|
143
|
+
expect(location).to.have.property('ref').and.to.equal('ref');
|
|
144
|
+
expect(location).to.have.property('isAmp').and.to.equal(false);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
it('should build request with ortb2 info', function () {
|
|
148
|
+
const ortb2Request = deepClone(defaultRequest);
|
|
149
|
+
ortb2Request.ortb2 = {
|
|
150
|
+
site: {
|
|
151
|
+
name: 'name'
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
const request = JSON.parse(spec.buildRequests([ortb2Request], {}).data)[0];
|
|
155
|
+
expect(request).to.have.property('ortb2').and.to.deep.equal({
|
|
156
|
+
site: {
|
|
157
|
+
name: 'name'
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
it('should build request with ortb2Imp info', function () {
|
|
163
|
+
const ortb2ImpRequest = deepClone(defaultRequest);
|
|
164
|
+
ortb2ImpRequest.ortb2Imp = {
|
|
165
|
+
ext: {
|
|
166
|
+
data: {
|
|
167
|
+
pbadslot: 'home1',
|
|
168
|
+
adUnitSpecificAttribute: '1'
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
const request = JSON.parse(spec.buildRequests([ortb2ImpRequest], {}).data)[0];
|
|
173
|
+
expect(request).to.have.property('ortb2Imp').and.to.deep.equal({
|
|
174
|
+
ext: {
|
|
175
|
+
data: {
|
|
176
|
+
pbadslot: 'home1',
|
|
177
|
+
adUnitSpecificAttribute: '1'
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it('should build request with valid bidfloor', function () {
|
|
184
|
+
const bfRequest = deepClone(defaultRequest);
|
|
185
|
+
bfRequest.getFloor = () => ({ floor: 5, currency: 'USD' });
|
|
186
|
+
const request = JSON.parse(spec.buildRequests([bfRequest], {}).data)[0];
|
|
187
|
+
expect(request).to.have.property('floor').and.to.equal(5);
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
it('should build request with gdpr consent data if applies', function () {
|
|
191
|
+
const bidderRequest = {
|
|
192
|
+
gdprConsent: {
|
|
193
|
+
gdprApplies: true,
|
|
194
|
+
consentString: 'qwerty'
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
const request = JSON.parse(spec.buildRequests([defaultRequest], bidderRequest).data)[0];
|
|
198
|
+
expect(request).to.have.property('gdprApplies').and.equals(1);
|
|
199
|
+
expect(request).to.have.property('consentString').and.equals('qwerty');
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
it('should build request with usp consent data if applies', function () {
|
|
203
|
+
const bidderRequest = {
|
|
204
|
+
uspConsent: '1YA-'
|
|
205
|
+
};
|
|
206
|
+
const request = JSON.parse(spec.buildRequests([defaultRequest], bidderRequest).data)[0];
|
|
207
|
+
expect(request).to.have.property('usPrivacy').and.equals('1YA-');
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
it('should build request with coppa 1', function () {
|
|
211
|
+
config.setConfig({
|
|
212
|
+
coppa: true
|
|
213
|
+
});
|
|
214
|
+
const request = JSON.parse(spec.buildRequests([defaultRequest], {}).data)[0];
|
|
215
|
+
expect(request).to.have.property('coppa').and.equals(1);
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
it('should build request with extended ids', function () {
|
|
219
|
+
const idRequest = deepClone(defaultRequest);
|
|
220
|
+
idRequest.userIdAsEids = createEidsArray({
|
|
221
|
+
tdid: 'TTD_ID_FROM_USER_ID_MODULE',
|
|
222
|
+
pubcid: 'pubCommonId_FROM_USER_ID_MODULE'
|
|
223
|
+
});
|
|
224
|
+
const request = JSON.parse(spec.buildRequests([idRequest], {}).data)[0];
|
|
225
|
+
expect(request).to.have.property('userEids').and.deep.equal([
|
|
226
|
+
{ source: 'adserver.org', uids: [ { id: 'TTD_ID_FROM_USER_ID_MODULE', atype: 1, ext: { rtiPartner: 'TDID' } } ] },
|
|
227
|
+
{ source: 'pubcid.org', uids: [ { id: 'pubCommonId_FROM_USER_ID_MODULE', atype: 1 } ] }
|
|
228
|
+
]);
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
it('should build request with video', function () {
|
|
232
|
+
const request = JSON.parse(spec.buildRequests([defaultRequestVideo], {}).data)[0];
|
|
233
|
+
expect(request).to.have.property('video').and.to.deep.equal({
|
|
234
|
+
playerSize: [640, 480],
|
|
235
|
+
context: 'instream',
|
|
236
|
+
skipppable: true
|
|
237
|
+
});
|
|
238
|
+
expect(request).to.have.property('sizes').and.to.deep.equal(['640x480']);
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
describe('interpretResponse', function () {
|
|
243
|
+
it('should return empty bids', function () {
|
|
244
|
+
const serverResponse = {
|
|
245
|
+
body: {
|
|
246
|
+
data: null
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
const invalidResponse = spec.interpretResponse(serverResponse, {});
|
|
251
|
+
expect(invalidResponse).to.be.an('array').that.is.empty;
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
it('should interpret valid response', function () {
|
|
255
|
+
const serverResponse = {
|
|
256
|
+
body: {
|
|
257
|
+
data: [{
|
|
258
|
+
requestId: 'qwerty',
|
|
259
|
+
cpm: 1,
|
|
260
|
+
currency: 'USD',
|
|
261
|
+
width: 300,
|
|
262
|
+
height: 250,
|
|
263
|
+
ttl: 600,
|
|
264
|
+
meta: {
|
|
265
|
+
advertiserDomains: ['xe.works']
|
|
266
|
+
},
|
|
267
|
+
ext: {
|
|
268
|
+
pixels: [
|
|
269
|
+
[ 'iframe', 'surl1' ],
|
|
270
|
+
[ 'image', 'surl2' ],
|
|
271
|
+
]
|
|
272
|
+
}
|
|
273
|
+
}]
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
const validResponse = spec.interpretResponse(serverResponse, { bidderRequest: defaultRequest });
|
|
278
|
+
const bid = validResponse[0];
|
|
279
|
+
expect(validResponse).to.be.an('array').that.is.not.empty;
|
|
280
|
+
expect(bid.requestId).to.equal('qwerty');
|
|
281
|
+
expect(bid.cpm).to.equal(1);
|
|
282
|
+
expect(bid.currency).to.equal('USD');
|
|
283
|
+
expect(bid.width).to.equal(300);
|
|
284
|
+
expect(bid.height).to.equal(250);
|
|
285
|
+
expect(bid.ttl).to.equal(600);
|
|
286
|
+
expect(bid.meta).to.deep.equal({ advertiserDomains: ['xe.works'] });
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
it('should interpret valid banner response', function () {
|
|
290
|
+
const serverResponse = {
|
|
291
|
+
body: {
|
|
292
|
+
data: [{
|
|
293
|
+
requestId: 'qwerty',
|
|
294
|
+
cpm: 1,
|
|
295
|
+
currency: 'USD',
|
|
296
|
+
width: 300,
|
|
297
|
+
height: 250,
|
|
298
|
+
ttl: 600,
|
|
299
|
+
mediaType: 'banner',
|
|
300
|
+
creativeId: 'xe-demo-banner',
|
|
301
|
+
ad: 'ad',
|
|
302
|
+
meta: {}
|
|
303
|
+
}]
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
const validResponseBanner = spec.interpretResponse(serverResponse, { bidderRequest: defaultRequest });
|
|
308
|
+
const bid = validResponseBanner[0];
|
|
309
|
+
expect(validResponseBanner).to.be.an('array').that.is.not.empty;
|
|
310
|
+
expect(bid.mediaType).to.equal('banner');
|
|
311
|
+
expect(bid.creativeId).to.equal('xe-demo-banner');
|
|
312
|
+
expect(bid.ad).to.equal('ad');
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
it('should interpret valid video response', function () {
|
|
316
|
+
const serverResponse = {
|
|
317
|
+
body: {
|
|
318
|
+
data: [{
|
|
319
|
+
requestId: 'qwerty',
|
|
320
|
+
cpm: 1,
|
|
321
|
+
currency: 'USD',
|
|
322
|
+
width: 600,
|
|
323
|
+
height: 480,
|
|
324
|
+
ttl: 600,
|
|
325
|
+
mediaType: 'video',
|
|
326
|
+
creativeId: 'xe-demo-video',
|
|
327
|
+
ad: 'vast-xml',
|
|
328
|
+
meta: {}
|
|
329
|
+
}]
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
const validResponseBanner = spec.interpretResponse(serverResponse, { bidderRequest: defaultRequestVideo });
|
|
334
|
+
const bid = validResponseBanner[0];
|
|
335
|
+
expect(validResponseBanner).to.be.an('array').that.is.not.empty;
|
|
336
|
+
expect(bid.mediaType).to.equal('video');
|
|
337
|
+
expect(bid.creativeId).to.equal('xe-demo-video');
|
|
338
|
+
expect(bid.ad).to.equal('vast-xml');
|
|
339
|
+
});
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
describe('getUserSyncs', function () {
|
|
343
|
+
it('shoukd handle no params', function () {
|
|
344
|
+
const opts = spec.getUserSyncs({}, []);
|
|
345
|
+
expect(opts).to.be.an('array').that.is.empty;
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
it('should return empty if sync is not allowed', function () {
|
|
349
|
+
const opts = spec.getUserSyncs({iframeEnabled: false, pixelEnabled: false});
|
|
350
|
+
expect(opts).to.be.an('array').that.is.empty;
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
it('should allow iframe sync', function () {
|
|
354
|
+
const opts = spec.getUserSyncs({iframeEnabled: true, pixelEnabled: false}, [{
|
|
355
|
+
body: {
|
|
356
|
+
data: [{
|
|
357
|
+
requestId: 'qwerty',
|
|
358
|
+
ext: {
|
|
359
|
+
pixels: [
|
|
360
|
+
[ 'iframe', 'surl1?a=b' ],
|
|
361
|
+
[ 'image', 'surl2?a=b' ],
|
|
362
|
+
]
|
|
363
|
+
}
|
|
364
|
+
}]
|
|
365
|
+
}
|
|
366
|
+
}]);
|
|
367
|
+
expect(opts.length).to.equal(1);
|
|
368
|
+
expect(opts[0].type).to.equal('iframe');
|
|
369
|
+
expect(opts[0].url).to.equal('surl1?a=b&us_privacy=&gdpr=0&gdpr_consent=');
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
it('should allow pixel sync', function () {
|
|
373
|
+
const opts = spec.getUserSyncs({iframeEnabled: false, pixelEnabled: true}, [{
|
|
374
|
+
body: {
|
|
375
|
+
data: [{
|
|
376
|
+
requestId: 'qwerty',
|
|
377
|
+
ext: {
|
|
378
|
+
pixels: [
|
|
379
|
+
[ 'iframe', 'surl1?a=b' ],
|
|
380
|
+
[ 'image', 'surl2?a=b' ],
|
|
381
|
+
]
|
|
382
|
+
}
|
|
383
|
+
}]
|
|
384
|
+
}
|
|
385
|
+
}]);
|
|
386
|
+
expect(opts.length).to.equal(1);
|
|
387
|
+
expect(opts[0].type).to.equal('image');
|
|
388
|
+
expect(opts[0].url).to.equal('surl2?a=b&us_privacy=&gdpr=0&gdpr_consent=');
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
it('should allow pixel sync and parse consent params', function () {
|
|
392
|
+
const opts = spec.getUserSyncs({iframeEnabled: false, pixelEnabled: true}, [{
|
|
393
|
+
body: {
|
|
394
|
+
data: [{
|
|
395
|
+
requestId: 'qwerty',
|
|
396
|
+
ext: {
|
|
397
|
+
pixels: [
|
|
398
|
+
[ 'iframe', 'surl1?a=b' ],
|
|
399
|
+
[ 'image', 'surl2?a=b' ],
|
|
400
|
+
]
|
|
401
|
+
}
|
|
402
|
+
}]
|
|
403
|
+
}
|
|
404
|
+
}], {
|
|
405
|
+
gdprApplies: 1,
|
|
406
|
+
consentString: '1YA-'
|
|
407
|
+
});
|
|
408
|
+
expect(opts.length).to.equal(1);
|
|
409
|
+
expect(opts[0].type).to.equal('image');
|
|
410
|
+
expect(opts[0].url).to.equal('surl2?a=b&us_privacy=&gdpr=1&gdpr_consent=1YA-');
|
|
411
|
+
});
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
describe('getBidFloor', function () {
|
|
415
|
+
it('should return null when getFloor is not a function', () => {
|
|
416
|
+
const bid = { getFloor: 2 };
|
|
417
|
+
const result = getBidFloor(bid);
|
|
418
|
+
expect(result).to.be.null;
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
it('should return null when getFloor doesnt return an object', () => {
|
|
422
|
+
const bid = { getFloor: () => 2 };
|
|
423
|
+
const result = getBidFloor(bid);
|
|
424
|
+
expect(result).to.be.null;
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
it('should return null when floor is not a number', () => {
|
|
428
|
+
const bid = {
|
|
429
|
+
getFloor: () => ({ floor: 'string', currency: 'USD' })
|
|
430
|
+
};
|
|
431
|
+
const result = getBidFloor(bid);
|
|
432
|
+
expect(result).to.be.null;
|
|
433
|
+
});
|
|
434
|
+
|
|
435
|
+
it('should return null when currency is not USD', () => {
|
|
436
|
+
const bid = {
|
|
437
|
+
getFloor: () => ({ floor: 5, currency: 'EUR' })
|
|
438
|
+
};
|
|
439
|
+
const result = getBidFloor(bid);
|
|
440
|
+
expect(result).to.be.null;
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
it('should return floor value when everything is correct', () => {
|
|
444
|
+
const bid = {
|
|
445
|
+
getFloor: () => ({ floor: 5, currency: 'USD' })
|
|
446
|
+
};
|
|
447
|
+
const result = getBidFloor(bid);
|
|
448
|
+
expect(result).to.equal(5);
|
|
449
|
+
});
|
|
450
|
+
});
|
|
@@ -531,4 +531,41 @@ describe('yieldlabBidAdapter', () => {
|
|
|
531
531
|
expect(sync[0].type).to.have.string('iframe');
|
|
532
532
|
});
|
|
533
533
|
});
|
|
534
|
+
|
|
535
|
+
describe('getBidFloor', function () {
|
|
536
|
+
let bidRequest, getFloor;
|
|
537
|
+
|
|
538
|
+
it('should add valid bid floor', () => {
|
|
539
|
+
getFloor = () => {
|
|
540
|
+
return {
|
|
541
|
+
currency: 'EUR',
|
|
542
|
+
floor: 1.33
|
|
543
|
+
};
|
|
544
|
+
};
|
|
545
|
+
bidRequest = Object.assign(DEFAULT_REQUEST(), {getFloor})
|
|
546
|
+
const result = spec.buildRequests([bidRequest], REQPARAMS)
|
|
547
|
+
expect(result).to.have.nested.property('queryParams.floor', 1.33)
|
|
548
|
+
});
|
|
549
|
+
|
|
550
|
+
it('should not add empty bid floor', () => {
|
|
551
|
+
getFloor = () => {
|
|
552
|
+
return {};
|
|
553
|
+
};
|
|
554
|
+
bidRequest = Object.assign(DEFAULT_REQUEST(), {getFloor})
|
|
555
|
+
const result = spec.buildRequests([bidRequest], REQPARAMS)
|
|
556
|
+
expect(result).not.to.have.nested.property('queryParams.floor')
|
|
557
|
+
});
|
|
558
|
+
|
|
559
|
+
it('should not add bid floor when currency is not matching', () => {
|
|
560
|
+
getFloor = (currency, mediaType, size) => {
|
|
561
|
+
return {
|
|
562
|
+
currency: 'USD',
|
|
563
|
+
floor: 1.33
|
|
564
|
+
};
|
|
565
|
+
};
|
|
566
|
+
bidRequest = Object.assign(DEFAULT_REQUEST(), {getFloor})
|
|
567
|
+
const result = spec.buildRequests([bidRequest], REQPARAMS)
|
|
568
|
+
expect(result).not.to.have.nested.property('queryParams.floor')
|
|
569
|
+
});
|
|
570
|
+
});
|
|
534
571
|
})
|
|
@@ -2,6 +2,9 @@ import { expect } from 'chai';
|
|
|
2
2
|
import { spec } from 'modules/yieldmoBidAdapter.js';
|
|
3
3
|
import * as utils from 'src/utils.js';
|
|
4
4
|
|
|
5
|
+
/* eslint no-console: ["error", { allow: ["log", "warn", "error"] }] */
|
|
6
|
+
// above is used for debugging purposes only
|
|
7
|
+
|
|
5
8
|
describe('YieldmoAdapter', function () {
|
|
6
9
|
const BANNER_ENDPOINT = 'https://ads.yieldmo.com/exchange/prebid';
|
|
7
10
|
const VIDEO_ENDPOINT = 'https://ads.yieldmo.com/exchange/prebidvideo';
|
|
@@ -38,6 +41,7 @@ describe('YieldmoAdapter', function () {
|
|
|
38
41
|
bidder: 'yieldmo',
|
|
39
42
|
adUnitCode: 'adunit-code-video',
|
|
40
43
|
bidId: '321video123',
|
|
44
|
+
auctionId: '1d1a03073455',
|
|
41
45
|
mediaTypes: {
|
|
42
46
|
video: {
|
|
43
47
|
playerSize: [640, 480],
|
|
@@ -172,15 +176,15 @@ describe('YieldmoAdapter', function () {
|
|
|
172
176
|
it('should place bid information into the p parameter of data', function () {
|
|
173
177
|
let bidArray = [mockBannerBid()];
|
|
174
178
|
expect(buildAndGetPlacementInfo(bidArray)).to.equal(
|
|
175
|
-
'[{"placement_id":"adunit-code","callback_id":"30b31c1838de1e","sizes":[[300,250],[300,600]],"bidFloor":0.1}]'
|
|
179
|
+
'[{"placement_id":"adunit-code","callback_id":"30b31c1838de1e","sizes":[[300,250],[300,600]],"bidFloor":0.1,"auctionId":"1d1a030790a475"}]'
|
|
176
180
|
);
|
|
177
181
|
|
|
178
182
|
// multiple placements
|
|
179
183
|
bidArray.push(mockBannerBid(
|
|
180
184
|
{adUnitCode: 'adunit-2', bidId: '123a', bidderRequestId: '321', auctionId: '222'}, {bidFloor: 0.2}));
|
|
181
185
|
expect(buildAndGetPlacementInfo(bidArray)).to.equal(
|
|
182
|
-
'[{"placement_id":"adunit-code","callback_id":"30b31c1838de1e","sizes":[[300,250],[300,600]],"bidFloor":0.1},' +
|
|
183
|
-
'{"placement_id":"adunit-2","callback_id":"123a","sizes":[[300,250],[300,600]],"bidFloor":0.2}]'
|
|
186
|
+
'[{"placement_id":"adunit-code","callback_id":"30b31c1838de1e","sizes":[[300,250],[300,600]],"bidFloor":0.1,"auctionId":"1d1a030790a475"},' +
|
|
187
|
+
'{"placement_id":"adunit-2","callback_id":"123a","sizes":[[300,250],[300,600]],"bidFloor":0.2,"auctionId":"222"}]'
|
|
184
188
|
);
|
|
185
189
|
});
|
|
186
190
|
|
|
@@ -218,6 +222,24 @@ describe('YieldmoAdapter', function () {
|
|
|
218
222
|
expect(buildAndGetData([pubcidBid]).pubcid).to.deep.equal(pubcid);
|
|
219
223
|
});
|
|
220
224
|
|
|
225
|
+
it('should add transaction id as parameter of request', function () {
|
|
226
|
+
const transactionId = '54a58774-7a41-494e-9aaf-fa7b79164f0c';
|
|
227
|
+
const pubcidBid = mockBannerBid({ ortb2Imp: {
|
|
228
|
+
ext: {
|
|
229
|
+
tid: '54a58774-7a41-494e-9aaf-fa7b79164f0c',
|
|
230
|
+
}
|
|
231
|
+
}});
|
|
232
|
+
const bidRequest = buildAndGetData([pubcidBid]);
|
|
233
|
+
expect(bidRequest.p).to.contain(transactionId);
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
it('should add auction id as parameter of request', function () {
|
|
237
|
+
const auctionId = '1d1a030790a475';
|
|
238
|
+
const pubcidBid = mockBannerBid({});
|
|
239
|
+
const bidRequest = buildAndGetData([pubcidBid]);
|
|
240
|
+
expect(bidRequest.p).to.contain(auctionId);
|
|
241
|
+
});
|
|
242
|
+
|
|
221
243
|
it('should add unified id as parameter of request', function () {
|
|
222
244
|
const unifiedIdBid = mockBannerBid({crumbs: undefined});
|
|
223
245
|
expect(buildAndGetData([unifiedIdBid]).tdid).to.deep.equal(mockBannerBid().userId.tdid);
|
|
@@ -471,6 +493,24 @@ describe('YieldmoAdapter', function () {
|
|
|
471
493
|
expect(requests[0].data.ats_envelope).to.equal(envelope);
|
|
472
494
|
});
|
|
473
495
|
|
|
496
|
+
it('should add transaction id to video bid request', function() {
|
|
497
|
+
const transactionId = '54a58774-7a41-494e-8cbc-fa7b79164f0c';
|
|
498
|
+
const requestData = {
|
|
499
|
+
ortb2Imp: {
|
|
500
|
+
ext: {
|
|
501
|
+
tid: '54a58774-7a41-494e-8cbc-fa7b79164f0c',
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
};
|
|
505
|
+
expect(buildAndGetData([mockVideoBid({...requestData})]).imp[0].ext.tid).to.equal(transactionId);
|
|
506
|
+
});
|
|
507
|
+
|
|
508
|
+
it('should add auction id to video bid request', function() {
|
|
509
|
+
const auctionId = '1d1a03073455';
|
|
510
|
+
|
|
511
|
+
expect(buildAndGetData([mockVideoBid({})]).auctionId).to.deep.equal(auctionId);
|
|
512
|
+
});
|
|
513
|
+
|
|
474
514
|
it('should add schain if it is in the bidRequest', () => {
|
|
475
515
|
const schain = {
|
|
476
516
|
ver: '1.0',
|
|
@@ -1815,6 +1815,64 @@ describe('adapterManager tests', function () {
|
|
|
1815
1815
|
});
|
|
1816
1816
|
});
|
|
1817
1817
|
|
|
1818
|
+
describe('fledgeEnabled', function () {
|
|
1819
|
+
const origRunAdAuction = navigator?.runAdAuction;
|
|
1820
|
+
before(function () {
|
|
1821
|
+
// navigator.runAdAuction doesn't exist, so we can't stub it normally with
|
|
1822
|
+
// sinon.stub(navigator, 'runAdAuction') or something
|
|
1823
|
+
navigator.runAdAuction = sinon.stub();
|
|
1824
|
+
});
|
|
1825
|
+
|
|
1826
|
+
after(function() {
|
|
1827
|
+
navigator.runAdAuction = origRunAdAuction;
|
|
1828
|
+
})
|
|
1829
|
+
|
|
1830
|
+
afterEach(function () {
|
|
1831
|
+
config.resetConfig();
|
|
1832
|
+
});
|
|
1833
|
+
|
|
1834
|
+
it('should set fledgeEnabled correctly per bidder', function () {
|
|
1835
|
+
config.setConfig({bidderSequence: 'fixed'})
|
|
1836
|
+
config.setBidderConfig({
|
|
1837
|
+
bidders: ['appnexus'],
|
|
1838
|
+
config: {
|
|
1839
|
+
fledgeEnabled: true,
|
|
1840
|
+
}
|
|
1841
|
+
});
|
|
1842
|
+
|
|
1843
|
+
const adUnits = [{
|
|
1844
|
+
'code': '/19968336/header-bid-tag1',
|
|
1845
|
+
'mediaTypes': {
|
|
1846
|
+
'banner': {
|
|
1847
|
+
'sizes': [[728, 90]]
|
|
1848
|
+
},
|
|
1849
|
+
},
|
|
1850
|
+
'bids': [
|
|
1851
|
+
{
|
|
1852
|
+
'bidder': 'appnexus',
|
|
1853
|
+
},
|
|
1854
|
+
{
|
|
1855
|
+
'bidder': 'rubicon',
|
|
1856
|
+
},
|
|
1857
|
+
]
|
|
1858
|
+
}];
|
|
1859
|
+
|
|
1860
|
+
const bidRequests = adapterManager.makeBidRequests(
|
|
1861
|
+
adUnits,
|
|
1862
|
+
Date.now(),
|
|
1863
|
+
utils.getUniqueIdentifierStr(),
|
|
1864
|
+
function callback() {},
|
|
1865
|
+
[]
|
|
1866
|
+
);
|
|
1867
|
+
|
|
1868
|
+
expect(bidRequests[0].bids[0].bidder).equals('appnexus');
|
|
1869
|
+
expect(bidRequests[0].fledgeEnabled).to.be.true;
|
|
1870
|
+
|
|
1871
|
+
expect(bidRequests[1].bids[0].bidder).equals('rubicon');
|
|
1872
|
+
expect(bidRequests[1].fledgeEnabled).to.be.undefined;
|
|
1873
|
+
});
|
|
1874
|
+
});
|
|
1875
|
+
|
|
1818
1876
|
describe('sizeMapping', function () {
|
|
1819
1877
|
let sandbox;
|
|
1820
1878
|
beforeEach(function () {
|