1
1
/* eslint dot-notation:0, quote-props:0 */
2
2
import { expect } from 'chai' ;
3
3
import { spec } from 'modules/pulsepointBidAdapter' ;
4
- import { deepClone , getTopWindowLocation } from 'src/utils' ;
4
+ import { deepClone } from 'src/utils' ;
5
5
6
6
describe ( 'PulsePoint Adapter Tests' , function ( ) {
7
7
const slotConfigs = [ {
@@ -138,9 +138,14 @@ describe('PulsePoint Adapter Tests', function () {
138
138
}
139
139
}
140
140
} ] ;
141
+ const bidderRequest = {
142
+ refererInfo : {
143
+ referer : 'https://publisher.com/home'
144
+ }
145
+ } ;
141
146
142
147
it ( 'Verify build request' , function ( ) {
143
- const request = spec . buildRequests ( slotConfigs ) ;
148
+ const request = spec . buildRequests ( slotConfigs , bidderRequest ) ;
144
149
expect ( request . url ) . to . equal ( 'https://bid.contextweb.com/header/ortb?src=prebid' ) ;
145
150
expect ( request . method ) . to . equal ( 'POST' ) ;
146
151
const ortbRequest = request . data ;
@@ -149,7 +154,7 @@ describe('PulsePoint Adapter Tests', function () {
149
154
expect ( ortbRequest . site . publisher ) . to . not . equal ( null ) ;
150
155
expect ( ortbRequest . site . publisher . id ) . to . equal ( 'p10000' ) ;
151
156
expect ( ortbRequest . site . ref ) . to . equal ( window . top . document . referrer ) ;
152
- expect ( ortbRequest . site . page ) . to . equal ( getTopWindowLocation ( ) . href ) ;
157
+ expect ( ortbRequest . site . page ) . to . equal ( 'https://publisher.com/home' ) ;
153
158
expect ( ortbRequest . imp ) . to . have . lengthOf ( 2 ) ;
154
159
// device object
155
160
expect ( ortbRequest . device ) . to . not . equal ( null ) ;
@@ -167,7 +172,7 @@ describe('PulsePoint Adapter Tests', function () {
167
172
} ) ;
168
173
169
174
it ( 'Verify parse response' , function ( ) {
170
- const request = spec . buildRequests ( slotConfigs ) ;
175
+ const request = spec . buildRequests ( slotConfigs , bidderRequest ) ;
171
176
const ortbRequest = request . data ;
172
177
const ortbResponse = {
173
178
seatbid : [ {
@@ -196,7 +201,7 @@ describe('PulsePoint Adapter Tests', function () {
196
201
} ) ;
197
202
198
203
it ( 'Verify use ttl in ext' , function ( ) {
199
- const request = spec . buildRequests ( slotConfigs ) ;
204
+ const request = spec . buildRequests ( slotConfigs , bidderRequest ) ;
200
205
const ortbRequest = request . data ;
201
206
const ortbResponse = {
202
207
seatbid : [ {
@@ -222,13 +227,13 @@ describe('PulsePoint Adapter Tests', function () {
222
227
} ) ;
223
228
224
229
it ( 'Verify full passback' , function ( ) {
225
- const request = spec . buildRequests ( slotConfigs ) ;
230
+ const request = spec . buildRequests ( slotConfigs , bidderRequest ) ;
226
231
const bids = spec . interpretResponse ( { body : null } , request )
227
232
expect ( bids ) . to . have . lengthOf ( 0 ) ;
228
233
} ) ;
229
234
230
235
it ( 'Verify Native request' , function ( ) {
231
- const request = spec . buildRequests ( nativeSlotConfig ) ;
236
+ const request = spec . buildRequests ( nativeSlotConfig , bidderRequest ) ;
232
237
expect ( request . url ) . to . equal ( 'https://bid.contextweb.com/header/ortb?src=prebid' ) ;
233
238
expect ( request . method ) . to . equal ( 'POST' ) ;
234
239
const ortbRequest = request . data ;
@@ -266,7 +271,7 @@ describe('PulsePoint Adapter Tests', function () {
266
271
} ) ;
267
272
268
273
it ( 'Verify Native response' , function ( ) {
269
- const request = spec . buildRequests ( nativeSlotConfig ) ;
274
+ const request = spec . buildRequests ( nativeSlotConfig , bidderRequest ) ;
270
275
expect ( request . url ) . to . equal ( 'https://bid.contextweb.com/header/ortb?src=prebid' ) ;
271
276
expect ( request . method ) . to . equal ( 'POST' ) ;
272
277
const ortbRequest = request . data ;
@@ -355,7 +360,7 @@ describe('PulsePoint Adapter Tests', function () {
355
360
} ) ;
356
361
357
362
it ( 'Verify app requests' , function ( ) {
358
- const request = spec . buildRequests ( appSlotConfig ) ;
363
+ const request = spec . buildRequests ( appSlotConfig , bidderRequest ) ;
359
364
const ortbRequest = request . data ;
360
365
// site object
361
366
expect ( ortbRequest . site ) . to . equal ( null ) ;
@@ -368,13 +373,13 @@ describe('PulsePoint Adapter Tests', function () {
368
373
} ) ;
369
374
370
375
it ( 'Verify GDPR' , function ( ) {
371
- const bidderRequest = {
376
+ const bidderRequestGdpr = {
372
377
gdprConsent : {
373
378
gdprApplies : true ,
374
379
consentString : 'serialized_gpdr_data'
375
380
}
376
381
} ;
377
- const request = spec . buildRequests ( slotConfigs , bidderRequest ) ;
382
+ const request = spec . buildRequests ( slotConfigs , Object . assign ( { } , bidderRequest , bidderRequestGdpr ) ) ;
378
383
expect ( request . url ) . to . equal ( 'https://bid.contextweb.com/header/ortb?src=prebid' ) ;
379
384
expect ( request . method ) . to . equal ( 'POST' ) ;
380
385
const ortbRequest = request . data ;
@@ -389,7 +394,7 @@ describe('PulsePoint Adapter Tests', function () {
389
394
} ) ;
390
395
391
396
it ( 'Verify Video request' , function ( ) {
392
- const request = spec . buildRequests ( videoSlotConfig ) ;
397
+ const request = spec . buildRequests ( videoSlotConfig , bidderRequest ) ;
393
398
expect ( request . url ) . to . equal ( 'https://bid.contextweb.com/header/ortb?src=prebid' ) ;
394
399
expect ( request . method ) . to . equal ( 'POST' ) ;
395
400
const ortbRequest = request . data ;
@@ -409,7 +414,7 @@ describe('PulsePoint Adapter Tests', function () {
409
414
} ) ;
410
415
411
416
it ( 'Verify Video response' , function ( ) {
412
- const request = spec . buildRequests ( videoSlotConfig ) ;
417
+ const request = spec . buildRequests ( videoSlotConfig , bidderRequest ) ;
413
418
expect ( request . url ) . to . equal ( 'https://bid.contextweb.com/header/ortb?src=prebid' ) ;
414
419
expect ( request . method ) . to . equal ( 'POST' ) ;
415
420
const ortbRequest = request . data ;
@@ -433,7 +438,7 @@ describe('PulsePoint Adapter Tests', function () {
433
438
} ) ;
434
439
435
440
it ( 'Verify extra parameters' , function ( ) {
436
- let request = spec . buildRequests ( additionalParamsConfig ) ;
441
+ let request = spec . buildRequests ( additionalParamsConfig , bidderRequest ) ;
437
442
let ortbRequest = request . data ;
438
443
expect ( ortbRequest ) . to . not . equal ( null ) ;
439
444
expect ( ortbRequest . imp ) . to . have . lengthOf ( 1 ) ;
@@ -448,15 +453,15 @@ describe('PulsePoint Adapter Tests', function () {
448
453
expect ( ortbRequest . imp [ 0 ] . ext . prebid . extra_key4 ) . to . eql ( [ 1 , 2 , 3 ] ) ;
449
454
expect ( Object . keys ( ortbRequest . imp [ 0 ] . ext . prebid ) ) . to . eql ( [ 'extra_key1' , 'extra_key2' , 'extra_key3' , 'extra_key4' ] ) ;
450
455
// attempting with a configuration with no unknown params.
451
- request = spec . buildRequests ( outstreamSlotConfig ) ;
456
+ request = spec . buildRequests ( outstreamSlotConfig , bidderRequest ) ;
452
457
ortbRequest = request . data ;
453
458
expect ( ortbRequest ) . to . not . equal ( null ) ;
454
459
expect ( ortbRequest . imp ) . to . have . lengthOf ( 1 ) ;
455
460
expect ( ortbRequest . imp [ 0 ] . ext ) . to . equal ( null ) ;
456
461
} ) ;
457
462
458
463
it ( 'Verify ortb parameters' , function ( ) {
459
- const request = spec . buildRequests ( ortbParamsSlotConfig ) ;
464
+ const request = spec . buildRequests ( ortbParamsSlotConfig , bidderRequest ) ;
460
465
const ortbRequest = request . data ;
461
466
expect ( ortbRequest ) . to . not . equal ( null ) ;
462
467
expect ( ortbRequest . bcat ) . to . eql ( [ 'IAB-1' , 'IAB-20' ] ) ;
@@ -472,7 +477,8 @@ describe('PulsePoint Adapter Tests', function () {
472
477
} ) ;
473
478
474
479
it ( 'Verify outstream renderer' , function ( ) {
475
- const request = spec . buildRequests ( outstreamSlotConfig , { bids : [ outstreamSlotConfig [ 0 ] ] } ) ;
480
+ const bidderRequestOutstream = Object . assign ( { } , bidderRequest , { bids : [ outstreamSlotConfig [ 0 ] ] } ) ;
481
+ const request = spec . buildRequests ( outstreamSlotConfig , bidderRequestOutstream ) ;
476
482
const ortbRequest = request . data ;
477
483
expect ( ortbRequest ) . to . not . be . null ;
478
484
expect ( ortbRequest . imp [ 0 ] ) . to . not . be . null ;
@@ -521,7 +527,7 @@ describe('PulsePoint Adapter Tests', function () {
521
527
}
522
528
}
523
529
} ;
524
- const request = spec . buildRequests ( bidRequests ) ;
530
+ const request = spec . buildRequests ( bidRequests , bidderRequest ) ;
525
531
expect ( request ) . to . be . not . null ;
526
532
const ortbRequest = request . data ;
527
533
expect ( request . data ) . to . be . not . null ;
0 commit comments