@@ -2974,8 +2974,6 @@ describe('Rokt Forwarder', () => {
29742974
29752975 describe ( '#advertiserIdSync' , ( ) => {
29762976 const ADVERTISER_API_KEY = 'advertiser-key-abc123' ;
2977- const ADVERTISER_API_SECRET = 'advertiser-secret-xyz789' ;
2978- const ADVERTISER_CREDENTIALS = `${ ADVERTISER_API_KEY } ,${ ADVERTISER_API_SECRET } ` ;
29792977
29802978 function makeUser ( overrides : any = { } ) {
29812979 return {
@@ -2997,21 +2995,19 @@ describe('Rokt Forwarder', () => {
29972995 ( window as any ) . mParticle . forwarder . userAttributes = { } ;
29982996 } ) ;
29992997
3000- it ( 'should split advertiserIdSyncCredentials into apiKey + secret and forward both, setting userIdentifiedInAdvertiser when 200 returned' , async ( ) => {
2998+ it ( 'should call Identity.searchAdvertiser with the configured api key and set userIdentifiedInAdvertiser when 200 returned' , async ( ) => {
30012999 let receivedApiKey : any = null ;
3002- let receivedSecret : any = null ;
30033000 let receivedKnownIdentities : any = null ;
30043001 ( window as any ) . mParticle . Identity = {
3005- searchAdvertiser : ( apiKey : any , secret : any , knownIdentities : any , cb : any ) => {
3002+ searchAdvertiser : ( apiKey : any , knownIdentities : any , cb : any ) => {
30063003 receivedApiKey = apiKey ;
3007- receivedSecret = secret ;
30083004 receivedKnownIdentities = knownIdentities ;
30093005 cb ( { httpCode : 200 , body : { mpid : '999' } } ) ;
30103006 } ,
30113007 } ;
30123008
30133009 await ( window as any ) . mParticle . forwarder . init (
3014- { accountId : '123456' , advertiserIdSyncCredentials : ADVERTISER_CREDENTIALS } ,
3010+ { accountId : '123456' , advertiserIdSyncApiKey : ADVERTISER_API_KEY } ,
30153011 reportService . cb ,
30163012 true ,
30173013 null ,
@@ -3021,48 +3017,19 @@ describe('Rokt Forwarder', () => {
30213017 ( window as any ) . mParticle . forwarder . onUserIdentified ( makeUser ( ) ) ;
30223018
30233019 expect ( receivedApiKey ) . toBe ( ADVERTISER_API_KEY ) ;
3024- expect ( receivedSecret ) . toBe ( ADVERTISER_API_SECRET ) ;
30253020 expect ( receivedKnownIdentities ) . toEqual ( { email : 'test@example.com' } ) ;
30263021 expect ( ( window as any ) . mParticle . forwarder . userAttributes . userIdentifiedInAdvertiser ) . toBe ( true ) ;
30273022 } ) ;
30283023
3029- it ( 'should trim whitespace around the comma-separated credentials' , async ( ) => {
3030- let receivedApiKey : any = null ;
3031- let receivedSecret : any = null ;
3032- ( window as any ) . mParticle . Identity = {
3033- searchAdvertiser : ( apiKey : any , secret : any , _knownIdentities : any , cb : any ) => {
3034- receivedApiKey = apiKey ;
3035- receivedSecret = secret ;
3036- cb ( { httpCode : 200 } ) ;
3037- } ,
3038- } ;
3039-
3040- await ( window as any ) . mParticle . forwarder . init (
3041- {
3042- accountId : '123456' ,
3043- advertiserIdSyncCredentials : ` ${ ADVERTISER_API_KEY } , ${ ADVERTISER_API_SECRET } ` ,
3044- } ,
3045- reportService . cb ,
3046- true ,
3047- null ,
3048- { } ,
3049- ) ;
3050-
3051- ( window as any ) . mParticle . forwarder . onUserIdentified ( makeUser ( ) ) ;
3052-
3053- expect ( receivedApiKey ) . toBe ( ADVERTISER_API_KEY ) ;
3054- expect ( receivedSecret ) . toBe ( ADVERTISER_API_SECRET ) ;
3055- } ) ;
3056-
30573024 it ( 'should not set userIdentifiedInAdvertiser when search returns 404' , async ( ) => {
30583025 ( window as any ) . mParticle . Identity = {
3059- searchAdvertiser : ( _apiKey : any , _secret : any , _knownIdentities : any , cb : any ) => {
3026+ searchAdvertiser : ( _apiKey : any , _knownIdentities : any , cb : any ) => {
30603027 cb ( { httpCode : 404 } ) ;
30613028 } ,
30623029 } ;
30633030
30643031 await ( window as any ) . mParticle . forwarder . init (
3065- { accountId : '123456' , advertiserIdSyncCredentials : ADVERTISER_CREDENTIALS } ,
3032+ { accountId : '123456' , advertiserIdSyncApiKey : ADVERTISER_API_KEY } ,
30663033 reportService . cb ,
30673034 true ,
30683035 null ,
@@ -3074,7 +3041,7 @@ describe('Rokt Forwarder', () => {
30743041 expect ( ( window as any ) . mParticle . forwarder . userAttributes . userIdentifiedInAdvertiser ) . toBeUndefined ( ) ;
30753042 } ) ;
30763043
3077- it ( 'should not call searchAdvertiser when advertiserIdSyncCredentials is missing' , async ( ) => {
3044+ it ( 'should not call searchAdvertiser when advertiserIdSyncApiKey is missing' , async ( ) => {
30783045 let searchCalled = false ;
30793046 ( window as any ) . mParticle . Identity = {
30803047 searchAdvertiser : ( ) => {
@@ -3090,7 +3057,7 @@ describe('Rokt Forwarder', () => {
30903057 expect ( ( window as any ) . mParticle . forwarder . userAttributes . userIdentifiedInAdvertiser ) . toBeUndefined ( ) ;
30913058 } ) ;
30923059
3093- it ( 'should not call searchAdvertiser when advertiserIdSyncCredentials is an empty string' , async ( ) => {
3060+ it ( 'should not call searchAdvertiser when advertiserIdSyncApiKey is an empty string' , async ( ) => {
30943061 let searchCalled = false ;
30953062 ( window as any ) . mParticle . Identity = {
30963063 searchAdvertiser : ( ) => {
@@ -3099,7 +3066,7 @@ describe('Rokt Forwarder', () => {
30993066 } ;
31003067
31013068 await ( window as any ) . mParticle . forwarder . init (
3102- { accountId : '123456' , advertiserIdSyncCredentials : '' } ,
3069+ { accountId : '123456' , advertiserIdSyncApiKey : '' } ,
31033070 reportService . cb ,
31043071 true ,
31053072 null ,
@@ -3112,81 +3079,6 @@ describe('Rokt Forwarder', () => {
31123079 expect ( ( window as any ) . mParticle . forwarder . userAttributes . userIdentifiedInAdvertiser ) . toBeUndefined ( ) ;
31133080 } ) ;
31143081
3115- it ( 'should not call searchAdvertiser when advertiserIdSyncCredentials has no comma' , async ( ) => {
3116- let searchCalled = false ;
3117- ( window as any ) . mParticle . Identity = {
3118- searchAdvertiser : ( ) => {
3119- searchCalled = true ;
3120- } ,
3121- } ;
3122-
3123- await ( window as any ) . mParticle . forwarder . init (
3124- { accountId : '123456' , advertiserIdSyncCredentials : 'no-comma-here' } ,
3125- reportService . cb ,
3126- true ,
3127- null ,
3128- { } ,
3129- ) ;
3130-
3131- ( window as any ) . mParticle . forwarder . onUserIdentified ( makeUser ( ) ) ;
3132-
3133- expect ( searchCalled ) . toBe ( false ) ;
3134- } ) ;
3135-
3136- it ( 'should not call searchAdvertiser when advertiserIdSyncCredentials has more than one comma' , async ( ) => {
3137- let searchCalled = false ;
3138- ( window as any ) . mParticle . Identity = {
3139- searchAdvertiser : ( ) => {
3140- searchCalled = true ;
3141- } ,
3142- } ;
3143-
3144- await ( window as any ) . mParticle . forwarder . init (
3145- { accountId : '123456' , advertiserIdSyncCredentials : 'a,b,c' } ,
3146- reportService . cb ,
3147- true ,
3148- null ,
3149- { } ,
3150- ) ;
3151-
3152- ( window as any ) . mParticle . forwarder . onUserIdentified ( makeUser ( ) ) ;
3153-
3154- expect ( searchCalled ) . toBe ( false ) ;
3155- } ) ;
3156-
3157- it ( 'should not call searchAdvertiser when one half of advertiserIdSyncCredentials is empty' , async ( ) => {
3158- let searchCalled = false ;
3159- ( window as any ) . mParticle . Identity = {
3160- searchAdvertiser : ( ) => {
3161- searchCalled = true ;
3162- } ,
3163- } ;
3164-
3165- await ( window as any ) . mParticle . forwarder . init (
3166- { accountId : '123456' , advertiserIdSyncCredentials : 'apikey-only,' } ,
3167- reportService . cb ,
3168- true ,
3169- null ,
3170- { } ,
3171- ) ;
3172-
3173- ( window as any ) . mParticle . forwarder . onUserIdentified ( makeUser ( ) ) ;
3174-
3175- expect ( searchCalled ) . toBe ( false ) ;
3176-
3177- await ( window as any ) . mParticle . forwarder . init (
3178- { accountId : '123456' , advertiserIdSyncCredentials : ',secret-only' } ,
3179- reportService . cb ,
3180- true ,
3181- null ,
3182- { } ,
3183- ) ;
3184-
3185- ( window as any ) . mParticle . forwarder . onUserIdentified ( makeUser ( ) ) ;
3186-
3187- expect ( searchCalled ) . toBe ( false ) ;
3188- } ) ;
3189-
31903082 it ( 'should not call searchAdvertiser when the user has no plain email identity' , async ( ) => {
31913083 let searchCalled = false ;
31923084 ( window as any ) . mParticle . Identity = {
@@ -3196,7 +3088,7 @@ describe('Rokt Forwarder', () => {
31963088 } ;
31973089
31983090 await ( window as any ) . mParticle . forwarder . init (
3199- { accountId : '123456' , advertiserIdSyncCredentials : ADVERTISER_CREDENTIALS } ,
3091+ { accountId : '123456' , advertiserIdSyncApiKey : ADVERTISER_API_KEY } ,
32003092 reportService . cb ,
32013093 true ,
32023094 null ,
@@ -3215,7 +3107,7 @@ describe('Rokt Forwarder', () => {
32153107 ( window as any ) . mParticle . Identity = { } ;
32163108
32173109 await ( window as any ) . mParticle . forwarder . init (
3218- { accountId : '123456' , advertiserIdSyncCredentials : ADVERTISER_CREDENTIALS } ,
3110+ { accountId : '123456' , advertiserIdSyncApiKey : ADVERTISER_API_KEY } ,
32193111 reportService . cb ,
32203112 true ,
32213113 null ,
@@ -3236,7 +3128,7 @@ describe('Rokt Forwarder', () => {
32363128 } ;
32373129
32383130 await ( window as any ) . mParticle . forwarder . init (
3239- { accountId : '123456' , advertiserIdSyncCredentials : ADVERTISER_CREDENTIALS } ,
3131+ { accountId : '123456' , advertiserIdSyncApiKey : ADVERTISER_API_KEY } ,
32403132 reportService . cb ,
32413133 true ,
32423134 null ,
0 commit comments