prebid.js 5.18.0 → 6.1.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/.babelrc.js +1 -10
- package/README.md +3 -1
- package/browsers.json +1 -8
- package/gulpfile.js +1 -0
- package/integrationExamples/gpt/akamaidap_segments_example.html +132 -0
- package/modules/.submodules.json +1 -0
- package/modules/adfBidAdapter.js +21 -16
- package/modules/adheseBidAdapter.js +7 -2
- package/modules/adkernelBidAdapter.js +1 -0
- package/modules/adlivetechBidAdapter.md +61 -0
- package/modules/adomikAnalyticsAdapter.js +10 -4
- package/modules/adtelligentBidAdapter.js +2 -1
- package/modules/airgridRtdProvider.js +1 -1
- package/modules/akamaiDapRtdProvider.js +474 -0
- package/modules/akamaiDapRtdProvider.md +47 -0
- package/modules/appnexusBidAdapter.js +9 -3
- package/modules/atsAnalyticsAdapter.js +67 -46
- package/modules/atsAnalyticsAdapter.md +1 -0
- package/modules/betweenBidAdapter.js +20 -3
- package/modules/browsiRtdProvider.js +106 -18
- package/modules/cleanioRtdProvider.js +192 -0
- package/modules/cleanioRtdProvider.md +59 -0
- package/modules/codefuelBidAdapter.js +181 -0
- package/modules/codefuelBidAdapter.md +111 -0
- package/modules/connectIdSystem.js +104 -0
- package/modules/connectIdSystem.md +33 -0
- package/modules/datablocksBidAdapter.js +3 -3
- package/modules/deepintentBidAdapter.js +107 -10
- package/modules/deepintentBidAdapter.md +36 -1
- package/modules/deltaprojectsBidAdapter.js +252 -0
- package/modules/deltaprojectsBidAdapter.md +32 -0
- package/modules/engageyaBidAdapter.js +171 -0
- package/modules/glimpseBidAdapter.js +31 -16
- package/modules/gptPreAuction.js +11 -5
- package/modules/gridBidAdapter.js +1 -0
- package/modules/gumgumBidAdapter.js +8 -0
- package/modules/id5IdSystem.md +6 -6
- package/modules/imRtdProvider.js +31 -0
- package/modules/inskinBidAdapter.js +7 -3
- package/modules/ixBidAdapter.js +174 -22
- package/modules/jixieBidAdapter.js +8 -2
- package/modules/justpremiumBidAdapter.js +6 -1
- package/modules/limelightDigitalBidAdapter.js +22 -2
- package/modules/livewrappedAnalyticsAdapter.js +49 -1
- package/modules/merkleIdSystem.js +5 -0
- package/modules/multibid/index.js +3 -3
- package/modules/nativoBidAdapter.js +32 -2
- package/modules/nextMillenniumBidAdapter.js +12 -3
- package/modules/oguryBidAdapter.js +16 -2
- package/modules/openxBidAdapter.js +40 -23
- package/modules/operaadsBidAdapter.js +21 -1
- package/modules/otmBidAdapter.js +146 -0
- package/modules/otmBidAdapter.md +27 -26
- package/modules/outbrainBidAdapter.js +5 -0
- package/modules/playwireBidAdapter.md +61 -0
- package/modules/prebidServerBidAdapter/index.js +3 -3
- package/modules/publinkIdSystem.js +11 -6
- package/modules/pubmaticBidAdapter.js +2 -0
- package/modules/rtdModule/index.js +2 -2
- package/modules/saambaaBidAdapter.js +420 -0
- package/modules/saambaaBidAdapter.md +65 -68
- package/modules/seedtagBidAdapter.js +6 -0
- package/modules/smaatoBidAdapter.js +6 -1
- package/modules/sonobiBidAdapter.js +7 -0
- package/modules/sortableBidAdapter.js +1 -0
- package/modules/sspBCBidAdapter.js +34 -3
- package/modules/teadsBidAdapter.js +3 -0
- package/modules/tripleliftBidAdapter.js +22 -5
- package/modules/trustxBidAdapter.js +18 -7
- package/modules/undertoneBidAdapter.js +9 -5
- package/modules/undertoneBidAdapter.md +5 -1
- package/modules/userId/eids.js +18 -0
- package/modules/userId/eids.md +7 -0
- package/modules/userId/userId.md +12 -0
- package/modules/ventesBidAdapter.js +370 -0
- package/modules/ventesBidAdapter.md +94 -0
- package/modules/videobyteBidAdapter.js +13 -6
- package/modules/videobyteBidAdapter.md +49 -0
- package/modules/vidoomyBidAdapter.js +51 -100
- package/modules/visxBidAdapter.js +1 -1
- package/modules/yahoosspBidAdapter.js +6 -6
- package/modules/yieldlabBidAdapter.js +41 -10
- package/modules/yieldlabBidAdapter.md +91 -48
- package/modules/yieldmoSyntheticInventoryModule.js +46 -0
- package/modules/yieldmoSyntheticInventoryModule.md +68 -0
- package/package.json +6 -1
- package/src/adapterManager.js +19 -8
- package/src/adapters/bidderFactory.js +4 -3
- package/src/auction.js +11 -11
- package/src/constants.json +1 -0
- package/src/secureCreatives.js +6 -7
- package/src/targeting.js +11 -9
- package/test/spec/modules/adfBidAdapter_spec.js +83 -29
- package/test/spec/modules/adheseBidAdapter_spec.js +27 -1
- package/test/spec/modules/adomikAnalyticsAdapter_spec.js +3 -1
- package/test/spec/modules/adtelligentBidAdapter_spec.js +1 -0
- package/test/spec/modules/akamaiDapRtdProvider_spec.js +246 -0
- package/test/spec/modules/appnexusBidAdapter_spec.js +16 -1
- package/test/spec/modules/atsAnalyticsAdapter_spec.js +42 -9
- package/test/spec/modules/betweenBidAdapter_spec.js +41 -0
- package/test/spec/modules/browsiRtdProvider_spec.js +62 -7
- package/test/spec/modules/cleanioRtdProvider_spec.js +188 -0
- package/test/spec/modules/codefuelBidAdapter_spec.js +316 -0
- package/test/spec/modules/connectIdSystem_spec.js +189 -0
- package/test/spec/modules/datablocksBidAdapter_spec.js +3 -3
- package/test/spec/modules/deepintentBidAdapter_spec.js +153 -3
- package/test/spec/modules/deltaprojectsBidAdapter_spec.js +399 -0
- package/test/spec/modules/engageyaBidAdapter_spec.js +422 -0
- package/test/spec/modules/eplanningBidAdapter_spec.js +8 -8
- package/test/spec/modules/glimpseBidAdapter_spec.js +33 -0
- package/test/spec/modules/gptPreAuction_spec.js +58 -4
- package/test/spec/modules/gumgumBidAdapter_spec.js +5 -1
- package/test/spec/modules/imRtdProvider_spec.js +25 -0
- package/test/spec/modules/ixBidAdapter_spec.js +298 -5
- package/test/spec/modules/jixieBidAdapter_spec.js +13 -11
- package/test/spec/modules/justpremiumBidAdapter_spec.js +9 -2
- package/test/spec/modules/konduitWrapper_spec.js +0 -1
- package/test/spec/modules/limelightDigitalBidAdapter_spec.js +155 -1
- package/test/spec/modules/livewrappedAnalyticsAdapter_spec.js +52 -7
- package/test/spec/modules/merkleIdSystem_spec.js +18 -0
- package/test/spec/modules/multibid_spec.js +31 -31
- package/test/spec/modules/nativoBidAdapter_spec.js +35 -18
- package/test/spec/modules/nextMillenniumBidAdapter_spec.js +13 -1
- package/test/spec/modules/oguryBidAdapter_spec.js +66 -23
- package/test/spec/modules/openxBidAdapter_spec.js +90 -13
- package/test/spec/modules/operaadsBidAdapter_spec.js +38 -6
- package/test/spec/modules/otmBidAdapter_spec.js +67 -0
- package/test/spec/modules/outbrainBidAdapter_spec.js +18 -0
- package/test/spec/modules/prebidServerBidAdapter_spec.js +19 -2
- package/test/spec/modules/publinkIdSystem_spec.js +6 -6
- package/test/spec/modules/seedtagBidAdapter_spec.js +3 -0
- package/test/spec/modules/smaatoBidAdapter_spec.js +30 -0
- package/test/spec/modules/sonobiBidAdapter_spec.js +34 -1
- package/test/spec/modules/sortableBidAdapter_spec.js +11 -0
- package/test/spec/modules/sspBCBidAdapter_spec.js +33 -3
- package/test/spec/modules/teadsBidAdapter_spec.js +132 -0
- package/test/spec/modules/tripleliftBidAdapter_spec.js +128 -0
- package/test/spec/modules/trustxBidAdapter_spec.js +45 -3
- package/test/spec/modules/undertoneBidAdapter_spec.js +52 -0
- package/test/spec/modules/ventesBidAdapter_spec.js +845 -0
- package/test/spec/modules/videobyteBidAdapter_spec.js +2 -2
- package/test/spec/modules/vidoomyBidAdapter_spec.js +32 -13
- package/test/spec/modules/visxBidAdapter_spec.js +1 -1
- package/test/spec/modules/yieldlabBidAdapter_spec.js +81 -0
- package/test/spec/modules/yieldmoSyntheticInventoryModule_spec.js +89 -0
- package/test/spec/unit/core/adapterManager_spec.js +56 -6
- package/test/spec/unit/core/bidderFactory_spec.js +61 -1
- package/test/spec/unit/pbjs_api_spec.js +37 -2
- package/test/spec/unit/secureCreatives_spec.js +54 -25
- package/wdio.conf.js +1 -1
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
import { expect } from 'chai';
|
|
2
|
+
import { spec } from 'modules/engageyaBidAdapter.js';
|
|
3
|
+
import * as utils from 'src/utils.js';
|
|
4
|
+
|
|
5
|
+
const ENDPOINT_URL = 'https://recs.engageya.com/rec-api/getrecs.json';
|
|
6
|
+
|
|
7
|
+
describe('Engageya adapter', function () {
|
|
8
|
+
let bidRequests;
|
|
9
|
+
let nativeBidRequests;
|
|
10
|
+
|
|
11
|
+
beforeEach(function () {
|
|
12
|
+
bidRequests = [
|
|
13
|
+
{
|
|
14
|
+
bidder: 'engageya',
|
|
15
|
+
params: {
|
|
16
|
+
widgetId: 85610,
|
|
17
|
+
websiteId: 91140,
|
|
18
|
+
pageUrl: '[PAGE_URL]'
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
nativeBidRequests = [
|
|
24
|
+
{
|
|
25
|
+
bidder: 'engageya',
|
|
26
|
+
params: {
|
|
27
|
+
widgetId: 85610,
|
|
28
|
+
websiteId: 91140,
|
|
29
|
+
pageUrl: '[PAGE_URL]'
|
|
30
|
+
},
|
|
31
|
+
nativeParams: {
|
|
32
|
+
title: {
|
|
33
|
+
required: true,
|
|
34
|
+
len: 80
|
|
35
|
+
},
|
|
36
|
+
image: {
|
|
37
|
+
required: true,
|
|
38
|
+
sizes: [150, 50]
|
|
39
|
+
},
|
|
40
|
+
sponsoredBy: {
|
|
41
|
+
required: true
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
describe('isBidRequestValid', function () {
|
|
49
|
+
it('Valid bid case', function () {
|
|
50
|
+
let validBid = {
|
|
51
|
+
bidder: 'engageya',
|
|
52
|
+
params: {
|
|
53
|
+
widgetId: 85610,
|
|
54
|
+
websiteId: 91140,
|
|
55
|
+
pageUrl: '[PAGE_URL]'
|
|
56
|
+
},
|
|
57
|
+
sizes: [[300, 250]]
|
|
58
|
+
}
|
|
59
|
+
let isValid = spec.isBidRequestValid(validBid);
|
|
60
|
+
expect(isValid).to.be.true;
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('Invalid bid case: widgetId and websiteId is not passed', function () {
|
|
64
|
+
let validBid = {
|
|
65
|
+
bidder: 'engageya',
|
|
66
|
+
params: {}
|
|
67
|
+
}
|
|
68
|
+
let isValid = spec.isBidRequestValid(validBid);
|
|
69
|
+
expect(isValid).to.be.false;
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
it('Invalid bid case: widget id must be number', function () {
|
|
73
|
+
let invalidBid = {
|
|
74
|
+
bidder: 'engageya',
|
|
75
|
+
params: {
|
|
76
|
+
widgetId: '157746a',
|
|
77
|
+
websiteId: 91140,
|
|
78
|
+
pageUrl: '[PAGE_URL]'
|
|
79
|
+
},
|
|
80
|
+
sizes: [[300, 250]]
|
|
81
|
+
}
|
|
82
|
+
let isValid = spec.isBidRequestValid(invalidBid);
|
|
83
|
+
expect(isValid).to.be.false;
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
it('Invalid bid case: unsupported sizes', function () {
|
|
87
|
+
let invalidBid = {
|
|
88
|
+
bidder: 'engageya',
|
|
89
|
+
params: {
|
|
90
|
+
widgetId: '157746a',
|
|
91
|
+
websiteId: 91140,
|
|
92
|
+
pageUrl: '[PAGE_URL]'
|
|
93
|
+
},
|
|
94
|
+
sizes: [[250, 250]]
|
|
95
|
+
}
|
|
96
|
+
let isValid = spec.isBidRequestValid(invalidBid);
|
|
97
|
+
expect(isValid).to.be.false;
|
|
98
|
+
})
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
describe('buildRequests', function () {
|
|
102
|
+
it('sends bid request to ENDPOINT via GET', function () {
|
|
103
|
+
const request = spec.buildRequests(bidRequests)[0];
|
|
104
|
+
expect(request.url).to.include(ENDPOINT_URL);
|
|
105
|
+
expect(request.method).to.equal('GET');
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it('buildRequests function should not modify original bidRequests object', function () {
|
|
109
|
+
let originalBidRequests = utils.deepClone(bidRequests);
|
|
110
|
+
let request = spec.buildRequests(bidRequests);
|
|
111
|
+
expect(bidRequests).to.deep.equal(originalBidRequests);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it('buildRequests function should not modify original nativeBidRequests object', function () {
|
|
115
|
+
let originalBidRequests = utils.deepClone(nativeBidRequests);
|
|
116
|
+
let request = spec.buildRequests(nativeBidRequests);
|
|
117
|
+
expect(nativeBidRequests).to.deep.equal(originalBidRequests);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
it('Request params check', function () {
|
|
121
|
+
let request = spec.buildRequests(bidRequests)[0];
|
|
122
|
+
const urlParams = new URL(request.url).searchParams;
|
|
123
|
+
expect(parseInt(urlParams.get('wid'))).to.exist.and.to.equal(bidRequests[0].params.widgetId);
|
|
124
|
+
expect(parseInt(urlParams.get('webid'))).to.exist.and.to.equal(bidRequests[0].params.websiteId);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it('Request pageUrl - use param', function () {
|
|
128
|
+
const pageUrl = 'https://url.test';
|
|
129
|
+
bidRequests[0].params.pageUrl = pageUrl;
|
|
130
|
+
const request = spec.buildRequests(bidRequests)[0];
|
|
131
|
+
const urlParams = new URL(request.url).searchParams;
|
|
132
|
+
expect(urlParams.get('url')).to.exist.and.to.equal(pageUrl);
|
|
133
|
+
});
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
describe('interpretResponse', function () {
|
|
137
|
+
let nativeResponse;
|
|
138
|
+
let bannerResponse;
|
|
139
|
+
|
|
140
|
+
beforeEach(() => {
|
|
141
|
+
const recsResponse = {
|
|
142
|
+
recs: [
|
|
143
|
+
{
|
|
144
|
+
ecpm: 9.20,
|
|
145
|
+
pecpm: 0.0520,
|
|
146
|
+
postId: '<!-- CREATIVE ID -->',
|
|
147
|
+
thumbnail_path: 'https://engageya.live/wp-content/uploads/2019/05/images.png',
|
|
148
|
+
domain: 'domain.test',
|
|
149
|
+
title: 'Test title',
|
|
150
|
+
clickUrl: '//click.test',
|
|
151
|
+
url: '//url.test',
|
|
152
|
+
displayName: 'Test displayName',
|
|
153
|
+
trackers: {
|
|
154
|
+
impressionPixels: ['//impression.test'],
|
|
155
|
+
viewPixels: ['//view.test'],
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
],
|
|
159
|
+
imageWidth: 300,
|
|
160
|
+
imageHeight: 250,
|
|
161
|
+
ireqId: '1d236f7890b',
|
|
162
|
+
viewPxl: '//view.pixel',
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
nativeResponse = {
|
|
166
|
+
...recsResponse,
|
|
167
|
+
pbtypeId: 1,
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
bannerResponse = {
|
|
171
|
+
...recsResponse,
|
|
172
|
+
pbtypeId: 2,
|
|
173
|
+
widget: {
|
|
174
|
+
additionalData: '{"css":".eng_tag_ttl{display:block!important}"}'
|
|
175
|
+
},
|
|
176
|
+
}
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
it('should return empty array if no response', function () {
|
|
180
|
+
const result = spec.interpretResponse({}, [])
|
|
181
|
+
expect(result).to.be.an('array').that.is.empty
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
it('should return empty array if no valid bids', function () {
|
|
185
|
+
let response = {
|
|
186
|
+
recs: [],
|
|
187
|
+
imageWidth: 300,
|
|
188
|
+
imageHeight: 250,
|
|
189
|
+
ireqId: '1d236f7890b',
|
|
190
|
+
pbtypeId: 2,
|
|
191
|
+
viewPxl: '//view.pixel',
|
|
192
|
+
};
|
|
193
|
+
let request = spec.buildRequests(bidRequests)[0];
|
|
194
|
+
const result = spec.interpretResponse({ body: response }, request)
|
|
195
|
+
expect(result).to.be.an('array').that.is.empty
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
it('should interpret native response', function () {
|
|
199
|
+
let expectedResult = [
|
|
200
|
+
{
|
|
201
|
+
requestId: '1d236f7890b',
|
|
202
|
+
cpm: 0.0520,
|
|
203
|
+
width: 300,
|
|
204
|
+
height: 250,
|
|
205
|
+
netRevenue: true,
|
|
206
|
+
currency: 'USD',
|
|
207
|
+
creativeId: '<!-- CREATIVE ID -->',
|
|
208
|
+
ttl: 360,
|
|
209
|
+
meta: {
|
|
210
|
+
advertiserDomains: ['domain.test']
|
|
211
|
+
},
|
|
212
|
+
native: {
|
|
213
|
+
title: 'Test title',
|
|
214
|
+
body: '',
|
|
215
|
+
image: {
|
|
216
|
+
url: 'https://engageya.live/wp-content/uploads/2019/05/images.png',
|
|
217
|
+
width: 300,
|
|
218
|
+
height: 250
|
|
219
|
+
},
|
|
220
|
+
privacyLink: '',
|
|
221
|
+
clickUrl: '//click.test',
|
|
222
|
+
displayUrl: '//url.test',
|
|
223
|
+
cta: '',
|
|
224
|
+
sponsoredBy: 'Test displayName',
|
|
225
|
+
impressionTrackers: ['//impression.test', '//view.test', '//view.pixel'],
|
|
226
|
+
},
|
|
227
|
+
}
|
|
228
|
+
];
|
|
229
|
+
let request = spec.buildRequests(bidRequests)[0];
|
|
230
|
+
let result = spec.interpretResponse({ body: nativeResponse }, request);
|
|
231
|
+
expect(result).to.deep.equal(expectedResult);
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
it('should interpret native response - without pecpm', function () {
|
|
235
|
+
delete nativeResponse.recs[0].pecpm;
|
|
236
|
+
let expectedResult = [
|
|
237
|
+
{
|
|
238
|
+
requestId: '1d236f7890b',
|
|
239
|
+
cpm: 0.0920,
|
|
240
|
+
width: 300,
|
|
241
|
+
height: 250,
|
|
242
|
+
netRevenue: false,
|
|
243
|
+
currency: 'USD',
|
|
244
|
+
creativeId: '<!-- CREATIVE ID -->',
|
|
245
|
+
ttl: 360,
|
|
246
|
+
meta: {
|
|
247
|
+
advertiserDomains: ['domain.test']
|
|
248
|
+
},
|
|
249
|
+
native: {
|
|
250
|
+
title: 'Test title',
|
|
251
|
+
body: '',
|
|
252
|
+
image: {
|
|
253
|
+
url: 'https://engageya.live/wp-content/uploads/2019/05/images.png',
|
|
254
|
+
width: 300,
|
|
255
|
+
height: 250
|
|
256
|
+
},
|
|
257
|
+
privacyLink: '',
|
|
258
|
+
clickUrl: '//click.test',
|
|
259
|
+
displayUrl: '//url.test',
|
|
260
|
+
cta: '',
|
|
261
|
+
sponsoredBy: 'Test displayName',
|
|
262
|
+
impressionTrackers: ['//impression.test', '//view.test', '//view.pixel'],
|
|
263
|
+
},
|
|
264
|
+
}
|
|
265
|
+
];
|
|
266
|
+
let request = spec.buildRequests(bidRequests)[0];
|
|
267
|
+
let result = spec.interpretResponse({ body: nativeResponse }, request);
|
|
268
|
+
expect(result).to.deep.equal(expectedResult);
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
it('should interpret native response - without trackers', function () {
|
|
272
|
+
delete nativeResponse.recs[0].trackers;
|
|
273
|
+
let expectedResult = [
|
|
274
|
+
{
|
|
275
|
+
requestId: '1d236f7890b',
|
|
276
|
+
cpm: 0.0520,
|
|
277
|
+
width: 300,
|
|
278
|
+
height: 250,
|
|
279
|
+
netRevenue: true,
|
|
280
|
+
currency: 'USD',
|
|
281
|
+
creativeId: '<!-- CREATIVE ID -->',
|
|
282
|
+
ttl: 360,
|
|
283
|
+
meta: {
|
|
284
|
+
advertiserDomains: ['domain.test']
|
|
285
|
+
},
|
|
286
|
+
native: {
|
|
287
|
+
title: 'Test title',
|
|
288
|
+
body: '',
|
|
289
|
+
image: {
|
|
290
|
+
url: 'https://engageya.live/wp-content/uploads/2019/05/images.png',
|
|
291
|
+
width: 300,
|
|
292
|
+
height: 250
|
|
293
|
+
},
|
|
294
|
+
privacyLink: '',
|
|
295
|
+
clickUrl: '//click.test',
|
|
296
|
+
displayUrl: '//url.test',
|
|
297
|
+
cta: '',
|
|
298
|
+
sponsoredBy: 'Test displayName',
|
|
299
|
+
impressionTrackers: ['//view.pixel'],
|
|
300
|
+
},
|
|
301
|
+
}
|
|
302
|
+
];
|
|
303
|
+
let request = spec.buildRequests(bidRequests)[0];
|
|
304
|
+
let result = spec.interpretResponse({ body: nativeResponse }, request);
|
|
305
|
+
expect(result).to.deep.equal(expectedResult);
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
it('should interpret display response', function () {
|
|
309
|
+
let expectedResult = [
|
|
310
|
+
{
|
|
311
|
+
requestId: '1d236f7890b',
|
|
312
|
+
cpm: 0.0520,
|
|
313
|
+
width: 300,
|
|
314
|
+
height: 250,
|
|
315
|
+
netRevenue: true,
|
|
316
|
+
currency: 'USD',
|
|
317
|
+
creativeId: '<!-- CREATIVE ID -->',
|
|
318
|
+
ttl: 360,
|
|
319
|
+
meta: {
|
|
320
|
+
advertiserDomains: ['domain.test']
|
|
321
|
+
},
|
|
322
|
+
ad: `<html><body><style>.eng_tag_ttl{display:block!important}</style><div id="ENG_TAG"><a href="//click.test" target=_blank><img class="eng_tag_img" src="https://engageya.live/wp-content/uploads/2019/05/images.png" style="width:300px;height:250px;" alt="Test title"/><div class="eng_tag_brnd" style="display: none">Test displayName</div><div class="eng_tag_ttl" style="display: none">Test title</div></a><div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="//impression.test"></div><div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="//view.test"></div><div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="//view.pixel"></div></div></body></html>`,
|
|
323
|
+
}
|
|
324
|
+
];
|
|
325
|
+
let request = spec.buildRequests(bidRequests)[0];
|
|
326
|
+
let result = spec.interpretResponse({ body: bannerResponse }, request);
|
|
327
|
+
expect(result).to.deep.equal(expectedResult);
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
it('should interpret display response - without pecpm', function () {
|
|
331
|
+
delete bannerResponse.recs[0].pecpm;
|
|
332
|
+
let expectedResult = [
|
|
333
|
+
{
|
|
334
|
+
requestId: '1d236f7890b',
|
|
335
|
+
cpm: 0.0920,
|
|
336
|
+
width: 300,
|
|
337
|
+
height: 250,
|
|
338
|
+
netRevenue: false,
|
|
339
|
+
currency: 'USD',
|
|
340
|
+
creativeId: '<!-- CREATIVE ID -->',
|
|
341
|
+
ttl: 360,
|
|
342
|
+
meta: {
|
|
343
|
+
advertiserDomains: ['domain.test']
|
|
344
|
+
},
|
|
345
|
+
ad: `<html><body><style>.eng_tag_ttl{display:block!important}</style><div id="ENG_TAG"><a href="//click.test" target=_blank><img class="eng_tag_img" src="https://engageya.live/wp-content/uploads/2019/05/images.png" style="width:300px;height:250px;" alt="Test title"/><div class="eng_tag_brnd" style="display: none">Test displayName</div><div class="eng_tag_ttl" style="display: none">Test title</div></a><div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="//impression.test"></div><div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="//view.test"></div><div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="//view.pixel"></div></div></body></html>`,
|
|
346
|
+
}
|
|
347
|
+
];
|
|
348
|
+
let request = spec.buildRequests(bidRequests)[0];
|
|
349
|
+
let result = spec.interpretResponse({ body: bannerResponse }, request);
|
|
350
|
+
expect(result).to.deep.equal(expectedResult);
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
it('should interpret display response - without title', function () {
|
|
354
|
+
bannerResponse.recs[0].title = ' ';
|
|
355
|
+
let expectedResult = [
|
|
356
|
+
{
|
|
357
|
+
requestId: '1d236f7890b',
|
|
358
|
+
cpm: 0.0520,
|
|
359
|
+
width: 300,
|
|
360
|
+
height: 250,
|
|
361
|
+
netRevenue: true,
|
|
362
|
+
currency: 'USD',
|
|
363
|
+
creativeId: '<!-- CREATIVE ID -->',
|
|
364
|
+
ttl: 360,
|
|
365
|
+
meta: {
|
|
366
|
+
advertiserDomains: ['domain.test']
|
|
367
|
+
},
|
|
368
|
+
ad: `<html><body><style>.eng_tag_ttl{display:block!important}</style><div id="ENG_TAG"><a href="//click.test" target=_blank><img class="eng_tag_img" src="https://engageya.live/wp-content/uploads/2019/05/images.png" style="width:300px;height:250px;" alt=" "/></a><div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="//impression.test"></div><div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="//view.test"></div><div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="//view.pixel"></div></div></body></html>`,
|
|
369
|
+
}
|
|
370
|
+
];
|
|
371
|
+
let request = spec.buildRequests(bidRequests)[0];
|
|
372
|
+
let result = spec.interpretResponse({ body: bannerResponse }, request);
|
|
373
|
+
expect(result).to.deep.equal(expectedResult);
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
it('should interpret display response - without widget additional data', function () {
|
|
377
|
+
bannerResponse.widget.additionalData = null;
|
|
378
|
+
let expectedResult = [
|
|
379
|
+
{
|
|
380
|
+
requestId: '1d236f7890b',
|
|
381
|
+
cpm: 0.0520,
|
|
382
|
+
width: 300,
|
|
383
|
+
height: 250,
|
|
384
|
+
netRevenue: true,
|
|
385
|
+
currency: 'USD',
|
|
386
|
+
creativeId: '<!-- CREATIVE ID -->',
|
|
387
|
+
ttl: 360,
|
|
388
|
+
meta: {
|
|
389
|
+
advertiserDomains: ['domain.test']
|
|
390
|
+
},
|
|
391
|
+
ad: `<html><body><div id="ENG_TAG"><a href="//click.test" target=_blank><img class="eng_tag_img" src="https://engageya.live/wp-content/uploads/2019/05/images.png" style="width:300px;height:250px;" alt="Test title"/><div class="eng_tag_brnd" style="display: none">Test displayName</div><div class="eng_tag_ttl" style="display: none">Test title</div></a><div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="//impression.test"></div><div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="//view.test"></div><div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="//view.pixel"></div></div></body></html>`,
|
|
392
|
+
}
|
|
393
|
+
];
|
|
394
|
+
let request = spec.buildRequests(bidRequests)[0];
|
|
395
|
+
let result = spec.interpretResponse({ body: bannerResponse }, request);
|
|
396
|
+
expect(result).to.deep.equal(expectedResult);
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
it('should interpret display response - without trackers', function () {
|
|
400
|
+
bannerResponse.recs[0].trackers = null;
|
|
401
|
+
let expectedResult = [
|
|
402
|
+
{
|
|
403
|
+
requestId: '1d236f7890b',
|
|
404
|
+
cpm: 0.0520,
|
|
405
|
+
width: 300,
|
|
406
|
+
height: 250,
|
|
407
|
+
netRevenue: true,
|
|
408
|
+
currency: 'USD',
|
|
409
|
+
creativeId: '<!-- CREATIVE ID -->',
|
|
410
|
+
ttl: 360,
|
|
411
|
+
meta: {
|
|
412
|
+
advertiserDomains: ['domain.test']
|
|
413
|
+
},
|
|
414
|
+
ad: `<html><body><style>.eng_tag_ttl{display:block!important}</style><div id="ENG_TAG"><a href="//click.test" target=_blank><img class="eng_tag_img" src="https://engageya.live/wp-content/uploads/2019/05/images.png" style="width:300px;height:250px;" alt="Test title"/><div class="eng_tag_brnd" style="display: none">Test displayName</div><div class="eng_tag_ttl" style="display: none">Test title</div></a><div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="//view.pixel"></div></div></body></html>`,
|
|
415
|
+
}
|
|
416
|
+
];
|
|
417
|
+
let request = spec.buildRequests(bidRequests)[0];
|
|
418
|
+
let result = spec.interpretResponse({ body: bannerResponse }, request);
|
|
419
|
+
expect(result).to.deep.equal(expectedResult);
|
|
420
|
+
});
|
|
421
|
+
})
|
|
422
|
+
})
|
|
@@ -328,26 +328,25 @@ describe('E-Planning Adapter', function () {
|
|
|
328
328
|
describe('buildRequests', function () {
|
|
329
329
|
let bidRequests = [validBid];
|
|
330
330
|
let sandbox;
|
|
331
|
+
let getWindowSelfStub;
|
|
332
|
+
let innerWidth;
|
|
331
333
|
beforeEach(() => {
|
|
332
334
|
sandbox = sinon.sandbox.create();
|
|
335
|
+
getWindowSelfStub = sandbox.stub(utils, 'getWindowSelf');
|
|
336
|
+
getWindowSelfStub.returns(createWindow(800));
|
|
333
337
|
});
|
|
334
338
|
|
|
335
339
|
afterEach(() => {
|
|
336
340
|
sandbox.restore();
|
|
337
341
|
});
|
|
338
342
|
|
|
339
|
-
const createWindow = () => {
|
|
343
|
+
const createWindow = (innerWidth) => {
|
|
340
344
|
const win = {};
|
|
341
345
|
win.self = win;
|
|
342
|
-
win.innerWidth =
|
|
346
|
+
win.innerWidth = innerWidth;
|
|
343
347
|
return win;
|
|
344
348
|
};
|
|
345
349
|
|
|
346
|
-
function setupSingleWindow(sandBox) {
|
|
347
|
-
const win = createWindow();
|
|
348
|
-
sandBox.stub(utils, 'getWindowSelf').returns(win);
|
|
349
|
-
}
|
|
350
|
-
|
|
351
350
|
it('should create the url correctly', function () {
|
|
352
351
|
const url = spec.buildRequests(bidRequests, bidderRequest).url;
|
|
353
352
|
expect(url).to.equal('https://pbjs.e-planning.net/pbjs/1/' + CI + '/1/localhost/ROS');
|
|
@@ -516,7 +515,8 @@ describe('E-Planning Adapter', function () {
|
|
|
516
515
|
|
|
517
516
|
it('should return the e parameter with a value according to the sizes in order corresponding to the desktop priority list of the ad units', function () {
|
|
518
517
|
let bidRequestsPrioritySizes = [validBidExistingSizesInPriorityListForDesktop];
|
|
519
|
-
|
|
518
|
+
// overwrite default innerWdith for tests with a larger one we consider "Desktop" or NOT Mobile
|
|
519
|
+
getWindowSelfStub.returns(createWindow(1025));
|
|
520
520
|
const e = spec.buildRequests(bidRequestsPrioritySizes, bidderRequest).data.e;
|
|
521
521
|
expect(e).to.equal('300x250_0:300x250,300x600,970x250');
|
|
522
522
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BANNER } from '../../../src/mediaTypes'
|
|
1
2
|
import { expect } from 'chai'
|
|
2
3
|
import { newBidder } from 'src/adapters/bidderFactory.js'
|
|
3
4
|
import { spec } from 'modules/glimpseBidAdapter.js'
|
|
@@ -79,6 +80,20 @@ function getDeepCopy(object) {
|
|
|
79
80
|
describe('GlimpseProtocolAdapter', () => {
|
|
80
81
|
const glimpseAdapter = newBidder(spec)
|
|
81
82
|
|
|
83
|
+
describe('spec', () => {
|
|
84
|
+
it('Has defined the glimpse gvlid', () => {
|
|
85
|
+
expect(spec.gvlid).to.equal(1012)
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
it('Has defined glimpse as the bidder', () => {
|
|
89
|
+
expect(spec.code).to.equal('glimpse')
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
it('Has defined valid mediaTypes', () => {
|
|
93
|
+
expect(spec.supportedMediaTypes).to.deep.equal([BANNER])
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
|
|
82
97
|
describe('Inherited functions', () => {
|
|
83
98
|
it('Functions exist and are valid types', () => {
|
|
84
99
|
expect(glimpseAdapter.callBids).to.exist.and.to.be.a('function')
|
|
@@ -163,6 +178,24 @@ describe('GlimpseProtocolAdapter', () => {
|
|
|
163
178
|
const bidRequests = [getBidRequest()]
|
|
164
179
|
const bidderRequest = getBidderRequest()
|
|
165
180
|
|
|
181
|
+
it('Adds a demo flag', () => {
|
|
182
|
+
const request = spec.buildRequests(bidRequests, bidderRequest)
|
|
183
|
+
const payload = JSON.parse(request.data)
|
|
184
|
+
expect(payload.data.demo).to.be.false
|
|
185
|
+
})
|
|
186
|
+
|
|
187
|
+
it('Adds an account id', () => {
|
|
188
|
+
const request = spec.buildRequests(bidRequests, bidderRequest)
|
|
189
|
+
const payload = JSON.parse(request.data)
|
|
190
|
+
expect(payload.data.account).to.equal(-1)
|
|
191
|
+
})
|
|
192
|
+
|
|
193
|
+
it('Adds a demand provider', () => {
|
|
194
|
+
const request = spec.buildRequests(bidRequests, bidderRequest)
|
|
195
|
+
const payload = JSON.parse(request.data)
|
|
196
|
+
expect(payload.data.demand).to.equal('glimpse')
|
|
197
|
+
})
|
|
198
|
+
|
|
166
199
|
it('Adds GDPR consent', () => {
|
|
167
200
|
const request = spec.buildRequests(bidRequests, bidderRequest)
|
|
168
201
|
const payload = JSON.parse(request.data)
|
|
@@ -197,15 +197,69 @@ describe('GPT pre-auction module', () => {
|
|
|
197
197
|
code: 'slotCode3',
|
|
198
198
|
}];
|
|
199
199
|
|
|
200
|
+
// first two adUnits directly pass in pbadslot => gpid is same
|
|
200
201
|
const expectedAdUnits = [{
|
|
201
202
|
code: 'adUnit1',
|
|
202
|
-
ortb2Imp: {
|
|
203
|
-
|
|
203
|
+
ortb2Imp: {
|
|
204
|
+
ext: {
|
|
205
|
+
data: {
|
|
206
|
+
pbadslot: '12345'
|
|
207
|
+
},
|
|
208
|
+
gpid: '12345'
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
// second adunit
|
|
213
|
+
{
|
|
204
214
|
code: 'slotCode1',
|
|
205
|
-
ortb2Imp: {
|
|
215
|
+
ortb2Imp: {
|
|
216
|
+
ext: {
|
|
217
|
+
data: {
|
|
218
|
+
pbadslot: '67890',
|
|
219
|
+
adserver: {
|
|
220
|
+
name: 'gam',
|
|
221
|
+
adslot: 'slotCode1'
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
gpid: '67890'
|
|
225
|
+
}
|
|
226
|
+
}
|
|
206
227
|
}, {
|
|
207
228
|
code: 'slotCode3',
|
|
208
|
-
ortb2Imp: {
|
|
229
|
+
ortb2Imp: {
|
|
230
|
+
ext: {
|
|
231
|
+
data: {
|
|
232
|
+
pbadslot: 'slotCode3',
|
|
233
|
+
adserver: {
|
|
234
|
+
name: 'gam',
|
|
235
|
+
adslot: 'slotCode3'
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
gpid: 'slotCode3'
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}];
|
|
242
|
+
|
|
243
|
+
window.googletag.pubads().setSlots(testSlots);
|
|
244
|
+
runMakeBidRequests(testAdUnits);
|
|
245
|
+
expect(returnedAdUnits).to.deep.equal(expectedAdUnits);
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
it('should not apply gpid if pbadslot was set by adUnitCode', () => {
|
|
249
|
+
const testAdUnits = [{
|
|
250
|
+
code: 'noMatchCode',
|
|
251
|
+
}];
|
|
252
|
+
|
|
253
|
+
// first two adUnits directly pass in pbadslot => gpid is same
|
|
254
|
+
const expectedAdUnits = [{
|
|
255
|
+
code: 'noMatchCode',
|
|
256
|
+
ortb2Imp: {
|
|
257
|
+
ext: {
|
|
258
|
+
data: {
|
|
259
|
+
pbadslot: 'noMatchCode'
|
|
260
|
+
},
|
|
261
|
+
}
|
|
262
|
+
}
|
|
209
263
|
}];
|
|
210
264
|
|
|
211
265
|
window.googletag.pubads().setSlots(testSlots);
|
|
@@ -531,9 +531,13 @@ describe('gumgumAdapter', function () {
|
|
|
531
531
|
const jcsi = JSON.stringify(JCSI);
|
|
532
532
|
const bidRequest = spec.buildRequests(bidRequests)[0];
|
|
533
533
|
const actualKeys = Object.keys(JSON.parse(bidRequest.data.jcsi)).sort();
|
|
534
|
-
expect(actualKeys).to.
|
|
534
|
+
expect(actualKeys).to.eql(expectedKeys);
|
|
535
535
|
expect(bidRequest.data.jcsi).to.eq(jcsi);
|
|
536
536
|
});
|
|
537
|
+
it('should include the local time and timezone offset', function () {
|
|
538
|
+
const bidRequest = spec.buildRequests(bidRequests)[0];
|
|
539
|
+
expect(!!bidRequest.data.lt).to.be.true;
|
|
540
|
+
});
|
|
537
541
|
})
|
|
538
542
|
|
|
539
543
|
describe('interpretResponse', function () {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
imRtdSubmodule,
|
|
3
3
|
storage,
|
|
4
|
+
getBidderFunction,
|
|
4
5
|
getCustomBidderFunction,
|
|
5
6
|
setRealTimeData,
|
|
6
7
|
getRealTimeData,
|
|
@@ -47,6 +48,30 @@ describe('imRtdProvider', function () {
|
|
|
47
48
|
})
|
|
48
49
|
})
|
|
49
50
|
|
|
51
|
+
describe('getBidderFunction', function () {
|
|
52
|
+
const assumedBidder = [
|
|
53
|
+
'ix',
|
|
54
|
+
'pubmatic'
|
|
55
|
+
];
|
|
56
|
+
assumedBidder.forEach(bidderName => {
|
|
57
|
+
it(`should return bidderFunction with assumed bidder: ${bidderName}`, function () {
|
|
58
|
+
expect(getBidderFunction(bidderName)).to.exist.and.to.be.a('function');
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it(`should return bid with correct key data: ${bidderName}`, function () {
|
|
62
|
+
const bid = {bidder: bidderName};
|
|
63
|
+
expect(getBidderFunction(bidderName)(bid, {'im_segments': ['12345', '67890']})).to.equal(bid);
|
|
64
|
+
});
|
|
65
|
+
it(`should return bid without data: ${bidderName}`, function () {
|
|
66
|
+
const bid = {bidder: bidderName};
|
|
67
|
+
expect(getBidderFunction(bidderName)(bid, '')).to.equal(bid);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
it(`should return null with unexpected bidder`, function () {
|
|
71
|
+
expect(getBidderFunction('test')).to.equal(null);
|
|
72
|
+
});
|
|
73
|
+
})
|
|
74
|
+
|
|
50
75
|
describe('getCustomBidderFunction', function () {
|
|
51
76
|
it('should return config function', function () {
|
|
52
77
|
const config = {
|