@@ -152,6 +152,25 @@ describe('sovrnBidAdapter', function() {
152
152
expect ( data . user . ext . consent ) . to . equal ( consentString ) ;
153
153
} ) ;
154
154
155
+ it ( 'should send us_privacy if bidderRequest has a value for uspConsent' , function ( ) {
156
+ let uspString = '1NYN' ;
157
+ let bidderRequest = {
158
+ 'bidderCode' : 'sovrn' ,
159
+ 'auctionId' : '1d1a030790a475' ,
160
+ 'bidderRequestId' : '22edbae2733bf6' ,
161
+ 'timeout' : 3000 ,
162
+ uspConsent : uspString ,
163
+ refererInfo : {
164
+ referer : 'http://example.com/page.html' ,
165
+ }
166
+ } ;
167
+ bidderRequest . bids = bidRequests ;
168
+
169
+ const data = JSON . parse ( spec . buildRequests ( bidRequests , bidderRequest ) . data ) ;
170
+
171
+ expect ( data . regs . ext [ 'us_privacy' ] ) . to . equal ( uspString ) ;
172
+ } ) ;
173
+
155
174
it ( 'converts tagid to string' , function ( ) {
156
175
const ivBidRequests = [ {
157
176
'bidder' : 'sovrn' ,
@@ -399,13 +418,56 @@ describe('sovrnBidAdapter', function() {
399
418
const expectedReturnStatement = [
400
419
{
401
420
'type' : 'iframe' ,
402
- 'url' : 'https://ap.lijit.com/beacon?informer=13487408&gdpr_consent= ' ,
421
+ 'url' : 'https://ap.lijit.com/beacon?informer=13487408' ,
403
422
}
404
423
] ;
405
424
const returnStatement = spec . getUserSyncs ( syncOptions , serverResponse ) ;
406
425
expect ( returnStatement [ 0 ] ) . to . deep . equal ( expectedReturnStatement [ 0 ] ) ;
407
426
} ) ;
408
427
428
+ it ( 'should include gdpr consent string if present' , function ( ) {
429
+ const gdprConsent = {
430
+ gdprApplies : 1 ,
431
+ consentString : 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A=='
432
+ }
433
+ const expectedReturnStatement = [
434
+ {
435
+ 'type' : 'iframe' ,
436
+ 'url' : `https://ap.lijit.com/beacon?gdpr_consent=${ gdprConsent . consentString } &informer=13487408` ,
437
+ }
438
+ ] ;
439
+ const returnStatement = spec . getUserSyncs ( syncOptions , serverResponse , gdprConsent , '' ) ;
440
+ expect ( returnStatement [ 0 ] ) . to . deep . equal ( expectedReturnStatement [ 0 ] ) ;
441
+ } ) ;
442
+
443
+ it ( 'should include us privacy string if present' , function ( ) {
444
+ const uspString = '1NYN' ;
445
+ const expectedReturnStatement = [
446
+ {
447
+ 'type' : 'iframe' ,
448
+ 'url' : `https://ap.lijit.com/beacon?us_privacy=${ uspString } &informer=13487408` ,
449
+ }
450
+ ] ;
451
+ const returnStatement = spec . getUserSyncs ( syncOptions , serverResponse , null , uspString ) ;
452
+ expect ( returnStatement [ 0 ] ) . to . deep . equal ( expectedReturnStatement [ 0 ] ) ;
453
+ } ) ;
454
+
455
+ it ( 'should include all privacy strings if present' , function ( ) {
456
+ const gdprConsent = {
457
+ gdprApplies : 1 ,
458
+ consentString : 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A=='
459
+ }
460
+ const uspString = '1NYN' ;
461
+ const expectedReturnStatement = [
462
+ {
463
+ 'type' : 'iframe' ,
464
+ 'url' : `https://ap.lijit.com/beacon?gdpr_consent=${ gdprConsent . consentString } &us_privacy=${ uspString } &informer=13487408` ,
465
+ }
466
+ ] ;
467
+ const returnStatement = spec . getUserSyncs ( syncOptions , serverResponse , gdprConsent , uspString ) ;
468
+ expect ( returnStatement [ 0 ] ) . to . deep . equal ( expectedReturnStatement [ 0 ] ) ;
469
+ } ) ;
470
+
409
471
it ( 'should not return if iid missing on server response' , function ( ) {
410
472
const returnStatement = spec . getUserSyncs ( syncOptions , [ ] ) ;
411
473
expect ( returnStatement ) . to . be . empty ;
0 commit comments