@@ -6,6 +6,16 @@ import { getUniqueIdentifierStr } from '../../../src/utils.js';
6
6
const bidder = 'iqzone'
7
7
8
8
describe ( 'IQZoneBidAdapter' , function ( ) {
9
+ const userIdAsEids = [ {
10
+ source : 'test.org' ,
11
+ uids : [ {
12
+ id : '01**********' ,
13
+ atype : 1 ,
14
+ ext : {
15
+ third : '01***********'
16
+ }
17
+ } ]
18
+ } ] ;
9
19
const bids = [
10
20
{
11
21
bidId : getUniqueIdentifierStr ( ) ,
@@ -17,7 +27,8 @@ describe('IQZoneBidAdapter', function () {
17
27
} ,
18
28
params : {
19
29
placementId : 'testBanner' ,
20
- }
30
+ } ,
31
+ userIdAsEids
21
32
} ,
22
33
{
23
34
bidId : getUniqueIdentifierStr ( ) ,
@@ -31,7 +42,8 @@ describe('IQZoneBidAdapter', function () {
31
42
} ,
32
43
params : {
33
44
placementId : 'testVideo' ,
34
- }
45
+ } ,
46
+ userIdAsEids
35
47
} ,
36
48
{
37
49
bidId : getUniqueIdentifierStr ( ) ,
@@ -54,7 +66,8 @@ describe('IQZoneBidAdapter', function () {
54
66
} ,
55
67
params : {
56
68
placementId : 'testNative' ,
57
- }
69
+ } ,
70
+ userIdAsEids
58
71
}
59
72
] ;
60
73
@@ -73,7 +86,9 @@ describe('IQZoneBidAdapter', function () {
73
86
74
87
const bidderRequest = {
75
88
uspConsent : '1---' ,
76
- gdprConsent : 'COvFyGBOvFyGBAbAAAENAPCAAOAAAAAAAAAAAEEUACCKAAA.IFoEUQQgAIQwgIwQABAEAAAAOIAACAIAAAAQAIAgEAACEAAAAAgAQBAAAAAAAGBAAgAAAAAAAFAAECAAAgAAQARAEQAAAAAJAAIAAgAAAYQEAAAQmAgBC3ZAYzUw' ,
89
+ gdprConsent : {
90
+ consentString : 'COvFyGBOvFyGBAbAAAENAPCAAOAAAAAAAAAAAEEUACCKAAA.IFoEUQQgAIQwgIwQABAEAAAAOIAACAIAAAAQAIAgEAACEAAAAAgAQBAAAAAAAGBAAgAAAAAAAFAAECAAAgAAQARAEQAAAAAJAAIAAgAAAYQEAAAQmAgBC3ZAYzUw'
91
+ } ,
77
92
refererInfo : {
78
93
referer : 'https://test.com'
79
94
} ,
@@ -129,7 +144,7 @@ describe('IQZoneBidAdapter', function () {
129
144
expect ( data . host ) . to . be . a ( 'string' ) ;
130
145
expect ( data . page ) . to . be . a ( 'string' ) ;
131
146
expect ( data . coppa ) . to . be . a ( 'number' ) ;
132
- expect ( data . gdpr ) . to . be . a ( 'string ' ) ;
147
+ expect ( data . gdpr ) . to . be . a ( 'object ' ) ;
133
148
expect ( data . ccpa ) . to . be . a ( 'string' ) ;
134
149
expect ( data . tmax ) . to . be . a ( 'number' ) ;
135
150
expect ( data . placements ) . to . have . lengthOf ( 3 ) ;
@@ -145,6 +160,7 @@ describe('IQZoneBidAdapter', function () {
145
160
expect ( placement . schain ) . to . be . an ( 'object' ) ;
146
161
expect ( placement . bidfloor ) . to . exist . and . to . equal ( 0 ) ;
147
162
expect ( placement . type ) . to . exist . and . to . equal ( 'publisher' ) ;
163
+ expect ( placement . eids ) . to . exist . and . to . be . deep . equal ( userIdAsEids ) ;
148
164
149
165
if ( placement . adFormat === BANNER ) {
150
166
expect ( placement . sizes ) . to . be . an ( 'array' ) ;
@@ -170,8 +186,8 @@ describe('IQZoneBidAdapter', function () {
170
186
serverRequest = spec . buildRequests ( bids , bidderRequest ) ;
171
187
let data = serverRequest . data ;
172
188
expect ( data . gdpr ) . to . exist ;
173
- expect ( data . gdpr ) . to . be . a ( 'string ' ) ;
174
- expect ( data . gdpr ) . to . equal ( bidderRequest . gdprConsent ) ;
189
+ expect ( data . gdpr ) . to . be . a ( 'object ' ) ;
190
+ expect ( data . gdpr . consentString ) . to . equal ( bidderRequest . gdprConsent . consentString ) ;
175
191
expect ( data . ccpa ) . to . not . exist ;
176
192
delete bidderRequest . gdprConsent ;
177
193
} ) ;
@@ -194,6 +210,38 @@ describe('IQZoneBidAdapter', function () {
194
210
} ) ;
195
211
} ) ;
196
212
213
+ describe ( 'gpp consent' , function ( ) {
214
+ it ( 'bidderRequest.gppConsent' , ( ) => {
215
+ bidderRequest . gppConsent = {
216
+ gppString : 'abc123' ,
217
+ applicableSections : [ 8 ]
218
+ } ;
219
+
220
+ let serverRequest = spec . buildRequests ( bids , bidderRequest ) ;
221
+ let data = serverRequest . data ;
222
+ expect ( data ) . to . be . an ( 'object' ) ;
223
+ expect ( data ) . to . have . property ( 'gpp' ) ;
224
+ expect ( data ) . to . have . property ( 'gpp_sid' ) ;
225
+
226
+ delete bidderRequest . gppConsent ;
227
+ } )
228
+
229
+ it ( 'bidderRequest.ortb2.regs.gpp' , ( ) => {
230
+ bidderRequest . ortb2 = bidderRequest . ortb2 || { } ;
231
+ bidderRequest . ortb2 . regs = bidderRequest . ortb2 . regs || { } ;
232
+ bidderRequest . ortb2 . regs . gpp = 'abc123' ;
233
+ bidderRequest . ortb2 . regs . gpp_sid = [ 8 ] ;
234
+
235
+ let serverRequest = spec . buildRequests ( bids , bidderRequest ) ;
236
+ let data = serverRequest . data ;
237
+ expect ( data ) . to . be . an ( 'object' ) ;
238
+ expect ( data ) . to . have . property ( 'gpp' ) ;
239
+ expect ( data ) . to . have . property ( 'gpp_sid' ) ;
240
+
241
+ bidderRequest . ortb2 ;
242
+ } )
243
+ } ) ;
244
+
197
245
describe ( 'interpretResponse' , function ( ) {
198
246
it ( 'Should interpret banner response' , function ( ) {
199
247
const banner = {
@@ -370,6 +418,7 @@ describe('IQZoneBidAdapter', function () {
370
418
expect ( serverResponses ) . to . be . an ( 'array' ) . that . is . empty ;
371
419
} ) ;
372
420
} ) ;
421
+
373
422
describe ( 'getUserSyncs' , function ( ) {
374
423
it ( 'Should return array of objects with proper sync config , include GDPR' , function ( ) {
375
424
const syncData = spec . getUserSyncs ( { } , { } , {
@@ -394,5 +443,17 @@ describe('IQZoneBidAdapter', function () {
394
443
expect ( syncData [ 0 ] . url ) . to . be . a ( 'string' )
395
444
expect ( syncData [ 0 ] . url ) . to . equal ( 'https://cs.smartssp.iqzone.com/image?pbjs=1&ccpa_consent=1---&coppa=0' )
396
445
} ) ;
446
+ it ( 'Should return array of objects with proper sync config , include GPP' , function ( ) {
447
+ const syncData = spec . getUserSyncs ( { } , { } , { } , { } , {
448
+ gppString : 'abc123' ,
449
+ applicableSections : [ 8 ]
450
+ } ) ;
451
+ expect ( syncData ) . to . be . an ( 'array' ) . which . is . not . empty ;
452
+ expect ( syncData [ 0 ] ) . to . be . an ( 'object' )
453
+ expect ( syncData [ 0 ] . type ) . to . be . a ( 'string' )
454
+ expect ( syncData [ 0 ] . type ) . to . equal ( 'image' )
455
+ expect ( syncData [ 0 ] . url ) . to . be . a ( 'string' )
456
+ expect ( syncData [ 0 ] . url ) . to . equal ( 'https://cs.smartssp.iqzone.com/image?pbjs=1&gpp=abc123&gpp_sid=8&coppa=0' )
457
+ } ) ;
397
458
} ) ;
398
459
} ) ;
0 commit comments