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,399 @@
|
|
|
1
|
+
import { expect } from 'chai';
|
|
2
|
+
import {
|
|
3
|
+
BIDDER_CODE,
|
|
4
|
+
BIDDER_ENDPOINT_URL,
|
|
5
|
+
spec, USERSYNC_URL,
|
|
6
|
+
getBidFloor
|
|
7
|
+
} from 'modules/deltaprojectsBidAdapter.js';
|
|
8
|
+
|
|
9
|
+
const BID_REQ_REFER = 'http://example.com/page?param=val';
|
|
10
|
+
|
|
11
|
+
describe('deltaprojectsBidAdapter', function() {
|
|
12
|
+
describe('isBidRequestValid', function () {
|
|
13
|
+
function makeBid() {
|
|
14
|
+
return {
|
|
15
|
+
bidder: BIDDER_CODE,
|
|
16
|
+
params: {
|
|
17
|
+
publisherId: '12345'
|
|
18
|
+
},
|
|
19
|
+
adUnitCode: 'adunit-code',
|
|
20
|
+
sizes: [
|
|
21
|
+
[300, 250],
|
|
22
|
+
],
|
|
23
|
+
bidId: '30b31c1838de1e',
|
|
24
|
+
bidderRequestId: '22edbae2733bf6',
|
|
25
|
+
auctionId: '1d1a030790a475',
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
it('should return true when bidder set correctly', function () {
|
|
30
|
+
expect(spec.isBidRequestValid(makeBid())).to.equal(true);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('should return false when bid request is null', function () {
|
|
34
|
+
expect(spec.isBidRequestValid(undefined)).to.equal(false);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('should return false when bidder not set correctly', function () {
|
|
38
|
+
let bid = makeBid();
|
|
39
|
+
delete bid.bidder;
|
|
40
|
+
expect(spec.isBidRequestValid(bid)).to.equal(false);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('should return false when publisher id is not set', function () {
|
|
44
|
+
let bid = makeBid();
|
|
45
|
+
delete bid.params.publisherId;
|
|
46
|
+
expect(spec.isBidRequestValid(bid)).to.equal(false);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
describe('buildRequests', function () {
|
|
51
|
+
const BIDREQ = {
|
|
52
|
+
bidder: BIDDER_CODE,
|
|
53
|
+
params: {
|
|
54
|
+
tagId: '403370',
|
|
55
|
+
siteId: 'example.com',
|
|
56
|
+
},
|
|
57
|
+
sizes: [
|
|
58
|
+
[300, 250],
|
|
59
|
+
],
|
|
60
|
+
bidId: '30b31c1838de1e',
|
|
61
|
+
bidderRequestId: '22edbae2733bf6',
|
|
62
|
+
auctionId: '1d1a030790a475',
|
|
63
|
+
}
|
|
64
|
+
const bidRequests = [BIDREQ];
|
|
65
|
+
const bannerRequest = spec.buildRequests(bidRequests, {refererInfo: { referer: BID_REQ_REFER }})[0];
|
|
66
|
+
const bannerRequestBody = bannerRequest.data;
|
|
67
|
+
|
|
68
|
+
it('send bid request with test tag if it is set in the param', function () {
|
|
69
|
+
const TEST_TAG = 1;
|
|
70
|
+
const bidRequest = Object.assign({}, BIDREQ, {
|
|
71
|
+
params: { ...BIDREQ.params, test: TEST_TAG },
|
|
72
|
+
});
|
|
73
|
+
const bidderRequest = { refererInfo: { referer: BID_REQ_REFER } };
|
|
74
|
+
const request = spec.buildRequests([bidRequest], bidderRequest)[0];
|
|
75
|
+
expect(request.data.test).to.equal(TEST_TAG);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('send bid request with correct timeout', function () {
|
|
79
|
+
const TMAX = 10;
|
|
80
|
+
const bidderRequest = { refererInfo: { referer: BID_REQ_REFER }, timeout: TMAX };
|
|
81
|
+
const request = spec.buildRequests(bidRequests, bidderRequest)[0];
|
|
82
|
+
expect(request.data.tmax).to.equal(TMAX);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('send bid request to the correct endpoint URL', function () {
|
|
86
|
+
expect(bannerRequest.url).to.equal(BIDDER_ENDPOINT_URL);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('sends bid request to our endpoint via POST', function () {
|
|
90
|
+
expect(bannerRequest.method).to.equal('POST');
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('sends screen dimensions', function () {
|
|
94
|
+
expect(bannerRequestBody.device.w).to.equal(screen.width);
|
|
95
|
+
expect(bannerRequestBody.device.h).to.equal(screen.height);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it('includes the ad size in the bid request', function () {
|
|
99
|
+
expect(bannerRequestBody.imp[0].banner.format[0].w).to.equal(BIDREQ.sizes[0][0]);
|
|
100
|
+
expect(bannerRequestBody.imp[0].banner.format[0].h).to.equal(BIDREQ.sizes[0][1]);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('sets domain and href correctly', function () {
|
|
104
|
+
expect(bannerRequestBody.site.domain).to.equal(BIDREQ.params.siteId);
|
|
105
|
+
expect(bannerRequestBody.site.page).to.equal(BID_REQ_REFER);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
const gdprBidRequests = [{
|
|
109
|
+
bidder: BIDDER_CODE,
|
|
110
|
+
params: {
|
|
111
|
+
tagId: '403370',
|
|
112
|
+
siteId: 'example.com'
|
|
113
|
+
},
|
|
114
|
+
sizes: [
|
|
115
|
+
[300, 250]
|
|
116
|
+
],
|
|
117
|
+
bidId: '30b31c1838de1e',
|
|
118
|
+
bidderRequestId: '22edbae2733bf6',
|
|
119
|
+
auctionId: '1d1a030790a475'
|
|
120
|
+
}];
|
|
121
|
+
const consentString = 'BOJ/P2HOJ/P2HABABMAAAAAZ+A==';
|
|
122
|
+
|
|
123
|
+
const GDPR_REQ_REFERER = 'http://localhost:9876/'
|
|
124
|
+
function getGdprRequestBody(gdprApplies, consentString) {
|
|
125
|
+
const gdprRequest = spec.buildRequests(gdprBidRequests, {
|
|
126
|
+
gdprConsent: {
|
|
127
|
+
gdprApplies: gdprApplies,
|
|
128
|
+
consentString: consentString,
|
|
129
|
+
},
|
|
130
|
+
refererInfo: {
|
|
131
|
+
referer: GDPR_REQ_REFERER,
|
|
132
|
+
},
|
|
133
|
+
})[0];
|
|
134
|
+
return gdprRequest.data;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
it('should handle gdpr applies being present and true', function() {
|
|
138
|
+
const gdprRequestBody = getGdprRequestBody(true, consentString);
|
|
139
|
+
expect(gdprRequestBody.regs.ext.gdpr).to.equal(1);
|
|
140
|
+
expect(gdprRequestBody.user.ext.consent).to.equal(consentString);
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
it('should handle gdpr applies being present and false', function() {
|
|
144
|
+
const gdprRequestBody = getGdprRequestBody(false, consentString);
|
|
145
|
+
expect(gdprRequestBody.regs.ext.gdpr).to.equal(0);
|
|
146
|
+
expect(gdprRequestBody.user.ext.consent).to.equal(consentString);
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
it('should handle gdpr applies being undefined', function() {
|
|
150
|
+
const gdprRequestBody = getGdprRequestBody(undefined, consentString);
|
|
151
|
+
expect(gdprRequestBody.regs).to.deep.equal({ext: {}});
|
|
152
|
+
expect(gdprRequestBody.user.ext.consent).to.equal(consentString);
|
|
153
|
+
})
|
|
154
|
+
|
|
155
|
+
it('should handle gdpr consent being undefined', function() {
|
|
156
|
+
const gdprRequest = spec.buildRequests(gdprBidRequests, {refererInfo: { referer: GDPR_REQ_REFERER }})[0];
|
|
157
|
+
const gdprRequestBody = gdprRequest.data;
|
|
158
|
+
expect(gdprRequestBody.regs).to.deep.equal({ ext: {} });
|
|
159
|
+
expect(gdprRequestBody.user).to.deep.equal({ ext: {} });
|
|
160
|
+
})
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
describe('interpretResponse', function () {
|
|
164
|
+
const bidRequests = [
|
|
165
|
+
{
|
|
166
|
+
bidder: BIDDER_CODE,
|
|
167
|
+
params: {
|
|
168
|
+
tagId: '403370',
|
|
169
|
+
siteId: 'example.com',
|
|
170
|
+
currency: 'USD',
|
|
171
|
+
},
|
|
172
|
+
sizes: [
|
|
173
|
+
[300, 250],
|
|
174
|
+
],
|
|
175
|
+
bidId: '30b31c1838de1e',
|
|
176
|
+
bidderRequestId: '22edbae2733bf6',
|
|
177
|
+
auctionId: '1d1a030790a475',
|
|
178
|
+
},
|
|
179
|
+
];
|
|
180
|
+
const request = spec.buildRequests(bidRequests, {refererInfo: { referer: BID_REQ_REFER }})[0];
|
|
181
|
+
function makeResponse() {
|
|
182
|
+
return {
|
|
183
|
+
body: {
|
|
184
|
+
id: '5e5c23a5ba71e78',
|
|
185
|
+
seatbid: [
|
|
186
|
+
{
|
|
187
|
+
bid: [
|
|
188
|
+
{
|
|
189
|
+
id: '6vmb3isptf',
|
|
190
|
+
crid: 'deltaprojectscreative',
|
|
191
|
+
impid: '322add653672f68',
|
|
192
|
+
price: 1.22,
|
|
193
|
+
adm: '<!-- creative -->',
|
|
194
|
+
attr: [5],
|
|
195
|
+
h: 90,
|
|
196
|
+
nurl: 'http://nurl',
|
|
197
|
+
w: 728,
|
|
198
|
+
}
|
|
199
|
+
],
|
|
200
|
+
seat: 'MOCK'
|
|
201
|
+
}
|
|
202
|
+
],
|
|
203
|
+
bidid: '5e5c23a5ba71e78',
|
|
204
|
+
cur: 'USD'
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
const expectedBid = {
|
|
209
|
+
requestId: '322add653672f68',
|
|
210
|
+
cpm: 1.22,
|
|
211
|
+
width: 728,
|
|
212
|
+
height: 90,
|
|
213
|
+
creativeId: 'deltaprojectscreative',
|
|
214
|
+
dealId: null,
|
|
215
|
+
currency: 'USD',
|
|
216
|
+
netRevenue: true,
|
|
217
|
+
mediaType: 'banner',
|
|
218
|
+
ttl: 60,
|
|
219
|
+
ad: '<!-- creative --><div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="http://nurl"></div>'
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
it('should get incorrect bid response if response body is missing', function () {
|
|
223
|
+
let response = makeResponse();
|
|
224
|
+
delete response.body;
|
|
225
|
+
let result = spec.interpretResponse(response, request);
|
|
226
|
+
expect(result.length).to.equal(0);
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
it('should get incorrect bid response if id or seat id of response body is missing', function () {
|
|
230
|
+
let response1 = makeResponse();
|
|
231
|
+
delete response1.body.id;
|
|
232
|
+
let result1 = spec.interpretResponse(response1, request);
|
|
233
|
+
expect(result1.length).to.equal(0);
|
|
234
|
+
|
|
235
|
+
let response2 = makeResponse();
|
|
236
|
+
delete response2.body.seatbid;
|
|
237
|
+
let result2 = spec.interpretResponse(response2, request);
|
|
238
|
+
expect(result2.length).to.equal(0);
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
it('should get the correct bid response', function () {
|
|
242
|
+
let result = spec.interpretResponse(makeResponse(), request);
|
|
243
|
+
expect(result.length).to.equal(1);
|
|
244
|
+
expect(result[0]).to.deep.equal(expectedBid);
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
it('should handle a missing crid', function () {
|
|
248
|
+
let noCridResponse = makeResponse();
|
|
249
|
+
delete noCridResponse.body.seatbid[0].bid[0].crid;
|
|
250
|
+
const fallbackCrid = noCridResponse.body.seatbid[0].bid[0].id;
|
|
251
|
+
let noCridResult = Object.assign({}, expectedBid, {'creativeId': fallbackCrid});
|
|
252
|
+
let result = spec.interpretResponse(noCridResponse, request);
|
|
253
|
+
expect(result.length).to.equal(1);
|
|
254
|
+
expect(result[0]).to.deep.equal(noCridResult);
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
it('should handle a missing nurl', function () {
|
|
258
|
+
let noNurlResponse = makeResponse();
|
|
259
|
+
delete noNurlResponse.body.seatbid[0].bid[0].nurl;
|
|
260
|
+
let noNurlResult = Object.assign({}, expectedBid);
|
|
261
|
+
noNurlResult.ad = '<!-- creative -->';
|
|
262
|
+
let result = spec.interpretResponse(noNurlResponse, request);
|
|
263
|
+
expect(result.length).to.equal(1);
|
|
264
|
+
expect(result[0]).to.deep.equal(noNurlResult);
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
it('handles empty bid response', function () {
|
|
268
|
+
let response = {
|
|
269
|
+
body: {
|
|
270
|
+
id: '5e5c23a5ba71e78',
|
|
271
|
+
seatbid: []
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
let result = spec.interpretResponse(response, request);
|
|
275
|
+
expect(result.length).to.equal(0);
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
it('should keep custom properties', () => {
|
|
279
|
+
const customProperties = {test: 'a test message', param: {testParam: 1}};
|
|
280
|
+
const expectedResult = Object.assign({}, expectedBid, {[spec.code]: customProperties});
|
|
281
|
+
const response = makeResponse();
|
|
282
|
+
response.body.seatbid[0].bid[0].ext = customProperties;
|
|
283
|
+
const result = spec.interpretResponse(response, request);
|
|
284
|
+
expect(result.length).to.equal(1);
|
|
285
|
+
expect(result[0]).to.deep.equal(expectedResult);
|
|
286
|
+
});
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
describe('onBidWon', function () {
|
|
290
|
+
const OPEN_RTB_RESP = {
|
|
291
|
+
body: {
|
|
292
|
+
id: 'abc',
|
|
293
|
+
seatbid: [
|
|
294
|
+
{
|
|
295
|
+
bid: [
|
|
296
|
+
{
|
|
297
|
+
'id': 'abc*123*456',
|
|
298
|
+
'impid': 'xxxxxxx',
|
|
299
|
+
'price': 46.657196,
|
|
300
|
+
'adm': '<iframe id="dsp_iframe_228285197" src="https//abc/${AUCTION_PRICE:B64}&creative_id=123"></script>',
|
|
301
|
+
'adomain': ['deltaprojects.com'],
|
|
302
|
+
'h': 600,
|
|
303
|
+
'w': 300,
|
|
304
|
+
'cid': '868253',
|
|
305
|
+
'crid': '732935',
|
|
306
|
+
'cat': [],
|
|
307
|
+
},
|
|
308
|
+
],
|
|
309
|
+
'seat': '2147483647',
|
|
310
|
+
},
|
|
311
|
+
],
|
|
312
|
+
bidid: 'xyz',
|
|
313
|
+
cur: 'USD',
|
|
314
|
+
},
|
|
315
|
+
}
|
|
316
|
+
it('should replace auction price macro', () => {
|
|
317
|
+
const bid = spec.interpretResponse(OPEN_RTB_RESP)[0];
|
|
318
|
+
spec.onBidWon(bid);
|
|
319
|
+
expect(bid.ad).to.contains(`${Math.round(bid.cpm * 1000000)}`);
|
|
320
|
+
});
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
describe('getUserSyncs', function () {
|
|
324
|
+
it('should not do user sync when pixel is disabled', () => {
|
|
325
|
+
const syncOptions = { pixelEnabled: false }
|
|
326
|
+
const result = spec.getUserSyncs(syncOptions)
|
|
327
|
+
expect(result.length).to.equal(0);
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
it('should do user sync without gdpr params when gdprConsent missing', () => {
|
|
331
|
+
const syncOptions = { pixelEnabled: true }
|
|
332
|
+
const gdprConsent = undefined
|
|
333
|
+
const result = spec.getUserSyncs(syncOptions, gdprConsent)
|
|
334
|
+
expect(result[0].url).to.equal(USERSYNC_URL);
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
it('should do user sync with gdpr params when gdprConsent exists', () => {
|
|
338
|
+
const syncOptions = { pixelEnabled: true }
|
|
339
|
+
const gdprConsent = {
|
|
340
|
+
gdprApplies: true,
|
|
341
|
+
consentString: 'ABCABCABC'
|
|
342
|
+
}
|
|
343
|
+
const expectedResult1 = USERSYNC_URL + `?gdpr=${Number(gdprConsent.gdprApplies)}&gdpr_consent=${gdprConsent.consentString}`
|
|
344
|
+
const result1 = spec.getUserSyncs(syncOptions, {}, gdprConsent)
|
|
345
|
+
expect(result1[0].url).to.equal(expectedResult1);
|
|
346
|
+
|
|
347
|
+
delete gdprConsent.gdprApplies
|
|
348
|
+
const result2 = spec.getUserSyncs(syncOptions, {}, gdprConsent)
|
|
349
|
+
const expectedResult2 = USERSYNC_URL + `?gdpr_consent=${gdprConsent.consentString}`
|
|
350
|
+
expect(result2[0].url).to.equal(expectedResult2);
|
|
351
|
+
});
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
describe('getBidFloor', () => {
|
|
355
|
+
it('should not get bid floor when getFloor is not defined', () => {
|
|
356
|
+
const bid = {};
|
|
357
|
+
const currency = 'SEK';
|
|
358
|
+
const result = getBidFloor(bid, 'banner', '*', currency);
|
|
359
|
+
expect(result).to.be.undefined;
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
it('should not get bid floor when getFloor is not a function', () => {
|
|
363
|
+
const bid = { getFloor: 1.0 };
|
|
364
|
+
const currency = 'SEK';
|
|
365
|
+
const result = getBidFloor(bid, 'banner', '*', currency);
|
|
366
|
+
expect(result).to.be.undefined;
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
it('should not get bid floor when getFloor return empty', () => {
|
|
370
|
+
const bid = { getFloor: () => ({}) };
|
|
371
|
+
const currency = 'SEK';
|
|
372
|
+
const result = getBidFloor(bid, 'banner', '*', currency);
|
|
373
|
+
expect(result).to.be.undefined;
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
it('should not get bid floor in SEK when floor is not a number', () => {
|
|
377
|
+
const bid = { getFloor: () => ({ currency: 'SEK', floor: '1.0' }) };
|
|
378
|
+
const currency = 'SEK';
|
|
379
|
+
const result = getBidFloor(bid, 'banner', '*', currency);
|
|
380
|
+
expect(result).to.be.undefined;
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
it('should get bid floor in USD when currency is not defined', () => {
|
|
384
|
+
const bid = { getFloor: () => ({ currency: 'USD', floor: 1.0 }) };
|
|
385
|
+
const currency = undefined;
|
|
386
|
+
const result = getBidFloor(bid, 'banner', '*', currency);
|
|
387
|
+
expect(result.floor).to.equal(1.0);
|
|
388
|
+
expect(result.currency).to.equal('USD');
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
it('should get bid floor in SEK when currency is SEK', () => {
|
|
392
|
+
const bid = { getFloor: () => ({ currency: 'SEK', floor: 1.0 }) };
|
|
393
|
+
const currency = 'SEK';
|
|
394
|
+
const result = getBidFloor(bid, 'banner', '*', currency);
|
|
395
|
+
expect(result.floor).to.equal(1.0);
|
|
396
|
+
expect(result.currency).to.equal('SEK');
|
|
397
|
+
});
|
|
398
|
+
});
|
|
399
|
+
});
|
|
@@ -432,6 +432,16 @@ describe('emx_digital Adapter', function () {
|
|
|
432
432
|
});
|
|
433
433
|
});
|
|
434
434
|
|
|
435
|
+
it('should add gpid to request if present', () => {
|
|
436
|
+
const gpid = '/12345/my-gpt-tag-0';
|
|
437
|
+
let bid = utils.deepClone(bidderRequest.bids[0]);
|
|
438
|
+
bid.ortb2Imp = { ext: { data: { adserver: { adslot: gpid } } } };
|
|
439
|
+
bid.ortb2Imp = { ext: { data: { pbadslot: gpid } } };
|
|
440
|
+
let requestWithGPID = spec.buildRequests([bid], bidderRequest);
|
|
441
|
+
requestWithGPID = JSON.parse(requestWithGPID.data);
|
|
442
|
+
expect(requestWithGPID.imp[0].ext.gpid).to.exist.and.equal(gpid);
|
|
443
|
+
});
|
|
444
|
+
|
|
435
445
|
it('should add UID 2.0 to request', () => {
|
|
436
446
|
const uid2 = { id: '456' };
|
|
437
447
|
const bidRequestWithUID = utils.deepClone(bidderRequest);
|