prebid.js 5.19.0 → 6.2.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 +4 -2
- package/browsers.json +13 -37
- package/gulpfile.js +1 -0
- package/karma.conf.maker.js +1 -1
- package/modules/adheseBidAdapter.js +7 -2
- package/modules/adkernelBidAdapter.js +1 -0
- package/modules/adlivetechBidAdapter.md +61 -0
- package/modules/admixerBidAdapter.js +2 -1
- package/modules/adnuntiusBidAdapter.js +2 -1
- package/modules/adomikAnalyticsAdapter.js +10 -4
- package/modules/adplusBidAdapter.js +203 -0
- package/modules/adplusBidAdapter.md +39 -0
- package/modules/adyoulikeBidAdapter.js +7 -2
- package/modules/airgridRtdProvider.js +1 -1
- package/modules/appnexusBidAdapter.js +28 -5
- package/modules/atsAnalyticsAdapter.js +67 -46
- package/modules/atsAnalyticsAdapter.md +1 -0
- package/modules/beachfrontBidAdapter.js +14 -17
- package/modules/betweenBidAdapter.js +2 -1
- package/modules/browsiRtdProvider.js +106 -18
- package/modules/cleanioRtdProvider.js +192 -0
- package/modules/cleanioRtdProvider.md +59 -0
- package/modules/codefuelBidAdapter.js +1 -3
- package/modules/codefuelBidAdapter.md +3 -3
- package/modules/craftBidAdapter.js +5 -3
- package/modules/datablocksBidAdapter.js +3 -3
- package/modules/dchain.js +149 -0
- package/modules/dchain.md +45 -0
- package/modules/deepintentBidAdapter.js +1 -1
- package/modules/deltaprojectsBidAdapter.js +252 -0
- package/modules/deltaprojectsBidAdapter.md +32 -0
- package/modules/emx_digitalBidAdapter.js +9 -1
- package/modules/engageyaBidAdapter.js +68 -54
- package/modules/freewheel-sspBidAdapter.js +6 -0
- package/modules/glimpseBidAdapter.js +31 -16
- package/modules/goldbachBidAdapter.js +1176 -0
- package/modules/goldbachBidAdapter.md +151 -0
- package/modules/gptPreAuction.js +11 -5
- package/modules/gridBidAdapter.js +1 -0
- package/modules/gumgumBidAdapter.js +5 -1
- package/modules/id5IdSystem.md +6 -6
- package/modules/imRtdProvider.js +31 -0
- package/modules/intersectionRtdProvider.js +114 -0
- package/modules/invibesBidAdapter.js +15 -9
- package/modules/ipromBidAdapter.js +79 -0
- package/modules/ixBidAdapter.js +173 -22
- package/modules/jixieBidAdapter.js +8 -2
- package/modules/justpremiumBidAdapter.js +6 -1
- package/modules/limelightDigitalBidAdapter.js +2 -1
- package/modules/livewrappedAnalyticsAdapter.js +5 -0
- package/modules/luponmediaBidAdapter.js +570 -0
- package/modules/merkleIdSystem.js +5 -0
- package/modules/missenaBidAdapter.js +89 -0
- package/modules/multibid/index.js +3 -3
- package/modules/nativoBidAdapter.js +32 -2
- package/modules/oguryBidAdapter.js +2 -1
- package/modules/openxBidAdapter.js +7 -2
- 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/pubmaticBidAdapter.js +5 -3
- package/modules/relaidoBidAdapter.js +86 -65
- package/modules/richaudienceBidAdapter.js +1 -1
- 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 +9 -1
- package/modules/smartxBidAdapter.js +17 -1
- package/modules/sonobiBidAdapter.js +7 -0
- package/modules/sortableBidAdapter.js +1 -0
- package/modules/sspBCBidAdapter.js +34 -3
- package/modules/tappxBidAdapter.js +3 -1
- package/modules/teadsBidAdapter.js +3 -0
- package/modules/trustxBidAdapter.js +18 -7
- package/modules/undertoneBidAdapter.js +8 -1
- package/modules/userId/index.js +27 -2
- package/modules/ventes.md +71 -0
- package/modules/ventesBidAdapter.js +410 -0
- package/modules/ventesBidAdapter.md +93 -0
- package/modules/vidoomyBidAdapter.js +51 -100
- package/modules/visxBidAdapter.js +20 -3
- package/modules/visxBidAdapter.md +4 -6
- package/modules/yahoosspBidAdapter.js +6 -6
- package/modules/yahoosspBidAdapter.md +1 -1
- package/modules/yieldlabBidAdapter.js +41 -10
- package/modules/yieldlabBidAdapter.md +91 -48
- package/modules/yieldoneBidAdapter.js +115 -11
- package/package.json +6 -1
- package/src/adapterManager.js +14 -8
- package/src/auction.js +14 -13
- package/src/targeting.js +2 -2
- package/src/utils.js +7 -0
- package/test/spec/integration/faker/googletag.js +6 -0
- package/test/spec/modules/adheseBidAdapter_spec.js +27 -1
- package/test/spec/modules/adnuntiusBidAdapter_spec.js +18 -0
- package/test/spec/modules/adomikAnalyticsAdapter_spec.js +3 -1
- package/test/spec/modules/adplusBidAdapter_spec.js +213 -0
- package/test/spec/modules/adyoulikeBidAdapter_spec.js +26 -0
- package/test/spec/modules/appnexusBidAdapter_spec.js +65 -2
- package/test/spec/modules/atsAnalyticsAdapter_spec.js +42 -9
- package/test/spec/modules/beachfrontBidAdapter_spec.js +65 -1
- 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 +1 -1
- package/test/spec/modules/datablocksBidAdapter_spec.js +3 -3
- package/test/spec/modules/dchain_spec.js +329 -0
- package/test/spec/modules/deltaprojectsBidAdapter_spec.js +399 -0
- package/test/spec/modules/emx_digitalBidAdapter_spec.js +10 -0
- package/test/spec/modules/engageyaBidAdapter_spec.js +231 -95
- package/test/spec/modules/eplanningBidAdapter_spec.js +8 -8
- package/test/spec/modules/freewheel-sspBidAdapter_spec.js +19 -0
- package/test/spec/modules/glimpseBidAdapter_spec.js +33 -0
- package/test/spec/modules/goldbachBidAdapter_spec.js +1359 -0
- package/test/spec/modules/gptPreAuction_spec.js +58 -4
- package/test/spec/modules/gumgumBidAdapter_spec.js +6 -0
- package/test/spec/modules/imRtdProvider_spec.js +25 -0
- package/test/spec/modules/intersectionRtdProvider_spec.js +141 -0
- package/test/spec/modules/invibesBidAdapter_spec.js +29 -4
- package/test/spec/modules/ipromBidAdapter_spec.js +195 -0
- package/test/spec/modules/ixBidAdapter_spec.js +288 -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 +10 -7
- package/test/spec/modules/livewrappedAnalyticsAdapter_spec.js +23 -4
- package/test/spec/modules/luponmediaBidAdapter_spec.js +412 -0
- package/test/spec/modules/merkleIdSystem_spec.js +18 -0
- package/test/spec/modules/missenaBidAdapter_spec.js +134 -0
- package/test/spec/modules/multibid_spec.js +31 -31
- package/test/spec/modules/nativoBidAdapter_spec.js +35 -18
- package/test/spec/modules/oguryBidAdapter_spec.js +13 -11
- package/test/spec/modules/openxBidAdapter_spec.js +5 -26
- 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/pubmaticBidAdapter_spec.js +1 -1
- package/test/spec/modules/relaidoBidAdapter_spec.js +71 -63
- package/test/spec/modules/seedtagBidAdapter_spec.js +3 -0
- package/test/spec/modules/smaatoBidAdapter_spec.js +61 -0
- package/test/spec/modules/smartxBidAdapter_spec.js +9 -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/tappxBidAdapter_spec.js +4 -0
- package/test/spec/modules/teadsBidAdapter_spec.js +132 -0
- package/test/spec/modules/trustxBidAdapter_spec.js +45 -3
- package/test/spec/modules/userId_spec.js +51 -0
- package/test/spec/modules/ventesBidAdapter_spec.js +845 -0
- package/test/spec/modules/vidoomyBidAdapter_spec.js +32 -13
- package/test/spec/modules/visxBidAdapter_spec.js +121 -5
- package/test/spec/modules/yieldlabBidAdapter_spec.js +81 -0
- package/test/spec/modules/yieldoneBidAdapter_spec.js +299 -53
- package/test/spec/unit/core/adapterManager_spec.js +26 -7
- package/test/spec/unit/core/targeting_spec.js +44 -0
- package/wdio.conf.js +1 -1
|
@@ -0,0 +1,845 @@
|
|
|
1
|
+
import { expect } from 'chai';
|
|
2
|
+
import * as utils from 'src/utils.js';
|
|
3
|
+
import { spec } from 'modules/ventesBidAdapter.js';
|
|
4
|
+
|
|
5
|
+
const BIDDER_URL = 'http://13.234.201.146:8088/va/ad';
|
|
6
|
+
|
|
7
|
+
describe('Ventes Adapter', function () {
|
|
8
|
+
const examples = {
|
|
9
|
+
adUnit_banner: {
|
|
10
|
+
adUnitCode: 'ad_unit_banner',
|
|
11
|
+
bidder: 'ventes',
|
|
12
|
+
bidderRequestId: 'bid_request_id',
|
|
13
|
+
bidId: 'bid_id',
|
|
14
|
+
params: {
|
|
15
|
+
publisherId: 'agltb3B1Yi1pbmNyDAsSA0FwcBiJkfTUCV',
|
|
16
|
+
placementId: 'VA-062-0013-0183',
|
|
17
|
+
device: {
|
|
18
|
+
ip: '123.145.167.189',
|
|
19
|
+
ifa: 'AEBE52E7-03EE-455A-B3C4-E57283966239',
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
mediaTypes: {
|
|
23
|
+
banner: {
|
|
24
|
+
sizes: [[300, 250]]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
adUnitContext: {
|
|
30
|
+
refererInfo: {
|
|
31
|
+
referer: 'https://ventesavenues.in',
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
serverRequest_banner: {
|
|
36
|
+
method: 'POST',
|
|
37
|
+
url: 'http://13.234.201.146:8088/va/ad',
|
|
38
|
+
data: {
|
|
39
|
+
id: 'bid_request_id',
|
|
40
|
+
imp: [
|
|
41
|
+
{
|
|
42
|
+
id: 'imp_id_banner',
|
|
43
|
+
banner: {
|
|
44
|
+
format: [{
|
|
45
|
+
w: 300,
|
|
46
|
+
h: 200
|
|
47
|
+
}]
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
site: {
|
|
52
|
+
page: 'https://ventesavenues.in',
|
|
53
|
+
domain: 'ventesavenues.in',
|
|
54
|
+
name: 'ventesavenues.in'
|
|
55
|
+
},
|
|
56
|
+
device: {
|
|
57
|
+
ua: '',
|
|
58
|
+
ip: '123.145.167.189',
|
|
59
|
+
ifa: 'AEBE52E7-03EE-455A-B3C4-E57283966239',
|
|
60
|
+
language: 'en'
|
|
61
|
+
},
|
|
62
|
+
user: null,
|
|
63
|
+
regs: null,
|
|
64
|
+
at: 1
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
serverResponse_banner: {
|
|
68
|
+
body: {
|
|
69
|
+
cur: 'USD',
|
|
70
|
+
seatbid: [
|
|
71
|
+
{
|
|
72
|
+
seat: '4',
|
|
73
|
+
bid: [
|
|
74
|
+
{
|
|
75
|
+
id: 'id',
|
|
76
|
+
impid: 'imp_id_banner',
|
|
77
|
+
cid: 'campaign_id',
|
|
78
|
+
crid: 'creative_id',
|
|
79
|
+
adm: '<html>..</html>',
|
|
80
|
+
price: 1.5,
|
|
81
|
+
w: 300,
|
|
82
|
+
h: 200
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
describe('isBidRequestValid', function () {
|
|
92
|
+
describe('General', function () {
|
|
93
|
+
it('should return false when not given an ad unit', function () {
|
|
94
|
+
const adUnit = undefined;
|
|
95
|
+
|
|
96
|
+
expect(spec.isBidRequestValid(adUnit)).to.equal(false);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('should return false when given an invalid ad unit', function () {
|
|
100
|
+
const adUnit = 'bad_bid';
|
|
101
|
+
|
|
102
|
+
expect(spec.isBidRequestValid(adUnit)).to.equal(false);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it('should return false when given an ad unit without bidder code', function () {
|
|
106
|
+
const adUnit = utils.deepClone(examples.adUnit_banner);
|
|
107
|
+
adUnit.bidder = undefined;
|
|
108
|
+
|
|
109
|
+
expect(spec.isBidRequestValid(adUnit)).to.equal(false);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it('should return false when given an ad unit with a bad bidder code', function () {
|
|
113
|
+
const adUnit = utils.deepClone(examples.adUnit_banner);
|
|
114
|
+
adUnit.bidder = 'unknownBidder';
|
|
115
|
+
|
|
116
|
+
expect(spec.isBidRequestValid(adUnit)).to.equal(false);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it('should return false when given an ad unit without ad unit code', function () {
|
|
120
|
+
const adUnit = utils.deepClone(examples.adUnit_banner);
|
|
121
|
+
adUnit.adUnitCode = undefined;
|
|
122
|
+
|
|
123
|
+
expect(spec.isBidRequestValid(adUnit)).to.equal(false);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it('should return false when given an ad unit with an invalid ad unit code', function () {
|
|
127
|
+
const adUnit = utils.deepClone(examples.adUnit_banner);
|
|
128
|
+
adUnit.adUnitCode = {};
|
|
129
|
+
|
|
130
|
+
expect(spec.isBidRequestValid(adUnit)).to.equal(false);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it('should return false when given an ad unit without bid request identifier', function () {
|
|
134
|
+
const adUnit = utils.deepClone(examples.adUnit_banner);
|
|
135
|
+
adUnit.bidderRequestId = undefined;
|
|
136
|
+
|
|
137
|
+
expect(spec.isBidRequestValid(adUnit)).to.equal(false);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
it('should return false when given an ad unit with an invalid bid request identifier', function () {
|
|
141
|
+
const adUnit = utils.deepClone(examples.adUnit_banner);
|
|
142
|
+
adUnit.bidderRequestId = {};
|
|
143
|
+
|
|
144
|
+
expect(spec.isBidRequestValid(adUnit)).to.equal(false);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
it('should return false when given an ad unit without impression identifier', function () {
|
|
148
|
+
const adUnit = utils.deepClone(examples.adUnit_banner);
|
|
149
|
+
adUnit.bidId = undefined;
|
|
150
|
+
|
|
151
|
+
expect(spec.isBidRequestValid(adUnit)).to.equal(false);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
it('should return false when given an ad unit with an invalid impression identifier', function () {
|
|
155
|
+
const adUnit = utils.deepClone(examples.adUnit_banner);
|
|
156
|
+
adUnit.bidId = {};
|
|
157
|
+
|
|
158
|
+
expect(spec.isBidRequestValid(adUnit)).to.equal(false);
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
it('should return false when given an ad unit without media types', function () {
|
|
162
|
+
const adUnit = utils.deepClone(examples.adUnit_banner);
|
|
163
|
+
adUnit.mediaTypes = undefined;
|
|
164
|
+
|
|
165
|
+
expect(spec.isBidRequestValid(adUnit)).to.equal(false);
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
it('should return false when given an ad unit with empty media types', function () {
|
|
169
|
+
const adUnit = utils.deepClone(examples.adUnit_banner);
|
|
170
|
+
adUnit.mediaTypes = {};
|
|
171
|
+
|
|
172
|
+
expect(spec.isBidRequestValid(adUnit)).to.equal(false);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
it('should return false when given an ad unit with invalid media types', function () {
|
|
176
|
+
const adUnit = utils.deepClone(examples.adUnit_banner);
|
|
177
|
+
adUnit.mediaTypes = 'bad_media_types';
|
|
178
|
+
|
|
179
|
+
expect(spec.isBidRequestValid(adUnit)).to.equal(false);
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
describe('Banner', function () {
|
|
184
|
+
it('should return true when given a valid ad unit', function () {
|
|
185
|
+
const adUnit = examples.adUnit_banner;
|
|
186
|
+
|
|
187
|
+
expect(spec.isBidRequestValid(adUnit)).to.equal(true);
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
it('should return true when given a valid ad unit with invalid publisher id', function () {
|
|
191
|
+
const adUnit = utils.deepClone(examples.adUnit_banner);
|
|
192
|
+
adUnit.params = {};
|
|
193
|
+
adUnit.params.publisherId = undefined;
|
|
194
|
+
|
|
195
|
+
expect(spec.isBidRequestValid(adUnit)).to.equal(false);
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
it('should return true when given a valid ad unit without placement id', function () {
|
|
199
|
+
const adUnit = utils.deepClone(examples.adUnit_banner);
|
|
200
|
+
adUnit.params = {};
|
|
201
|
+
adUnit.params.publisherId = 'agltb3B1Yi1pbmNyDAsSA0FwcBiJkfTUCV';
|
|
202
|
+
|
|
203
|
+
expect(spec.isBidRequestValid(adUnit)).to.equal(false);
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
it('should return true when given a valid ad unit with invalid placement id', function () {
|
|
207
|
+
const adUnit = utils.deepClone(examples.adUnit_banner);
|
|
208
|
+
adUnit.params = {};
|
|
209
|
+
adUnit.params.publisherId = 'agltb3B1Yi1pbmNyDAsSA0FwcBiJkfTUCV';
|
|
210
|
+
adUnit.params.placementId = undefined;
|
|
211
|
+
|
|
212
|
+
expect(spec.isBidRequestValid(adUnit)).to.equal(false);
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
it('should return false when given an ad unit without size', function () {
|
|
216
|
+
const adUnit = utils.deepClone(examples.adUnit_banner);
|
|
217
|
+
adUnit.mediaTypes.banner.sizes = undefined;
|
|
218
|
+
|
|
219
|
+
expect(spec.isBidRequestValid(adUnit)).to.equal(false);
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
it('should return false when given an ad unit with an invalid size', function () {
|
|
223
|
+
const adUnit = utils.deepClone(examples.adUnit_banner);
|
|
224
|
+
adUnit.mediaTypes.banner.sizes = 'bad_banner_size';
|
|
225
|
+
|
|
226
|
+
expect(spec.isBidRequestValid(adUnit)).to.equal(false);
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
it('should return false when given an ad unit with an empty size', function () {
|
|
230
|
+
const adUnit = utils.deepClone(examples.adUnit_banner);
|
|
231
|
+
adUnit.mediaTypes.banner.sizes = [];
|
|
232
|
+
|
|
233
|
+
expect(spec.isBidRequestValid(adUnit)).to.equal(false);
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
it('should return false when given an ad unit with an invalid size value', function () {
|
|
237
|
+
const adUnit = utils.deepClone(examples.adUnit_banner);
|
|
238
|
+
adUnit.mediaTypes.banner.sizes = ['bad_banner_size_value'];
|
|
239
|
+
|
|
240
|
+
expect(spec.isBidRequestValid(adUnit)).to.equal(false);
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
it('should return false when given an ad unit with a size value with less than 2 dimensions', function () {
|
|
244
|
+
const adUnit = utils.deepClone(examples.adUnit_banner);
|
|
245
|
+
adUnit.mediaTypes.banner.sizes = [[300]];
|
|
246
|
+
|
|
247
|
+
expect(spec.isBidRequestValid(adUnit)).to.equal(false);
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
it('should return false when given an ad unit with a size value with more than 2 dimensions', function () {
|
|
251
|
+
const adUnit = utils.deepClone(examples.adUnit_banner);
|
|
252
|
+
adUnit.mediaTypes.banner.sizes = [[300, 250, 30]];
|
|
253
|
+
|
|
254
|
+
expect(spec.isBidRequestValid(adUnit)).to.equal(false);
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
it('should return false when given an ad unit with a negative width value', function () {
|
|
258
|
+
const adUnit = utils.deepClone(examples.adUnit_banner);
|
|
259
|
+
adUnit.mediaTypes.banner.sizes = [[-300, 250]];
|
|
260
|
+
|
|
261
|
+
expect(spec.isBidRequestValid(adUnit)).to.equal(false);
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
it('should return false when given an ad unit with a negative height value', function () {
|
|
265
|
+
const adUnit = utils.deepClone(examples.adUnit_banner);
|
|
266
|
+
adUnit.mediaTypes.banner.sizes = [[300, -250]];
|
|
267
|
+
|
|
268
|
+
expect(spec.isBidRequestValid(adUnit)).to.equal(false);
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
it('should return false when given an ad unit with an invalid width value', function () {
|
|
272
|
+
const adUnit = utils.deepClone(examples.adUnit_banner);
|
|
273
|
+
adUnit.mediaTypes.banner.sizes = [[false, 250]];
|
|
274
|
+
|
|
275
|
+
expect(spec.isBidRequestValid(adUnit)).to.equal(false);
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
it('should return false when given an ad unit with an invalid height value', function () {
|
|
279
|
+
const adUnit = utils.deepClone(examples.adUnit_banner);
|
|
280
|
+
adUnit.mediaTypes.banner.sizes = [[300, {}]];
|
|
281
|
+
|
|
282
|
+
expect(spec.isBidRequestValid(adUnit)).to.equal(false);
|
|
283
|
+
});
|
|
284
|
+
});
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
describe('buildRequests', function () {
|
|
288
|
+
describe('ServerRequest', function () {
|
|
289
|
+
it('should return a server request when given a valid ad unit and a valid ad unit context', function () {
|
|
290
|
+
const adUnits = [examples.adUnit_banner];
|
|
291
|
+
const serverRequests = spec.buildRequests(adUnits, examples.adUnitContext);
|
|
292
|
+
expect(serverRequests).to.be.an('array').and.to.have.length(1);
|
|
293
|
+
expect(serverRequests[0].method).to.exist.and.to.be.a('string').and.to.equal('POST');
|
|
294
|
+
expect(serverRequests[0].url).to.exist.and.to.be.a('string').and.to.equal(BIDDER_URL);
|
|
295
|
+
expect(serverRequests[0].data).to.exist.and.to.be.an('object');
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
it('should return an empty server request list when given an empty ad unit list and a valid ad unit context', function () {
|
|
299
|
+
const adUnits = [];
|
|
300
|
+
const serverRequests = spec.buildRequests(adUnits, examples.adUnitContext);
|
|
301
|
+
expect(serverRequests).to.be.an('array').and.to.have.length(0);
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
it('should not return a server request when given no ad unit and a valid ad unit context', function () {
|
|
305
|
+
const serverRequests = spec.buildRequests(null, examples.adUnitContext);
|
|
306
|
+
expect(serverRequests).to.equal(null);
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
it('should not return a server request when given a valid ad unit and no ad unit context', function () {
|
|
310
|
+
const adUnits = [examples.adUnit_banner];
|
|
311
|
+
const serverRequests = spec.buildRequests(adUnits, null);
|
|
312
|
+
expect(serverRequests).to.be.an('array').and.to.have.length(1);
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
it('should not return a server request when given a valid ad unit and an invalid ad unit context', function () {
|
|
316
|
+
const adUnits = [examples.adUnit_banner];
|
|
317
|
+
const serverRequests = spec.buildRequests(adUnits, {});
|
|
318
|
+
expect(serverRequests).to.be.an('array').and.to.have.length(1);
|
|
319
|
+
});
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
describe('BidRequest', function () {
|
|
323
|
+
it('should return a valid server request when given a valid ad unit', function () {
|
|
324
|
+
const adUnits = [examples.adUnit_banner];
|
|
325
|
+
const serverRequests = spec.buildRequests(adUnits, examples.adUnitContext);
|
|
326
|
+
expect(serverRequests).to.be.an('array').and.to.have.lengthOf(1);
|
|
327
|
+
expect(serverRequests[0].data.id).to.exist.and.to.be.a('string').and.to.equal(adUnits[0].bidderRequestId);
|
|
328
|
+
expect(serverRequests[0].data.at).to.exist.and.to.be.a('number').and.to.equal(1);
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
it('should return one server request when given one valid ad unit', function () {
|
|
332
|
+
const adUnits = [examples.adUnit_banner];
|
|
333
|
+
const serverRequests = spec.buildRequests(adUnits, examples.adUnitContext);
|
|
334
|
+
expect(serverRequests).to.be.an('array').and.to.have.lengthOf(1);
|
|
335
|
+
expect(serverRequests[0].data.id).to.exist.and.to.be.a('string').and.to.equal(adUnits[0].bidderRequestId);
|
|
336
|
+
});
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
describe('Impression', function () {
|
|
340
|
+
describe('Banner', function () {
|
|
341
|
+
it('should return a server request with one impression when given a valid ad unit', function () {
|
|
342
|
+
const adUnits = [examples.adUnit_banner];
|
|
343
|
+
|
|
344
|
+
const serverRequests = spec.buildRequests(adUnits, examples.adUnitContext);
|
|
345
|
+
|
|
346
|
+
expect(serverRequests).to.be.an('array').and.to.have.lengthOf(1);
|
|
347
|
+
|
|
348
|
+
expect(serverRequests[0].data).to.exist.and.to.be.an('object');
|
|
349
|
+
expect(serverRequests[0].data.imp).to.exist.and.to.be.an('array').and.to.have.lengthOf(1);
|
|
350
|
+
expect(serverRequests[0].data.imp[0]).to.exist.and.to.be.an('object');
|
|
351
|
+
expect(serverRequests[0].data.imp[0].id).to.exist.and.to.be.a('string').and.to.equal(`${adUnits[0].bidId}`);
|
|
352
|
+
expect(serverRequests[0].data.imp[0].banner).to.exist.and.to.be.an('object');
|
|
353
|
+
expect(serverRequests[0].data.imp[0].banner.w).to.exist.and.to.be.a('number').and.to.equal(adUnits[0].mediaTypes.banner.sizes[0][0]);
|
|
354
|
+
expect(serverRequests[0].data.imp[0].banner.h).to.exist.and.to.be.a('number').and.to.equal(adUnits[0].mediaTypes.banner.sizes[0][1]);
|
|
355
|
+
expect(serverRequests[0].data.imp[0].banner.format).to.exist.and.to.be.an('array').and.to.have.lengthOf(1);
|
|
356
|
+
expect(serverRequests[0].data.imp[0].banner.format[0]).to.exist.and.to.be.an('object').and.to.deep.equal({
|
|
357
|
+
w: adUnits[0].mediaTypes.banner.sizes[0][0],
|
|
358
|
+
h: adUnits[0].mediaTypes.banner.sizes[0][1]
|
|
359
|
+
});
|
|
360
|
+
});
|
|
361
|
+
});
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
describe('Site', function () {
|
|
365
|
+
it('should return a server request with site information when given a valid ad unit and a valid ad unit context', function () {
|
|
366
|
+
const adUnits = [examples.adUnit_banner];
|
|
367
|
+
|
|
368
|
+
const adUnitContext = examples.adUnitContext;
|
|
369
|
+
|
|
370
|
+
const serverRequests = spec.buildRequests(adUnits, adUnitContext);
|
|
371
|
+
|
|
372
|
+
expect(serverRequests).to.be.an('array').and.to.have.lengthOf(1);
|
|
373
|
+
expect(serverRequests[0].data).to.exist.and.to.be.an('object');
|
|
374
|
+
expect(serverRequests[0].data.id).to.exist.and.to.be.an('string').and.to.equal(adUnits[0].bidderRequestId);
|
|
375
|
+
expect(serverRequests[0].data.site).to.exist.and.to.be.an('object');
|
|
376
|
+
expect(serverRequests[0].data.site.page).to.exist.and.to.be.an('string').and.to.equal(adUnitContext.refererInfo.referer);
|
|
377
|
+
expect(serverRequests[0].data.site.domain).to.exist.and.to.be.an('string').and.to.equal('ventesavenues.in');
|
|
378
|
+
expect(serverRequests[0].data.site.name).to.exist.and.to.be.an('string').and.to.equal('ventesavenues.in');
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
it('should return a server request without site information when given an ad unit context without referer information', function () {
|
|
382
|
+
const adUnits = [examples.adUnit_banner];
|
|
383
|
+
|
|
384
|
+
const adUnitContext = utils.deepClone(examples.adUnitContext);
|
|
385
|
+
adUnitContext.refererInfo = undefined;
|
|
386
|
+
|
|
387
|
+
const serverRequests = spec.buildRequests(adUnits, adUnitContext);
|
|
388
|
+
|
|
389
|
+
expect(serverRequests).to.be.an('array').and.to.have.lengthOf(1);
|
|
390
|
+
expect(serverRequests[0].data).to.exist.and.to.be.an('object');
|
|
391
|
+
expect(serverRequests[0].data.id).to.exist.and.to.be.an('string').and.to.equal(adUnits[0].bidderRequestId);
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
it('should return a server request without site information when given an ad unit context with invalid referer information', function () {
|
|
395
|
+
const adUnits = [examples.adUnit_banner];
|
|
396
|
+
|
|
397
|
+
const adUnitContext = utils.deepClone(examples.adUnitContext);
|
|
398
|
+
adUnitContext.refererInfo = 'bad_referer_information';
|
|
399
|
+
|
|
400
|
+
const serverRequests = spec.buildRequests(adUnits, adUnitContext);
|
|
401
|
+
|
|
402
|
+
expect(serverRequests).to.be.an('array').and.to.have.lengthOf(1);
|
|
403
|
+
expect(serverRequests[0].data).to.exist.and.to.be.an('object');
|
|
404
|
+
expect(serverRequests[0].data.id).to.exist.and.to.be.an('string').and.to.equal(adUnits[0].bidderRequestId);
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
it('should return a server request without site information when given an ad unit context without referer', function () {
|
|
408
|
+
const adUnits = [examples.adUnit_banner];
|
|
409
|
+
|
|
410
|
+
const adUnitContext = utils.deepClone(examples.adUnitContext);
|
|
411
|
+
adUnitContext.refererInfo.referer = undefined;
|
|
412
|
+
|
|
413
|
+
const serverRequests = spec.buildRequests(adUnits, adUnitContext);
|
|
414
|
+
|
|
415
|
+
expect(serverRequests).to.be.an('array').and.to.have.lengthOf(1);
|
|
416
|
+
expect(serverRequests[0].data).to.exist.and.to.be.an('object');
|
|
417
|
+
expect(serverRequests[0].data.id).to.exist.and.to.be.an('string').and.to.equal(adUnits[0].bidderRequestId);
|
|
418
|
+
});
|
|
419
|
+
|
|
420
|
+
it('should return a server request without site information when given an ad unit context with an invalid referer', function () {
|
|
421
|
+
const adUnits = [examples.adUnit_banner];
|
|
422
|
+
|
|
423
|
+
const adUnitContext = utils.deepClone(examples.adUnitContext);
|
|
424
|
+
adUnitContext.refererInfo.referer = {};
|
|
425
|
+
|
|
426
|
+
const serverRequests = spec.buildRequests(adUnits, adUnitContext);
|
|
427
|
+
|
|
428
|
+
expect(serverRequests).to.be.an('array').and.to.have.lengthOf(1);
|
|
429
|
+
expect(serverRequests[0].data).to.exist.and.to.be.an('object');
|
|
430
|
+
expect(serverRequests[0].data.id).to.exist.and.to.be.an('string').and.to.equal(adUnits[0].bidderRequestId);
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
it('should return a server request without site information when given an ad unit context with a misformatted referer', function () {
|
|
434
|
+
const adUnits = [examples.adUnit_banner];
|
|
435
|
+
|
|
436
|
+
const adUnitContext = utils.deepClone(examples.adUnitContext);
|
|
437
|
+
adUnitContext.refererInfo.referer = 'we-are-adot';
|
|
438
|
+
|
|
439
|
+
const serverRequests = spec.buildRequests(adUnits, adUnitContext);
|
|
440
|
+
|
|
441
|
+
expect(serverRequests).to.be.an('array').and.to.have.lengthOf(1);
|
|
442
|
+
expect(serverRequests[0].data).to.exist.and.to.be.an('object');
|
|
443
|
+
expect(serverRequests[0].data.id).to.exist.and.to.be.an('string').and.to.equal(adUnits[0].bidderRequestId);
|
|
444
|
+
});
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
describe('Device', function () {
|
|
448
|
+
it('should return a server request with device information when given a valid ad unit and a valid ad unit context', function () {
|
|
449
|
+
const adUnits = [examples.adUnit_banner];
|
|
450
|
+
|
|
451
|
+
const serverRequests = spec.buildRequests(adUnits, examples.adUnitContext);
|
|
452
|
+
|
|
453
|
+
expect(serverRequests).to.be.an('array').and.to.have.lengthOf(1);
|
|
454
|
+
expect(serverRequests[0].data).to.exist.and.to.be.an('object');
|
|
455
|
+
expect(serverRequests[0].data.id).to.exist.and.to.be.an('string').and.to.equal(adUnits[0].bidderRequestId);
|
|
456
|
+
expect(serverRequests[0].data.device).to.exist.and.to.be.an('object');
|
|
457
|
+
expect(serverRequests[0].data.device.ua).to.exist.and.to.be.a('string');
|
|
458
|
+
expect(serverRequests[0].data.device.language).to.exist.and.to.be.a('string');
|
|
459
|
+
});
|
|
460
|
+
});
|
|
461
|
+
|
|
462
|
+
describe('User', function () {
|
|
463
|
+
it('should return a server request with user information when given a valid ad unit and a valid ad unit context', function () {
|
|
464
|
+
const adUnits = [examples.adUnit_banner];
|
|
465
|
+
|
|
466
|
+
const adUnitContext = examples.adUnitContext;
|
|
467
|
+
|
|
468
|
+
const serverRequests = spec.buildRequests(adUnits, adUnitContext);
|
|
469
|
+
|
|
470
|
+
expect(serverRequests).to.be.an('array').and.to.have.lengthOf(1);
|
|
471
|
+
expect(serverRequests[0].data).to.exist.and.to.be.an('object');
|
|
472
|
+
expect(serverRequests[0].data.id).to.exist.and.to.be.an('string').and.to.equal(adUnits[0].bidderRequestId);
|
|
473
|
+
expect(serverRequests[0].data.user).to.exist.and.to.be.an('object');
|
|
474
|
+
});
|
|
475
|
+
|
|
476
|
+
it('should return a server request without user information when not given an ad unit context', function () {
|
|
477
|
+
const adUnits = [examples.adUnit_banner];
|
|
478
|
+
|
|
479
|
+
const adUnitContext = undefined;
|
|
480
|
+
|
|
481
|
+
const serverRequests = spec.buildRequests(adUnits, adUnitContext);
|
|
482
|
+
|
|
483
|
+
expect(serverRequests).to.be.an('array').and.to.have.lengthOf(1);
|
|
484
|
+
expect(serverRequests[0].data).to.exist.and.to.be.an('object');
|
|
485
|
+
expect(serverRequests[0].data.id).to.exist.and.to.be.an('string').and.to.equal(adUnits[0].bidderRequestId);
|
|
486
|
+
});
|
|
487
|
+
});
|
|
488
|
+
});
|
|
489
|
+
|
|
490
|
+
describe('interpretResponse', function () {
|
|
491
|
+
describe('General', function () {
|
|
492
|
+
it('should return an ad when given a valid server response with one bid with USD currency', function () {
|
|
493
|
+
const serverRequest = examples.serverRequest_banner;
|
|
494
|
+
|
|
495
|
+
const serverResponse = utils.deepClone(examples.serverResponse_banner);
|
|
496
|
+
serverResponse.body.cur = 'USD';
|
|
497
|
+
const ads = spec.interpretResponse(serverResponse, serverRequest);
|
|
498
|
+
|
|
499
|
+
expect(ads).to.be.an('array').and.to.have.length(1);
|
|
500
|
+
expect(ads[0].creativeId).to.exist.and.to.be.a('string').and.to.equal(serverResponse.body.seatbid[0].bid[0].crid);
|
|
501
|
+
expect(ads[0].cpm).to.exist.and.to.be.a('number').and.to.equal(serverResponse.body.seatbid[0].bid[0].price);
|
|
502
|
+
expect(ads[0].currency).to.exist.and.to.be.a('string').and.to.equal(serverResponse.body.cur);
|
|
503
|
+
expect(ads[0].netRevenue).to.exist.and.to.be.a('boolean').and.to.equal(true);
|
|
504
|
+
expect(ads[0].ttl).to.exist.and.to.be.a('number').and.to.equal(10);
|
|
505
|
+
expect(ads[0].height).to.exist.and.to.be.a('number').and.to.equal(serverResponse.body.seatbid[0].bid[0].h);
|
|
506
|
+
expect(ads[0].width).to.exist.and.to.be.a('number').and.to.equal(serverResponse.body.seatbid[0].bid[0].w);
|
|
507
|
+
expect(ads[0].mediaType).to.exist.and.to.be.a('string').and.to.equal('banner');
|
|
508
|
+
});
|
|
509
|
+
|
|
510
|
+
it('should return no ad when not given a server response', function () {
|
|
511
|
+
const ads = spec.interpretResponse(null);
|
|
512
|
+
|
|
513
|
+
expect(ads).to.be.an('array').and.to.have.length(0);
|
|
514
|
+
});
|
|
515
|
+
|
|
516
|
+
it('should return no ad when not given a server response body', function () {
|
|
517
|
+
const serverRequest = examples.serverRequest_banner;
|
|
518
|
+
|
|
519
|
+
const serverResponse = utils.deepClone(examples.serverResponse_banner);
|
|
520
|
+
serverResponse.body = undefined;
|
|
521
|
+
|
|
522
|
+
const ads = spec.interpretResponse(serverResponse, serverRequest);
|
|
523
|
+
|
|
524
|
+
expect(ads).to.be.an('array').and.to.have.length(0);
|
|
525
|
+
});
|
|
526
|
+
|
|
527
|
+
it('should return no ad when given an invalid server response body', function () {
|
|
528
|
+
const serverRequest = examples.serverRequest_banner;
|
|
529
|
+
|
|
530
|
+
const serverResponse = utils.deepClone(examples.serverResponse_banner);
|
|
531
|
+
serverResponse.body = 'invalid_body';
|
|
532
|
+
|
|
533
|
+
const ads = spec.interpretResponse(serverResponse, serverRequest);
|
|
534
|
+
|
|
535
|
+
expect(ads).to.be.an('array').and.to.have.length(0);
|
|
536
|
+
});
|
|
537
|
+
|
|
538
|
+
it('should return no ad when given a server response without seat bids', function () {
|
|
539
|
+
const serverRequest = examples.serverRequest_banner;
|
|
540
|
+
|
|
541
|
+
const serverResponse = utils.deepClone(examples.serverResponse_banner);
|
|
542
|
+
serverResponse.body.seatbid = undefined;
|
|
543
|
+
|
|
544
|
+
const ads = spec.interpretResponse(serverResponse, serverRequest);
|
|
545
|
+
|
|
546
|
+
expect(ads).to.be.an('array').and.to.have.length(0);
|
|
547
|
+
});
|
|
548
|
+
|
|
549
|
+
it('should return no ad when given a server response with invalid seat bids', function () {
|
|
550
|
+
const serverRequest = examples.serverRequest_banner;
|
|
551
|
+
|
|
552
|
+
const serverResponse = utils.deepClone(examples.serverResponse_banner);
|
|
553
|
+
serverResponse.body.seatbid = 'invalid_seat_bids';
|
|
554
|
+
|
|
555
|
+
const ads = spec.interpretResponse(serverResponse, serverRequest);
|
|
556
|
+
|
|
557
|
+
expect(ads).to.be.an('array').and.to.have.length(0);
|
|
558
|
+
});
|
|
559
|
+
|
|
560
|
+
it('should return no ad when given a server response with an empty seat bids array', function () {
|
|
561
|
+
const serverRequest = examples.serverRequest_banner;
|
|
562
|
+
|
|
563
|
+
const serverResponse = utils.deepClone(examples.serverResponse_banner);
|
|
564
|
+
serverResponse.body.seatbid = [];
|
|
565
|
+
|
|
566
|
+
const ads = spec.interpretResponse(serverResponse, serverRequest);
|
|
567
|
+
|
|
568
|
+
expect(ads).to.be.an('array').and.to.have.length(0);
|
|
569
|
+
});
|
|
570
|
+
|
|
571
|
+
it('should return no ad when given a server response with an invalid seat bid', function () {
|
|
572
|
+
const serverRequest = examples.serverRequest_banner;
|
|
573
|
+
|
|
574
|
+
const serverResponse = utils.deepClone(examples.serverResponse_banner);
|
|
575
|
+
serverResponse.body.seatbid[0].bid = 'invalid_bids';
|
|
576
|
+
|
|
577
|
+
const ads = spec.interpretResponse(serverResponse, serverRequest);
|
|
578
|
+
|
|
579
|
+
expect(ads).to.be.an('array').and.to.have.length(0);
|
|
580
|
+
});
|
|
581
|
+
|
|
582
|
+
it('should return no ad when given a server response with an empty bids array', function () {
|
|
583
|
+
const serverRequest = examples.serverRequest_banner;
|
|
584
|
+
|
|
585
|
+
const serverResponse = utils.deepClone(examples.serverResponse_banner);
|
|
586
|
+
serverResponse.body.seatbid[0].bid = [];
|
|
587
|
+
|
|
588
|
+
const ads = spec.interpretResponse(serverResponse, serverRequest);
|
|
589
|
+
|
|
590
|
+
expect(ads).to.be.an('array').and.to.have.length(0);
|
|
591
|
+
});
|
|
592
|
+
|
|
593
|
+
it('should return no ad when given a server response with an invalid bid', function () {
|
|
594
|
+
const serverRequest = examples.serverRequest_banner;
|
|
595
|
+
|
|
596
|
+
const serverResponse = utils.deepClone(examples.serverResponse_banner);
|
|
597
|
+
serverResponse.body.seatbid[0].bid = ['invalid_bid'];
|
|
598
|
+
|
|
599
|
+
const ads = spec.interpretResponse(serverResponse, serverRequest);
|
|
600
|
+
|
|
601
|
+
expect(ads).to.be.an('array').and.to.have.length(0);
|
|
602
|
+
});
|
|
603
|
+
|
|
604
|
+
it('should return no ad when given a server response with a bid without currency', function () {
|
|
605
|
+
const serverRequest = examples.serverRequest_banner;
|
|
606
|
+
|
|
607
|
+
const serverResponse = utils.deepClone(examples.serverResponse_banner);
|
|
608
|
+
serverResponse.body.cur = undefined;
|
|
609
|
+
|
|
610
|
+
const ads = spec.interpretResponse(serverResponse, serverRequest);
|
|
611
|
+
|
|
612
|
+
expect(ads).to.be.an('array').and.to.have.length(0);
|
|
613
|
+
});
|
|
614
|
+
|
|
615
|
+
it('should return no ad when given a server response with a bid with an invalid currency', function () {
|
|
616
|
+
const serverRequest = examples.serverRequest_banner;
|
|
617
|
+
|
|
618
|
+
const serverResponse = utils.deepClone(examples.serverResponse_banner);
|
|
619
|
+
serverResponse.body.cur = {};
|
|
620
|
+
|
|
621
|
+
const ads = spec.interpretResponse(serverResponse, serverRequest);
|
|
622
|
+
|
|
623
|
+
expect(ads).to.be.an('array').and.to.have.length(0);
|
|
624
|
+
});
|
|
625
|
+
|
|
626
|
+
it('should return no ad when given a server response with a bid without impression identifier', function () {
|
|
627
|
+
const serverRequest = examples.serverRequest_banner;
|
|
628
|
+
|
|
629
|
+
const serverResponse = utils.deepClone(examples.serverResponse_banner);
|
|
630
|
+
serverResponse.body.seatbid[0].bid[0].impid = undefined;
|
|
631
|
+
|
|
632
|
+
const ads = spec.interpretResponse(serverResponse, serverRequest);
|
|
633
|
+
|
|
634
|
+
expect(ads).to.be.an('array').and.to.have.length(0);
|
|
635
|
+
});
|
|
636
|
+
|
|
637
|
+
it('should return no ad when given a server response with a bid with an invalid impression identifier', function () {
|
|
638
|
+
const serverRequest = examples.serverRequest_banner;
|
|
639
|
+
|
|
640
|
+
const serverResponse = utils.deepClone(examples.serverResponse_banner);
|
|
641
|
+
serverResponse.body.seatbid[0].bid[0].impid = {};
|
|
642
|
+
|
|
643
|
+
const ads = spec.interpretResponse(serverResponse, serverRequest);
|
|
644
|
+
|
|
645
|
+
expect(ads).to.be.an('array').and.to.have.length(0);
|
|
646
|
+
});
|
|
647
|
+
|
|
648
|
+
it('should return no ad when given a server response with a bid without creative identifier', function () {
|
|
649
|
+
const serverRequest = examples.serverRequest_banner;
|
|
650
|
+
|
|
651
|
+
const serverResponse = utils.deepClone(examples.serverResponse_banner);
|
|
652
|
+
serverResponse.body.seatbid[0].bid[0].crid = undefined;
|
|
653
|
+
|
|
654
|
+
const ads = spec.interpretResponse(serverResponse, serverRequest);
|
|
655
|
+
|
|
656
|
+
expect(ads).to.be.an('array').and.to.have.length(0);
|
|
657
|
+
});
|
|
658
|
+
|
|
659
|
+
it('should return no ad when given a server response with a bid with an invalid creative identifier', function () {
|
|
660
|
+
const serverRequest = examples.serverRequest_banner;
|
|
661
|
+
|
|
662
|
+
const serverResponse = utils.deepClone(examples.serverResponse_banner);
|
|
663
|
+
serverResponse.body.seatbid[0].bid[0].crid = {};
|
|
664
|
+
|
|
665
|
+
const ads = spec.interpretResponse(serverResponse, serverRequest);
|
|
666
|
+
|
|
667
|
+
expect(ads).to.be.an('array').and.to.have.length(0);
|
|
668
|
+
});
|
|
669
|
+
|
|
670
|
+
it('should return no ad when given a server response with a bid without ad markup and ad serving URL', function () {
|
|
671
|
+
const serverRequest = examples.serverRequest_banner;
|
|
672
|
+
|
|
673
|
+
const serverResponse = utils.deepClone(examples.serverResponse_banner);
|
|
674
|
+
serverResponse.body.seatbid[0].bid[0].adm = undefined;
|
|
675
|
+
serverResponse.body.seatbid[0].bid[0].nurl = undefined;
|
|
676
|
+
|
|
677
|
+
const ads = spec.interpretResponse(serverResponse, serverRequest);
|
|
678
|
+
|
|
679
|
+
expect(ads).to.be.an('array').and.to.have.length(0);
|
|
680
|
+
});
|
|
681
|
+
|
|
682
|
+
it('should return no ad when given a server response with a bid with an invalid ad markup', function () {
|
|
683
|
+
const serverRequest = examples.serverRequest_banner;
|
|
684
|
+
|
|
685
|
+
const serverResponse = utils.deepClone(examples.serverResponse_banner);
|
|
686
|
+
serverResponse.body.seatbid[0].bid[0].adm = {};
|
|
687
|
+
|
|
688
|
+
const ads = spec.interpretResponse(serverResponse, serverRequest);
|
|
689
|
+
|
|
690
|
+
expect(ads).to.be.an('array').and.to.have.length(0);
|
|
691
|
+
});
|
|
692
|
+
|
|
693
|
+
it('should return no ad when given a server response with a bid without bid price', function () {
|
|
694
|
+
const serverRequest = examples.serverRequest_banner;
|
|
695
|
+
|
|
696
|
+
const serverResponse = utils.deepClone(examples.serverResponse_banner);
|
|
697
|
+
serverResponse.body.seatbid[0].bid[0].price = undefined;
|
|
698
|
+
|
|
699
|
+
const ads = spec.interpretResponse(serverResponse, serverRequest);
|
|
700
|
+
|
|
701
|
+
expect(ads).to.be.an('array').and.to.have.length(0);
|
|
702
|
+
});
|
|
703
|
+
|
|
704
|
+
it('should return no ad when given a server response with a bid with an invalid bid price', function () {
|
|
705
|
+
const serverRequest = examples.serverRequest_banner;
|
|
706
|
+
|
|
707
|
+
const serverResponse = utils.deepClone(examples.serverResponse_banner);
|
|
708
|
+
serverResponse.body.seatbid[0].bid[0].price = {};
|
|
709
|
+
|
|
710
|
+
const ads = spec.interpretResponse(serverResponse, serverRequest);
|
|
711
|
+
|
|
712
|
+
expect(ads).to.be.an('array').and.to.have.length(0);
|
|
713
|
+
});
|
|
714
|
+
|
|
715
|
+
it('should return no ad when given a valid server response and no server request', function () {
|
|
716
|
+
const serverRequest = undefined;
|
|
717
|
+
|
|
718
|
+
const serverResponse = examples.serverResponse_banner;
|
|
719
|
+
|
|
720
|
+
const ads = spec.interpretResponse(serverResponse, serverRequest);
|
|
721
|
+
|
|
722
|
+
expect(ads).to.be.an('array').and.to.have.length(0);
|
|
723
|
+
});
|
|
724
|
+
|
|
725
|
+
it('should return no ad when given a valid server response and an invalid server request', function () {
|
|
726
|
+
const serverRequest = 'bad_server_request';
|
|
727
|
+
|
|
728
|
+
const serverResponse = examples.serverResponse_banner;
|
|
729
|
+
|
|
730
|
+
const ads = spec.interpretResponse(serverResponse, serverRequest);
|
|
731
|
+
|
|
732
|
+
expect(ads).to.be.an('array').and.to.have.length(0);
|
|
733
|
+
});
|
|
734
|
+
|
|
735
|
+
it('should return no ad when given a valid server response and a server request without bid request', function () {
|
|
736
|
+
const serverRequest = utils.deepClone(examples.serverRequest_banner);
|
|
737
|
+
serverRequest.data = undefined;
|
|
738
|
+
|
|
739
|
+
const serverResponse = examples.serverResponse_banner;
|
|
740
|
+
|
|
741
|
+
const ads = spec.interpretResponse(serverResponse, serverRequest);
|
|
742
|
+
|
|
743
|
+
expect(ads).to.be.an('array').and.to.have.length(0);
|
|
744
|
+
});
|
|
745
|
+
|
|
746
|
+
it('should return no ad when given a valid server response and a server request with an invalid bid request', function () {
|
|
747
|
+
const serverRequest = utils.deepClone(examples.serverRequest_banner);
|
|
748
|
+
serverRequest.data = 'bad_bid_request';
|
|
749
|
+
|
|
750
|
+
const serverResponse = examples.serverResponse_banner;
|
|
751
|
+
|
|
752
|
+
const ads = spec.interpretResponse(serverResponse, serverRequest);
|
|
753
|
+
|
|
754
|
+
expect(ads).to.be.an('array').and.to.have.length(0);
|
|
755
|
+
});
|
|
756
|
+
|
|
757
|
+
it('should return no ad when given a valid server response and a server request without impression', function () {
|
|
758
|
+
const serverRequest = utils.deepClone(examples.serverRequest_banner);
|
|
759
|
+
serverRequest.data.imp = undefined;
|
|
760
|
+
|
|
761
|
+
const serverResponse = examples.serverResponse_banner;
|
|
762
|
+
|
|
763
|
+
const ads = spec.interpretResponse(serverResponse, serverRequest);
|
|
764
|
+
|
|
765
|
+
expect(ads).to.be.an('array').and.to.have.length(0);
|
|
766
|
+
});
|
|
767
|
+
|
|
768
|
+
it('should return no ad when given a valid server response and a server request with an invalid impression field', function () {
|
|
769
|
+
const serverRequest = utils.deepClone(examples.serverRequest_banner);
|
|
770
|
+
serverRequest.data.imp = 'invalid_impressions';
|
|
771
|
+
|
|
772
|
+
const serverResponse = examples.serverResponse_banner;
|
|
773
|
+
|
|
774
|
+
const ads = spec.interpretResponse(serverResponse, serverRequest);
|
|
775
|
+
|
|
776
|
+
expect(ads).to.be.an('array').and.to.have.length(0);
|
|
777
|
+
});
|
|
778
|
+
});
|
|
779
|
+
|
|
780
|
+
describe('Banner', function () {
|
|
781
|
+
it('should return an ad when given a valid server response with one bid', function () {
|
|
782
|
+
const serverRequest = examples.serverRequest_banner;
|
|
783
|
+
|
|
784
|
+
const serverResponse = examples.serverResponse_banner;
|
|
785
|
+
|
|
786
|
+
const ads = spec.interpretResponse(serverResponse, serverRequest);
|
|
787
|
+
|
|
788
|
+
expect(ads).to.be.an('array').and.to.have.length(1);
|
|
789
|
+
expect(ads[0].adUrl).to.equal(null);
|
|
790
|
+
expect(ads[0].creativeId).to.exist.and.to.be.a('string').and.to.equal(serverResponse.body.seatbid[0].bid[0].crid);
|
|
791
|
+
expect(ads[0].cpm).to.exist.and.to.be.a('number').and.to.equal(serverResponse.body.seatbid[0].bid[0].price);
|
|
792
|
+
expect(ads[0].currency).to.exist.and.to.be.a('string').and.to.equal(serverResponse.body.cur);
|
|
793
|
+
expect(ads[0].netRevenue).to.exist.and.to.be.a('boolean').and.to.equal(true);
|
|
794
|
+
expect(ads[0].ttl).to.exist.and.to.be.a('number').and.to.equal(10);
|
|
795
|
+
expect(ads[0].height).to.exist.and.to.be.a('number').and.to.equal(serverResponse.body.seatbid[0].bid[0].h);
|
|
796
|
+
expect(ads[0].width).to.exist.and.to.be.a('number').and.to.equal(serverResponse.body.seatbid[0].bid[0].w);
|
|
797
|
+
expect(ads[0].mediaType).to.exist.and.to.be.a('string').and.to.equal('banner');
|
|
798
|
+
});
|
|
799
|
+
|
|
800
|
+
it('should return no ad when given a server response with a bid without height', function () {
|
|
801
|
+
const serverRequest = examples.serverRequest_banner;
|
|
802
|
+
|
|
803
|
+
const serverResponse = utils.deepClone(examples.serverResponse_banner);
|
|
804
|
+
serverResponse.body.seatbid[0].bid[0].h = undefined;
|
|
805
|
+
|
|
806
|
+
const ads = spec.interpretResponse(serverResponse, serverRequest);
|
|
807
|
+
|
|
808
|
+
expect(ads).to.be.an('array').and.to.have.length(0);
|
|
809
|
+
});
|
|
810
|
+
|
|
811
|
+
it('should return no ad when given a server response with a bid with an invalid height', function () {
|
|
812
|
+
const serverRequest = examples.serverRequest_banner;
|
|
813
|
+
|
|
814
|
+
const serverResponse = utils.deepClone(examples.serverResponse_banner);
|
|
815
|
+
serverResponse.body.seatbid[0].bid[0].h = {};
|
|
816
|
+
|
|
817
|
+
const ads = spec.interpretResponse(serverResponse, serverRequest);
|
|
818
|
+
|
|
819
|
+
expect(ads).to.be.an('array').and.to.have.length(0);
|
|
820
|
+
});
|
|
821
|
+
|
|
822
|
+
it('should return no ad when given a server response with a bid without width', function () {
|
|
823
|
+
const serverRequest = examples.serverRequest_banner;
|
|
824
|
+
|
|
825
|
+
const serverResponse = utils.deepClone(examples.serverResponse_banner);
|
|
826
|
+
serverResponse.body.seatbid[0].bid[0].w = undefined;
|
|
827
|
+
|
|
828
|
+
const ads = spec.interpretResponse(serverResponse, serverRequest);
|
|
829
|
+
|
|
830
|
+
expect(ads).to.be.an('array').and.to.have.length(0);
|
|
831
|
+
});
|
|
832
|
+
|
|
833
|
+
it('should return no ad when given a server response with a bid with an invalid width', function () {
|
|
834
|
+
const serverRequest = examples.serverRequest_banner;
|
|
835
|
+
|
|
836
|
+
const serverResponse = utils.deepClone(examples.serverResponse_banner);
|
|
837
|
+
serverResponse.body.seatbid[0].bid[0].w = {};
|
|
838
|
+
|
|
839
|
+
const ads = spec.interpretResponse(serverResponse, serverRequest);
|
|
840
|
+
|
|
841
|
+
expect(ads).to.be.an('array').and.to.have.length(0);
|
|
842
|
+
});
|
|
843
|
+
});
|
|
844
|
+
});
|
|
845
|
+
});
|