@@ -992,6 +992,7 @@ describe('The Criteo bidding adapter', function () {
992
992
zoneid : 123 ,
993
993
native : {
994
994
'products' : [ {
995
+ 'sendTargetingKeys' : false ,
995
996
'title' : 'Product title' ,
996
997
'description' : 'Product desc' ,
997
998
'price' : '100' ,
@@ -1027,7 +1028,6 @@ describe('The Criteo bidding adapter', function () {
1027
1028
native : true ,
1028
1029
} ]
1029
1030
} ;
1030
- config . setConfig ( { 'enableSendAllBids' : false } ) ;
1031
1031
const bids = spec . interpretResponse ( response , request ) ;
1032
1032
expect ( bids ) . to . have . lengthOf ( 1 ) ;
1033
1033
expect ( bids [ 0 ] . requestId ) . to . equal ( 'test-bidId' ) ;
@@ -1036,61 +1036,87 @@ describe('The Criteo bidding adapter', function () {
1036
1036
expect ( bids [ 0 ] . mediaType ) . to . equal ( NATIVE ) ;
1037
1037
} ) ;
1038
1038
1039
- it ( 'should not parse bid response with native when enableSendAllBids is true' , function ( ) {
1040
- const response = {
1041
- body : {
1042
- slots : [ {
1043
- impid : 'test-requestId' ,
1044
- bidId : 'abc123' ,
1045
- cpm : 1.23 ,
1046
- width : 728 ,
1047
- height : 90 ,
1048
- zoneid : 123 ,
1049
- native : { }
1050
- } ] ,
1051
- } ,
1052
- } ;
1053
- const request = {
1054
- bidRequests : [ {
1055
- adUnitCode : 'test-requestId' ,
1056
- bidId : 'test-bidId' ,
1039
+ it ( 'should warn only once if sendTargetingKeys set to true on required fields for native bidRequest' , ( ) => {
1040
+ const bidderRequest = { } ;
1041
+ const bidRequests = [
1042
+ {
1043
+ bidder : 'criteo' ,
1044
+ adUnitCode : 'bid-123' ,
1045
+ transactionId : 'transaction-123' ,
1046
+ sizes : [ [ 728 , 90 ] ] ,
1057
1047
params : {
1058
1048
zoneId : 123 ,
1049
+ publisherSubId : '123' ,
1050
+ nativeCallback : function ( ) { }
1059
1051
} ,
1060
- native : true ,
1061
- } ]
1062
- } ;
1063
- config . setConfig ( { 'enableSendAllBids' : true } ) ;
1064
- const bids = spec . interpretResponse ( response , request ) ;
1065
- expect ( bids ) . to . have . lengthOf ( 0 ) ;
1066
- } ) ;
1067
-
1068
- it ( 'should not parse bid response with native when enableSendAllBids is not set' , function ( ) {
1069
- const response = {
1070
- body : {
1071
- slots : [ {
1072
- impid : 'test-requestId' ,
1073
- bidId : 'abc123' ,
1074
- cpm : 1.23 ,
1075
- width : 728 ,
1076
- height : 90 ,
1077
- zoneid : 123 ,
1078
- native : { }
1079
- } ] ,
1080
1052
} ,
1081
- } ;
1082
- const request = {
1083
- bidRequests : [ {
1084
- adUnitCode : 'test-requestId ' ,
1085
- bidId : 'test-bidId' ,
1053
+ {
1054
+ bidder : 'criteo' ,
1055
+ adUnitCode : 'bid-456' ,
1056
+ transactionId : 'transaction-456 ' ,
1057
+ sizes : [ [ 728 , 90 ] ] ,
1086
1058
params : {
1087
- zoneId : 123 ,
1059
+ zoneId : 456 ,
1060
+ publisherSubId : '456' ,
1061
+ nativeCallback : function ( ) { }
1088
1062
} ,
1089
- native : true ,
1090
- } ]
1091
- } ;
1092
- const bids = spec . interpretResponse ( response , request ) ;
1093
- expect ( bids ) . to . have . lengthOf ( 0 ) ;
1063
+ } ,
1064
+ ] ;
1065
+
1066
+ const nativeParamsWithSendTargetingKeys = [
1067
+ {
1068
+ nativeParams : {
1069
+ image : {
1070
+ sendTargetingKeys : true
1071
+ } ,
1072
+ }
1073
+ } ,
1074
+ {
1075
+ nativeParams : {
1076
+ icon : {
1077
+ sendTargetingKeys : true
1078
+ } ,
1079
+ }
1080
+ } ,
1081
+ {
1082
+ nativeParams : {
1083
+ clickUrl : {
1084
+ sendTargetingKeys : true
1085
+ } ,
1086
+ }
1087
+ } ,
1088
+ {
1089
+ nativeParams : {
1090
+ displayUrl : {
1091
+ sendTargetingKeys : true
1092
+ } ,
1093
+ }
1094
+ } ,
1095
+ {
1096
+ nativeParams : {
1097
+ privacyLink : {
1098
+ sendTargetingKeys : true
1099
+ } ,
1100
+ }
1101
+ } ,
1102
+ {
1103
+ nativeParams : {
1104
+ privacyIcon : {
1105
+ sendTargetingKeys : true
1106
+ } ,
1107
+ }
1108
+ }
1109
+ ] ;
1110
+
1111
+ utilsMock . expects ( 'logWarn' )
1112
+ . withArgs ( 'Criteo: all native assets containing URL should be sent as placeholders with sendId(icon, image, clickUrl, displayUrl, privacyLink, privacyIcon)' )
1113
+ . exactly ( nativeParamsWithSendTargetingKeys . length * bidRequests . length ) ;
1114
+ nativeParamsWithSendTargetingKeys . forEach ( nativeParams => {
1115
+ let transformedBidRequests = { ...bidRequests } ;
1116
+ transformedBidRequests = [ Object . assign ( transformedBidRequests [ 0 ] , nativeParams ) , Object . assign ( transformedBidRequests [ 1 ] , nativeParams ) ] ;
1117
+ spec . buildRequests ( transformedBidRequests , bidderRequest ) ;
1118
+ } ) ;
1119
+ utilsMock . verify ( ) ;
1094
1120
} ) ;
1095
1121
1096
1122
it ( 'should properly parse a bid response with a zoneId passed as a string' , function ( ) {
0 commit comments