@@ -2037,6 +2037,8 @@ describe('User ID', function () {
2037
2037
coreStorage . setCookie ( 'pubcid_sharedid' , '' , EXPIRED_COOKIE_DATE ) ;
2038
2038
coreStorage . setCookie ( 'unifiedid' , '' , EXPIRED_COOKIE_DATE ) ;
2039
2039
coreStorage . setCookie ( '_parrable_eid' , '' , EXPIRED_COOKIE_DATE ) ;
2040
+ resetConsentData ( ) ;
2041
+ delete window . __tcfapi ;
2040
2042
} ) ;
2041
2043
2042
2044
it ( 'pubcid callback with url' , function ( ) {
@@ -2171,6 +2173,57 @@ describe('User ID', function () {
2171
2173
expect ( server . requests [ 0 ] . url ) . to . equal ( 'https://id.sharedid.org/id' ) ;
2172
2174
expect ( coreStorage . getCookie ( 'pubcid_sharedid' ) ) . to . be . null ;
2173
2175
} ) ;
2176
+
2177
+ it ( 'verify sharedid called with consent data when gdpr applies' , function ( ) {
2178
+ let adUnits = [ getAdUnitMock ( ) ] ;
2179
+ let customCfg = getConfigMock ( [ 'pubCommonId' , 'pubcid' , 'cookie' ] ) ;
2180
+ let consentConfig = {
2181
+ cmpApi : 'iab' ,
2182
+ timeout : 7500 ,
2183
+ allowAuctionWithoutConsent : false
2184
+ } ;
2185
+ customCfg = addConfig ( customCfg , 'params' , { pixelUrl : '/any/pubcid/url' , enableSharedId : true } ) ;
2186
+
2187
+ server . respondWith ( 'https://id.sharedid.org/id?gdpr=1&gdpr_consent=abc12345234' , function ( xhr ) {
2188
+ xhr . respond ( 200 , { } , '{"sharedId":"testsharedid"}' ) ;
2189
+ } ) ;
2190
+ server . respondImmediately = true ;
2191
+
2192
+ let testConsentData = {
2193
+ tcString : 'abc12345234' ,
2194
+ gdprApplies : true ,
2195
+ purposeOneTreatment : false ,
2196
+ eventStatus : 'tcloaded' ,
2197
+ vendor : { consents : { 887 : true } } ,
2198
+ purpose : {
2199
+ consents : {
2200
+ 1 : true
2201
+ }
2202
+ }
2203
+ } ;
2204
+
2205
+ window . __tcfapi = function ( ) { } ;
2206
+ sinon . stub ( window , '__tcfapi' ) . callsFake ( ( ...args ) => {
2207
+ args [ 2 ] ( testConsentData , true ) ;
2208
+ } ) ;
2209
+
2210
+ setSubmoduleRegistry ( [ pubCommonIdSubmodule ] ) ;
2211
+ init ( config ) ;
2212
+ config . setConfig ( customCfg ) ;
2213
+ setConsentConfig ( consentConfig ) ;
2214
+
2215
+ consentManagementRequestBidsHook ( ( ) => {
2216
+ } , { } ) ;
2217
+ requestBidsHook ( ( config ) => {
2218
+ } , { adUnits} ) ;
2219
+
2220
+ expect ( utils . triggerPixel . called ) . to . be . false ;
2221
+ events . emit ( CONSTANTS . EVENTS . AUCTION_END , { } ) ;
2222
+ expect ( utils . triggerPixel . getCall ( 0 ) . args [ 0 ] ) . to . include ( '/any/pubcid/url' ) ;
2223
+
2224
+ expect ( server . requests [ 0 ] . url ) . to . equal ( 'https://id.sharedid.org/id?gdpr=1&gdpr_consent=abc12345234' ) ;
2225
+ expect ( coreStorage . getCookie ( 'pubcid_sharedid' ) ) . to . equal ( 'testsharedid' ) ;
2226
+ } ) ;
2174
2227
} ) ;
2175
2228
2176
2229
describe ( 'Set cookie behavior' , function ( ) {
0 commit comments