prebid.js 6.8.0 → 6.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +8 -1
- package/integrationExamples/gpt/weboramaRtdProvider_example.html +154 -115
- package/integrationExamples/gpt/x-domain/creative.html +13 -6
- package/modules/appnexusBidAdapter.js +3 -2
- package/modules/asealBidAdapter.js +58 -0
- package/modules/asealBidAdapter.md +52 -0
- package/modules/conversantBidAdapter.js +7 -0
- package/modules/improvedigitalBidAdapter.js +5 -0
- package/modules/lunamediahbBidAdapter.js +32 -4
- package/modules/oguryBidAdapter.js +6 -13
- package/modules/priceFloors.js +2 -1
- package/modules/richaudienceBidAdapter.js +7 -2
- package/modules/riseBidAdapter.js +17 -6
- package/modules/rubiconAnalyticsAdapter.js +5 -0
- package/modules/sortableAnalyticsAdapter.js +5 -4
- package/modules/weboramaRtdProvider.js +264 -34
- package/modules/weboramaRtdProvider.md +110 -40
- package/package.json +2 -1
- package/src/adloader.js +2 -1
- package/src/auction.js +59 -64
- package/src/bidderSettings.js +69 -0
- package/src/secureCreatives.js +26 -12
- package/src/targeting.js +3 -2
- package/src/utils.js +0 -7
- package/test/spec/auctionmanager_spec.js +33 -1
- package/test/spec/modules/asealBidAdapter_spec.js +144 -0
- package/test/spec/modules/conversantBidAdapter_spec.js +54 -2
- package/test/spec/modules/improvedigitalBidAdapter_spec.js +19 -0
- package/test/spec/modules/lunamediahbBidAdapter_spec.js +27 -1
- package/test/spec/modules/oguryBidAdapter_spec.js +62 -4
- package/test/spec/modules/riseBidAdapter_spec.js +30 -4
- package/test/spec/modules/rubiconAnalyticsAdapter_spec.js +31 -1
- package/test/spec/modules/sortableAnalyticsAdapter_spec.js +2 -3
- package/test/spec/modules/weboramaRtdProvider_spec.js +536 -20
- package/test/spec/unit/core/bidderSettings_spec.js +123 -0
- package/test/spec/unit/pbjs_api_spec.js +1 -6
- package/test/spec/unit/secureCreatives_spec.js +66 -32
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { expect } from 'chai';
|
|
2
|
+
import { spec, BIDDER_CODE, API_ENDPOINT, HEADER_AOTTER_VERSION } from 'modules/asealBidAdapter.js';
|
|
3
|
+
import { newBidder } from 'src/adapters/bidderFactory.js';
|
|
4
|
+
import { config } from 'src/config.js';
|
|
5
|
+
|
|
6
|
+
const TEST_CLIENT_ID = 'TEST_CLIENT_ID'
|
|
7
|
+
|
|
8
|
+
describe('asealBidAdapter', () => {
|
|
9
|
+
const adapter = newBidder(spec);
|
|
10
|
+
|
|
11
|
+
describe('inherited functions', () => {
|
|
12
|
+
it('exists and is a function', () => {
|
|
13
|
+
expect(adapter.callBids).to.exist.and.to.be.a('function')
|
|
14
|
+
})
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
describe('isBidRequestValid', () => {
|
|
18
|
+
const bid = {
|
|
19
|
+
bidder: 'aseal',
|
|
20
|
+
params: {
|
|
21
|
+
placeUid: '123'
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
it('should return true when required params found', () => {
|
|
26
|
+
expect(spec.isBidRequestValid(bid)).to.equal(true)
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('should return false when required param placeUid is not passed', () => {
|
|
30
|
+
bid.params = {
|
|
31
|
+
placeUid: ''
|
|
32
|
+
}
|
|
33
|
+
expect(spec.isBidRequestValid(bid)).to.equal(false)
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('should return false when required param placeUid is wrong type', () => {
|
|
37
|
+
bid.params = {
|
|
38
|
+
placeUid: null
|
|
39
|
+
}
|
|
40
|
+
expect(spec.isBidRequestValid(bid)).to.equal(false)
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('should return false when required params are not passed', () => {
|
|
44
|
+
let bid = Object.assign({}, bid);
|
|
45
|
+
delete bid.params;
|
|
46
|
+
bid.params = {};
|
|
47
|
+
expect(spec.isBidRequestValid(bid)).to.equal(false)
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
describe('buildRequests', () => {
|
|
52
|
+
afterEach(() => {
|
|
53
|
+
config.resetConfig();
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('should return an empty array when there are no bid requests', () => {
|
|
57
|
+
const bidRequests = []
|
|
58
|
+
const request = spec.buildRequests(bidRequests)
|
|
59
|
+
|
|
60
|
+
expect(request).to.be.an('array').that.is.empty
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('should send `x-aotter-clientid` header as empty string when user not set config `clientId`', () => {
|
|
64
|
+
const bidRequests = [{
|
|
65
|
+
bidder: BIDDER_CODE,
|
|
66
|
+
params: {
|
|
67
|
+
placeUid: '123'
|
|
68
|
+
}
|
|
69
|
+
}]
|
|
70
|
+
|
|
71
|
+
const bidderRequest = {}
|
|
72
|
+
const request = spec.buildRequests(bidRequests, bidderRequest)[0];
|
|
73
|
+
|
|
74
|
+
expect(request.options.customHeaders['x-aotter-clientid']).equal('')
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
it('should send bid requests to ENDPOINT via POST', () => {
|
|
78
|
+
const bidRequests = [{
|
|
79
|
+
bidder: BIDDER_CODE,
|
|
80
|
+
params: {
|
|
81
|
+
placeUid: '123'
|
|
82
|
+
}
|
|
83
|
+
}]
|
|
84
|
+
|
|
85
|
+
const bidderRequest = {
|
|
86
|
+
refererInfo: {
|
|
87
|
+
referer: 'https://aseal.in/',
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
config.setConfig({
|
|
92
|
+
aseal: {
|
|
93
|
+
clientId: TEST_CLIENT_ID
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
const request = spec.buildRequests(bidRequests, bidderRequest)[0];
|
|
97
|
+
|
|
98
|
+
expect(request.url).to.equal(API_ENDPOINT);
|
|
99
|
+
expect(request.method).to.equal('POST')
|
|
100
|
+
expect(request.options).deep.equal({
|
|
101
|
+
contentType: 'application/json',
|
|
102
|
+
withCredentials: true,
|
|
103
|
+
customHeaders: {
|
|
104
|
+
'x-aotter-clientid': TEST_CLIENT_ID,
|
|
105
|
+
'x-aotter-version': HEADER_AOTTER_VERSION,
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
expect(request.data).deep.equal({
|
|
109
|
+
bids: bidRequests,
|
|
110
|
+
refererInfo: bidderRequest.refererInfo,
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
describe('interpretResponse', () => {
|
|
116
|
+
it('should return an empty array when there are no bids', () => {
|
|
117
|
+
const serverResponse = {}
|
|
118
|
+
const response = spec.interpretResponse(serverResponse);
|
|
119
|
+
|
|
120
|
+
expect(response).is.an('array').that.is.empty;
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it('should get correct bid response', () => {
|
|
124
|
+
const serverResponse = {
|
|
125
|
+
body: [{
|
|
126
|
+
requestId: '2ef08f145b7a4f',
|
|
127
|
+
cpm: 3,
|
|
128
|
+
width: 300,
|
|
129
|
+
height: 250,
|
|
130
|
+
creativeId: '123abc',
|
|
131
|
+
dealId: '123abc',
|
|
132
|
+
currency: 'USD',
|
|
133
|
+
netRevenue: false,
|
|
134
|
+
mediaType: 'banner',
|
|
135
|
+
ttl: 300,
|
|
136
|
+
ad: '<!-- adtag -->'
|
|
137
|
+
}]
|
|
138
|
+
}
|
|
139
|
+
const response = spec.interpretResponse(serverResponse);
|
|
140
|
+
|
|
141
|
+
expect(response).deep.equal(serverResponse.body);
|
|
142
|
+
});
|
|
143
|
+
})
|
|
144
|
+
});
|
|
@@ -2,6 +2,7 @@ import {expect} from 'chai';
|
|
|
2
2
|
import {spec, storage} from 'modules/conversantBidAdapter.js';
|
|
3
3
|
import * as utils from 'src/utils.js';
|
|
4
4
|
import {createEidsArray} from 'modules/userId/eids.js';
|
|
5
|
+
import { config } from '../../../src/config.js';
|
|
5
6
|
|
|
6
7
|
describe('Conversant adapter tests', function() {
|
|
7
8
|
const siteId = '108060';
|
|
@@ -119,7 +120,34 @@ describe('Conversant adapter tests', function() {
|
|
|
119
120
|
bidId: 'bid005',
|
|
120
121
|
bidderRequestId: '117d765b87bed38',
|
|
121
122
|
auctionId: 'req000'
|
|
122
|
-
}
|
|
123
|
+
},
|
|
124
|
+
// video with first party data
|
|
125
|
+
{
|
|
126
|
+
bidder: 'conversant',
|
|
127
|
+
params: {
|
|
128
|
+
site_id: siteId
|
|
129
|
+
},
|
|
130
|
+
mediaTypes: {
|
|
131
|
+
video: {
|
|
132
|
+
context: 'instream',
|
|
133
|
+
mimes: ['video/mp4', 'video/x-flv']
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
ortb2Imp: {
|
|
137
|
+
instl: 1,
|
|
138
|
+
ext: {
|
|
139
|
+
data: {
|
|
140
|
+
pbadslot: 'homepage-top-rect'
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
placementCode: 'pcode006',
|
|
145
|
+
transactionId: 'tx006',
|
|
146
|
+
bidId: 'bid006',
|
|
147
|
+
bidderRequestId: '117d765b87bed38',
|
|
148
|
+
auctionId: 'req000'
|
|
149
|
+
}
|
|
150
|
+
];
|
|
123
151
|
|
|
124
152
|
const bidResponses = {
|
|
125
153
|
body: {
|
|
@@ -216,7 +244,7 @@ describe('Conversant adapter tests', function() {
|
|
|
216
244
|
expect(payload).to.have.property('id', 'req000');
|
|
217
245
|
expect(payload).to.have.property('at', 1);
|
|
218
246
|
expect(payload).to.have.property('imp');
|
|
219
|
-
expect(payload.imp).to.be.an('array').with.lengthOf(
|
|
247
|
+
expect(payload.imp).to.be.an('array').with.lengthOf(7);
|
|
220
248
|
|
|
221
249
|
expect(payload.imp[0]).to.have.property('id', 'bid000');
|
|
222
250
|
expect(payload.imp[0]).to.have.property('secure', 1);
|
|
@@ -306,6 +334,16 @@ describe('Conversant adapter tests', function() {
|
|
|
306
334
|
expect(payload.imp[5].video).to.not.have.property('maxduration');
|
|
307
335
|
expect(payload.imp[5]).to.not.have.property('banner');
|
|
308
336
|
|
|
337
|
+
expect(payload.imp[6]).to.have.property('id', 'bid006');
|
|
338
|
+
expect(payload.imp[6]).to.have.property('video');
|
|
339
|
+
expect(payload.imp[6].video).to.have.property('mimes');
|
|
340
|
+
expect(payload.imp[6].video.mimes).to.deep.equal(['video/mp4', 'video/x-flv']);
|
|
341
|
+
expect(payload.imp[6]).to.not.have.property('banner');
|
|
342
|
+
expect(payload.imp[6]).to.have.property('instl');
|
|
343
|
+
expect(payload.imp[6]).to.have.property('ext');
|
|
344
|
+
expect(payload.imp[6].ext).to.have.property('data');
|
|
345
|
+
expect(payload.imp[6].ext.data).to.have.property('pbadslot');
|
|
346
|
+
|
|
309
347
|
expect(payload).to.have.property('site');
|
|
310
348
|
expect(payload.site).to.have.property('id', siteId);
|
|
311
349
|
expect(payload.site).to.have.property('mobile').that.is.oneOf([0, 1]);
|
|
@@ -321,6 +359,20 @@ describe('Conversant adapter tests', function() {
|
|
|
321
359
|
expect(payload).to.not.have.property('user'); // there should be no user by default
|
|
322
360
|
});
|
|
323
361
|
|
|
362
|
+
it('Verify first party data', () => {
|
|
363
|
+
const bidderRequest = {refererInfo: {referer: 'http://test.com?a=b&c=123'}};
|
|
364
|
+
const cfg = {ortb2: {site: {content: {series: 'MySeries', season: 'MySeason', episode: 3, title: 'MyTitle'}}}};
|
|
365
|
+
config.setConfig(cfg);
|
|
366
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
367
|
+
const payload = request.data;
|
|
368
|
+
expect(payload.site).to.have.property('content');
|
|
369
|
+
expect(payload.site.content).to.have.property('series');
|
|
370
|
+
expect(payload.site.content).to.have.property('season');
|
|
371
|
+
expect(payload.site.content).to.have.property('episode');
|
|
372
|
+
expect(payload.site.content).to.have.property('title');
|
|
373
|
+
config.resetConfig();
|
|
374
|
+
});
|
|
375
|
+
|
|
324
376
|
it('Verify override url', function() {
|
|
325
377
|
const testUrl = 'https://someurl?name=value';
|
|
326
378
|
const request = spec.buildRequests([{params: {white_label_url: testUrl}}]);
|
|
@@ -557,6 +557,25 @@ describe('Improve Digital Adapter Tests', function () {
|
|
|
557
557
|
]
|
|
558
558
|
);
|
|
559
559
|
});
|
|
560
|
+
|
|
561
|
+
it('should set coppa', function() {
|
|
562
|
+
sinon.stub(config, 'getConfig')
|
|
563
|
+
.withArgs('coppa')
|
|
564
|
+
.returns(true);
|
|
565
|
+
const bidRequest = Object.assign({}, simpleBidRequest);
|
|
566
|
+
const request = spec.buildRequests([bidRequest], bidderRequestReferrer)[0];
|
|
567
|
+
const params = JSON.parse(decodeURIComponent(request.data.substring(PARAM_PREFIX.length)));
|
|
568
|
+
expect(params.bid_request.coppa).to.equal(1);
|
|
569
|
+
|
|
570
|
+
config.getConfig.restore();
|
|
571
|
+
});
|
|
572
|
+
|
|
573
|
+
it('should undefined coppa', function() {
|
|
574
|
+
const bidRequest = Object.assign({}, simpleBidRequest);
|
|
575
|
+
const request = spec.buildRequests([bidRequest], bidderRequestReferrer)[0];
|
|
576
|
+
const params = JSON.parse(decodeURIComponent(request.data.substring(PARAM_PREFIX.length)));
|
|
577
|
+
expect(params.bid_request.coppa).to.equal(undefined);
|
|
578
|
+
});
|
|
560
579
|
});
|
|
561
580
|
|
|
562
581
|
const serverResponse = {
|
|
@@ -80,7 +80,7 @@ describe('LunamediaHBBidAdapter', function () {
|
|
|
80
80
|
expect(data).to.be.an('object');
|
|
81
81
|
let placement = data['placements'][0];
|
|
82
82
|
expect(placement).to.be.an('object');
|
|
83
|
-
expect(placement).to.have.keys('placementId', 'bidId', 'traffic', 'wPlayer', 'hPlayer', 'schain');
|
|
83
|
+
expect(placement).to.have.keys('placementId', 'bidId', 'traffic', 'wPlayer', 'hPlayer', 'schain', 'videoContext');
|
|
84
84
|
expect(placement.traffic).to.equal(VIDEO);
|
|
85
85
|
expect(placement.wPlayer).to.equal(playerSize[0]);
|
|
86
86
|
expect(placement.hPlayer).to.equal(playerSize[1]);
|
|
@@ -301,4 +301,30 @@ describe('LunamediaHBBidAdapter', function () {
|
|
|
301
301
|
expect(serverResponses).to.be.an('array').that.is.empty;
|
|
302
302
|
});
|
|
303
303
|
});
|
|
304
|
+
|
|
305
|
+
describe('getUserSyncs', function() {
|
|
306
|
+
it('Should return array of objects with proper sync config , include GDPR', function() {
|
|
307
|
+
const syncData = spec.getUserSyncs({}, {}, {
|
|
308
|
+
consentString: 'ALL',
|
|
309
|
+
gdprApplies: true,
|
|
310
|
+
}, {});
|
|
311
|
+
expect(syncData).to.be.an('array').which.is.not.empty;
|
|
312
|
+
expect(syncData[0]).to.be.an('object')
|
|
313
|
+
expect(syncData[0].type).to.be.a('string')
|
|
314
|
+
expect(syncData[0].type).to.equal('image')
|
|
315
|
+
expect(syncData[0].url).to.be.a('string')
|
|
316
|
+
expect(syncData[0].url).to.equal('https://cookie.lmgssp.com/image?pbjs=1&gdpr=1&gdpr_consent=ALL&coppa=0')
|
|
317
|
+
});
|
|
318
|
+
it('Should return array of objects with proper sync config , include CCPA', function() {
|
|
319
|
+
const syncData = spec.getUserSyncs({}, {}, {}, {
|
|
320
|
+
consentString: '1---'
|
|
321
|
+
});
|
|
322
|
+
expect(syncData).to.be.an('array').which.is.not.empty;
|
|
323
|
+
expect(syncData[0]).to.be.an('object')
|
|
324
|
+
expect(syncData[0].type).to.be.a('string')
|
|
325
|
+
expect(syncData[0].type).to.equal('image')
|
|
326
|
+
expect(syncData[0].url).to.be.a('string')
|
|
327
|
+
expect(syncData[0].url).to.equal('https://cookie.lmgssp.com/image?pbjs=1&ccpa_consent=1---&coppa=0')
|
|
328
|
+
});
|
|
329
|
+
});
|
|
304
330
|
});
|
|
@@ -271,7 +271,7 @@ describe('OguryBidAdapter', function () {
|
|
|
271
271
|
},
|
|
272
272
|
ext: {
|
|
273
273
|
prebidversion: '$prebid.version$',
|
|
274
|
-
adapterversion: '1.2.
|
|
274
|
+
adapterversion: '1.2.9'
|
|
275
275
|
}
|
|
276
276
|
};
|
|
277
277
|
|
|
@@ -300,7 +300,59 @@ describe('OguryBidAdapter', function () {
|
|
|
300
300
|
...expectedRequestObject,
|
|
301
301
|
regs: {
|
|
302
302
|
ext: {
|
|
303
|
-
gdpr:
|
|
303
|
+
gdpr: 0
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
user: {
|
|
307
|
+
ext: {
|
|
308
|
+
consent: ''
|
|
309
|
+
},
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
const validBidRequests = bidRequests
|
|
314
|
+
|
|
315
|
+
const request = spec.buildRequests(validBidRequests, bidderRequestWithoutGdpr);
|
|
316
|
+
expect(request.data).to.deep.equal(expectedRequestObjectWithoutGdpr);
|
|
317
|
+
expect(request.data.regs.ext.gdpr).to.be.a('number');
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
it('should not add gdpr infos if gdprConsent is undefined', () => {
|
|
321
|
+
const bidderRequestWithoutGdpr = {
|
|
322
|
+
...bidderRequest,
|
|
323
|
+
gdprConsent: undefined,
|
|
324
|
+
}
|
|
325
|
+
const expectedRequestObjectWithoutGdpr = {
|
|
326
|
+
...expectedRequestObject,
|
|
327
|
+
regs: {
|
|
328
|
+
ext: {
|
|
329
|
+
gdpr: 0
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
user: {
|
|
333
|
+
ext: {
|
|
334
|
+
consent: ''
|
|
335
|
+
},
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
const validBidRequests = bidRequests
|
|
340
|
+
|
|
341
|
+
const request = spec.buildRequests(validBidRequests, bidderRequestWithoutGdpr);
|
|
342
|
+
expect(request.data).to.deep.equal(expectedRequestObjectWithoutGdpr);
|
|
343
|
+
expect(request.data.regs.ext.gdpr).to.be.a('number');
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
it('should not add tcString and turn off gdpr-applies if consentString and gdprApplies are undefined', () => {
|
|
347
|
+
const bidderRequestWithoutGdpr = {
|
|
348
|
+
...bidderRequest,
|
|
349
|
+
gdprConsent: { consentString: undefined, gdprApplies: undefined },
|
|
350
|
+
}
|
|
351
|
+
const expectedRequestObjectWithoutGdpr = {
|
|
352
|
+
...expectedRequestObject,
|
|
353
|
+
regs: {
|
|
354
|
+
ext: {
|
|
355
|
+
gdpr: 0
|
|
304
356
|
},
|
|
305
357
|
},
|
|
306
358
|
user: {
|
|
@@ -430,7 +482,7 @@ describe('OguryBidAdapter', function () {
|
|
|
430
482
|
advertiserDomains: openRtbBidResponse.body.seatbid[0].bid[0].adomain
|
|
431
483
|
},
|
|
432
484
|
nurl: openRtbBidResponse.body.seatbid[0].bid[0].nurl,
|
|
433
|
-
adapterVersion: '1.2.
|
|
485
|
+
adapterVersion: '1.2.9',
|
|
434
486
|
prebidVersion: '$prebid.version$'
|
|
435
487
|
}, {
|
|
436
488
|
requestId: openRtbBidResponse.body.seatbid[0].bid[1].impid,
|
|
@@ -447,7 +499,7 @@ describe('OguryBidAdapter', function () {
|
|
|
447
499
|
advertiserDomains: openRtbBidResponse.body.seatbid[0].bid[1].adomain
|
|
448
500
|
},
|
|
449
501
|
nurl: openRtbBidResponse.body.seatbid[0].bid[1].nurl,
|
|
450
|
-
adapterVersion: '1.2.
|
|
502
|
+
adapterVersion: '1.2.9',
|
|
451
503
|
prebidVersion: '$prebid.version$'
|
|
452
504
|
}]
|
|
453
505
|
|
|
@@ -494,6 +546,11 @@ describe('OguryBidAdapter', function () {
|
|
|
494
546
|
expect(requests.length).to.equal(0);
|
|
495
547
|
})
|
|
496
548
|
|
|
549
|
+
it('Should not create nurl request if bid contains undefined nurl', function() {
|
|
550
|
+
spec.onBidWon({ nurl: undefined })
|
|
551
|
+
expect(requests.length).to.equal(0);
|
|
552
|
+
})
|
|
553
|
+
|
|
497
554
|
it('Should create nurl request if bid nurl', function() {
|
|
498
555
|
spec.onBidWon({ nurl })
|
|
499
556
|
expect(requests.length).to.equal(1);
|
|
@@ -569,6 +626,7 @@ describe('OguryBidAdapter', function () {
|
|
|
569
626
|
expect(requests.length).to.equal(1);
|
|
570
627
|
expect(requests[0].url).to.equal(TIMEOUT_URL);
|
|
571
628
|
expect(requests[0].method).to.equal('POST');
|
|
629
|
+
expect(JSON.parse(requests[0].requestBody).location).to.equal(window.location.href);
|
|
572
630
|
})
|
|
573
631
|
});
|
|
574
632
|
});
|
|
@@ -3,7 +3,7 @@ import { spec } from 'modules/riseBidAdapter.js';
|
|
|
3
3
|
import { newBidder } from 'src/adapters/bidderFactory.js';
|
|
4
4
|
import { config } from 'src/config.js';
|
|
5
5
|
import { VIDEO } from '../../../src/mediaTypes.js';
|
|
6
|
-
import
|
|
6
|
+
import * as utils from 'src/utils.js';
|
|
7
7
|
|
|
8
8
|
const ENDPOINT = 'https://hb.yellowblue.io/hb';
|
|
9
9
|
const TEST_ENDPOINT = 'https://hb.yellowblue.io/hb-test';
|
|
@@ -262,7 +262,7 @@ describe('riseAdapter', function () {
|
|
|
262
262
|
});
|
|
263
263
|
|
|
264
264
|
it('should set floor_price to getFloor.floor value if it is greater than params.floorPrice', function() {
|
|
265
|
-
const bid = deepClone(bidRequests[0]);
|
|
265
|
+
const bid = utils.deepClone(bidRequests[0]);
|
|
266
266
|
bid.getFloor = () => {
|
|
267
267
|
return {
|
|
268
268
|
currency: 'USD',
|
|
@@ -276,7 +276,7 @@ describe('riseAdapter', function () {
|
|
|
276
276
|
});
|
|
277
277
|
|
|
278
278
|
it('should set floor_price to params.floorPrice value if it is greater than getFloor.floor', function() {
|
|
279
|
-
const bid = deepClone(bidRequests[0]);
|
|
279
|
+
const bid = utils.deepClone(bidRequests[0]);
|
|
280
280
|
bid.getFloor = () => {
|
|
281
281
|
return {
|
|
282
282
|
currency: 'USD',
|
|
@@ -299,7 +299,8 @@ describe('riseAdapter', function () {
|
|
|
299
299
|
requestId: '21e12606d47ba7',
|
|
300
300
|
netRevenue: true,
|
|
301
301
|
currency: 'USD',
|
|
302
|
-
adomain: ['abc.com']
|
|
302
|
+
adomain: ['abc.com'],
|
|
303
|
+
nurl: 'http://example.com/win/1234',
|
|
303
304
|
};
|
|
304
305
|
|
|
305
306
|
it('should get correct bid response', function () {
|
|
@@ -315,6 +316,7 @@ describe('riseAdapter', function () {
|
|
|
315
316
|
ttl: TTL,
|
|
316
317
|
vastXml: '<VAST version="3.0"></VAST>',
|
|
317
318
|
mediaType: VIDEO,
|
|
319
|
+
nurl: 'http://example.com/win/1234',
|
|
318
320
|
meta: {
|
|
319
321
|
advertiserDomains: ['abc.com']
|
|
320
322
|
}
|
|
@@ -402,4 +404,28 @@ describe('riseAdapter', function () {
|
|
|
402
404
|
expect(syncs).to.deep.equal([]);
|
|
403
405
|
});
|
|
404
406
|
})
|
|
407
|
+
|
|
408
|
+
describe('onBidWon', function() {
|
|
409
|
+
beforeEach(function() {
|
|
410
|
+
sinon.stub(utils, 'triggerPixel');
|
|
411
|
+
});
|
|
412
|
+
afterEach(function() {
|
|
413
|
+
utils.triggerPixel.restore();
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
it('Should trigger pixel if bid nurl', function() {
|
|
417
|
+
const bid = {
|
|
418
|
+
'bidder': spec.code,
|
|
419
|
+
'adUnitCode': 'adunit-code',
|
|
420
|
+
'sizes': [['640', '480']],
|
|
421
|
+
'nurl': 'http://example.com/win/1234',
|
|
422
|
+
'params': {
|
|
423
|
+
'org': 'jdye8weeyirk00000001'
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
spec.onBidWon(bid);
|
|
428
|
+
expect(utils.triggerPixel.callCount).to.equal(1)
|
|
429
|
+
})
|
|
430
|
+
})
|
|
405
431
|
});
|
|
@@ -246,7 +246,7 @@ const MOCK = {
|
|
|
246
246
|
}
|
|
247
247
|
},
|
|
248
248
|
BID_REQUESTED: {
|
|
249
|
-
'
|
|
249
|
+
'bidderCode': 'rubicon',
|
|
250
250
|
'auctionId': '25c6d7f5-699a-4bfc-87c9-996f915341fa',
|
|
251
251
|
'bidderRequestId': '1be65d7958826a',
|
|
252
252
|
'bids': [
|
|
@@ -384,6 +384,10 @@ const ANALYTICS_MESSAGE = {
|
|
|
384
384
|
'referrerHostname': 'www.test.com',
|
|
385
385
|
'auctions': [
|
|
386
386
|
{
|
|
387
|
+
|
|
388
|
+
'auctionEnd': 1519767013781,
|
|
389
|
+
'auctionStart': 1519767010567,
|
|
390
|
+
'bidderOrder': ['rubicon'],
|
|
387
391
|
'requestId': '25c6d7f5-699a-4bfc-87c9-996f915341fa',
|
|
388
392
|
'clientTimeoutMillis': 3000,
|
|
389
393
|
'serverTimeoutMillis': 1000,
|
|
@@ -853,6 +857,32 @@ describe('rubicon analytics adapter', function () {
|
|
|
853
857
|
expect(message).to.deep.equal(ANALYTICS_MESSAGE);
|
|
854
858
|
});
|
|
855
859
|
|
|
860
|
+
it('should pass along bidderOrder correctly', function () {
|
|
861
|
+
const appnexusBid = utils.deepClone(MOCK.BID_REQUESTED);
|
|
862
|
+
appnexusBid.bidderCode = 'appnexus';
|
|
863
|
+
const pubmaticBid = utils.deepClone(MOCK.BID_REQUESTED);
|
|
864
|
+
pubmaticBid.bidderCode = 'pubmatic';
|
|
865
|
+
const indexBid = utils.deepClone(MOCK.BID_REQUESTED);
|
|
866
|
+
indexBid.bidderCode = 'ix';
|
|
867
|
+
events.emit(AUCTION_INIT, MOCK.AUCTION_INIT);
|
|
868
|
+
events.emit(BID_REQUESTED, pubmaticBid);
|
|
869
|
+
events.emit(BID_REQUESTED, MOCK.BID_REQUESTED);
|
|
870
|
+
events.emit(BID_REQUESTED, indexBid);
|
|
871
|
+
events.emit(BID_REQUESTED, appnexusBid);
|
|
872
|
+
events.emit(BIDDER_DONE, MOCK.BIDDER_DONE);
|
|
873
|
+
events.emit(AUCTION_END, MOCK.AUCTION_END);
|
|
874
|
+
events.emit(SET_TARGETING, MOCK.SET_TARGETING);
|
|
875
|
+
clock.tick(SEND_TIMEOUT + 1000);
|
|
876
|
+
|
|
877
|
+
let message = JSON.parse(server.requests[0].requestBody);
|
|
878
|
+
expect(message.auctions[0].bidderOrder).to.deep.equal([
|
|
879
|
+
'pubmatic',
|
|
880
|
+
'rubicon',
|
|
881
|
+
'ix',
|
|
882
|
+
'appnexus'
|
|
883
|
+
]);
|
|
884
|
+
});
|
|
885
|
+
|
|
856
886
|
it('should pass along user ids', function () {
|
|
857
887
|
let auctionInit = utils.deepClone(MOCK.AUCTION_INIT);
|
|
858
888
|
auctionInit.bidderRequests[0].bids[0].userId = {
|
|
@@ -148,7 +148,6 @@ describe('Sortable Analytics Adapter', function() {
|
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
});
|
|
151
|
-
|
|
152
151
|
sortableAnalyticsAdapter.enableAnalytics(initialConfig);
|
|
153
152
|
});
|
|
154
153
|
|
|
@@ -203,11 +202,11 @@ describe('Sortable Analytics Adapter', function() {
|
|
|
203
202
|
brc: 1,
|
|
204
203
|
brid: ['10141593b1d84a', '37a8760be6db23'],
|
|
205
204
|
rs: ['300x250', '728x90'],
|
|
206
|
-
btcp: [0.70, 0.50],
|
|
205
|
+
btcp: [0.70, 0.50].map(n => n * 0.95),
|
|
207
206
|
btcc: 'USD',
|
|
208
207
|
btin: true,
|
|
209
208
|
btsrc: 'sortable',
|
|
210
|
-
c: [0.70, 0.50],
|
|
209
|
+
c: [0.70, 0.50].map(n => n * 0.95),
|
|
211
210
|
cc: 'USD',
|
|
212
211
|
did: null,
|
|
213
212
|
inr: true,
|