@@ -1235,6 +1235,76 @@ describe('PubMatic adapter', function () {
1235
1235
} ) ;
1236
1236
} ) ;
1237
1237
1238
+ describe ( 'AdsrvrOrgId from userId module' , function ( ) {
1239
+ let sandbox ;
1240
+ beforeEach ( ( ) => {
1241
+ sandbox = sinon . sandbox . create ( ) ;
1242
+ } ) ;
1243
+
1244
+ afterEach ( ( ) => {
1245
+ sandbox . restore ( ) ;
1246
+ } ) ;
1247
+
1248
+ it ( 'Request should have AdsrvrOrgId config params' , function ( ) {
1249
+ bidRequests [ 0 ] . userId = { } ;
1250
+ bidRequests [ 0 ] . userId . tdid = 'TTD_ID_FROM_USER_ID_MODULE' ;
1251
+ let request = spec . buildRequests ( bidRequests , { } ) ;
1252
+ let data = JSON . parse ( request . data ) ;
1253
+ expect ( data . user . eids ) . to . deep . equal ( [ {
1254
+ 'source' : 'adserver.org' ,
1255
+ 'uids' : [ {
1256
+ 'id' : 'TTD_ID_FROM_USER_ID_MODULE' ,
1257
+ 'atype' : 1 ,
1258
+ 'ext' : {
1259
+ 'rtiPartner' : 'TDID'
1260
+ }
1261
+ } ]
1262
+ } ] ) ;
1263
+ } ) ;
1264
+
1265
+ it ( 'Request should have adsrvrOrgId from UserId Module if config and userId module both have TTD ID' , function ( ) {
1266
+ sandbox . stub ( config , 'getConfig' ) . callsFake ( ( key ) => {
1267
+ var config = {
1268
+ adsrvrOrgId : {
1269
+ 'TDID' : 'TTD_ID_FROM_CONFIG' ,
1270
+ 'TDID_LOOKUP' : 'TRUE' ,
1271
+ 'TDID_CREATED_AT' : '2018-10-01T07:05:40'
1272
+ }
1273
+ } ;
1274
+ return config [ key ] ;
1275
+ } ) ;
1276
+ bidRequests [ 0 ] . userId = { } ;
1277
+ bidRequests [ 0 ] . userId . tdid = 'TTD_ID_FROM_USER_ID_MODULE' ;
1278
+ let request = spec . buildRequests ( bidRequests , { } ) ;
1279
+ let data = JSON . parse ( request . data ) ;
1280
+ expect ( data . user . eids ) . to . deep . equal ( [ {
1281
+ 'source' : 'adserver.org' ,
1282
+ 'uids' : [ {
1283
+ 'id' : 'TTD_ID_FROM_USER_ID_MODULE' ,
1284
+ 'atype' : 1 ,
1285
+ 'ext' : {
1286
+ 'rtiPartner' : 'TDID'
1287
+ }
1288
+ } ]
1289
+ } ] ) ;
1290
+ } ) ;
1291
+
1292
+ it ( 'Request should NOT have adsrvrOrgId params if userId is NOT object' , function ( ) {
1293
+ let request = spec . buildRequests ( bidRequests , { } ) ;
1294
+ let data = JSON . parse ( request . data ) ;
1295
+ expect ( data . user . eids ) . to . deep . equal ( undefined ) ;
1296
+ } ) ;
1297
+
1298
+ it ( 'Request should NOT have adsrvrOrgId params if userId.tdid is NOT string' , function ( ) {
1299
+ bidRequests [ 0 ] . userId = {
1300
+ tdid : 1234
1301
+ } ;
1302
+ let request = spec . buildRequests ( bidRequests , { } ) ;
1303
+ let data = JSON . parse ( request . data ) ;
1304
+ expect ( data . user . eids ) . to . deep . equal ( undefined ) ;
1305
+ } ) ;
1306
+ } ) ;
1307
+
1238
1308
describe ( 'AdsrvrOrgId and Digitrust' , function ( ) {
1239
1309
// here we are considering cases only of accepting DigiTrustId from config
1240
1310
let sandbox ;
0 commit comments