@@ -77,7 +77,6 @@ describe('Integration Capture', () => {
7777 expect ( testEvent . data . custom_flags [ 'GoogleEnhancedConversions.Gclid' ] , 'Google Enhanced Conversions Gclid' ) . to . equal ( '234' ) ;
7878 expect ( testEvent . data . custom_flags [ 'GoogleEnhancedConversions.Gbraid' ] , 'Google Enhanced Conversions Gbraid' ) . to . equal ( '6574' ) ;
7979 expect ( testEvent . data . custom_flags [ 'GoogleEnhancedConversions.Wbraid' ] , 'Google Enhanced Conversions Wbraid' ) . to . equal ( '1234111' ) ;
80- expect ( testEvent . data . custom_flags [ 'Rokt.ClickId' ] , 'Rokt Click Id' ) . to . equal ( '45670808' ) ;
8180 } ) ;
8281
8382 it ( 'should add captured integrations to event custom flags, prioritizing passed in custom flags' , async ( ) => {
@@ -100,7 +99,6 @@ describe('Integration Capture', () => {
10099 expect ( testEvent . data . custom_flags [ 'GoogleEnhancedConversions.Gclid' ] , 'Google Enhanced Conversions Gclid' ) . to . equal ( '234' ) ;
101100 expect ( testEvent . data . custom_flags [ 'GoogleEnhancedConversions.Gbraid' ] , 'Google Enhanced Conversions Gbraid' ) . to . equal ( '6574' ) ;
102101 expect ( testEvent . data . custom_flags [ 'GoogleEnhancedConversions.Wbraid' ] , 'Google Enhanced Conversions Wbraid' ) . to . equal ( '1234111' ) ;
103- expect ( testEvent . data . custom_flags [ 'Rokt.ClickId' ] , 'Rokt Click Id' ) . to . equal ( '45670808' ) ;
104102 } ) ;
105103
106104 it ( 'should add captured integrations to page view custom flags' , async ( ) => {
@@ -124,7 +122,6 @@ describe('Integration Capture', () => {
124122 expect ( testEvent . data . custom_flags [ 'GoogleEnhancedConversions.Gclid' ] , 'Google Enhanced Conversions Gclid' ) . to . equal ( '234' ) ;
125123 expect ( testEvent . data . custom_flags [ 'GoogleEnhancedConversions.Gbraid' ] , 'Google Enhanced Conversions Gbraid' ) . to . equal ( '6574' ) ;
126124 expect ( testEvent . data . custom_flags [ 'GoogleEnhancedConversions.Wbraid' ] , 'Google Enhanced Conversions Wbraid' ) . to . equal ( '1234111' ) ;
127- expect ( testEvent . data . custom_flags [ 'Rokt.ClickId' ] , 'Rokt Click Id' ) . to . equal ( '45670808' ) ;
128125 } ) ;
129126
130127 it ( 'should add captured integrations to page view custom flags, prioritizing passed in custom flags' , async ( ) => {
@@ -146,7 +143,6 @@ describe('Integration Capture', () => {
146143 expect ( testEvent . data . custom_flags [ 'GoogleEnhancedConversions.Gclid' ] , 'Google Enhanced Conversions Gclid' ) . to . equal ( '234' ) ;
147144 expect ( testEvent . data . custom_flags [ 'GoogleEnhancedConversions.Gbraid' ] , 'Google Enhanced Conversions Gbraid' ) . to . equal ( '6574' ) ;
148145 expect ( testEvent . data . custom_flags [ 'GoogleEnhancedConversions.Wbraid' ] , 'Google Enhanced Conversions Wbraid' ) . to . equal ( '1234111' ) ;
149- expect ( testEvent . data . custom_flags [ 'Rokt.ClickId' ] , 'Rokt Click Id' ) . to . equal ( '45670808' ) ;
150146 } ) ;
151147
152148 it ( 'should add captured integrations to commerce event custom flags' , async ( ) => {
@@ -184,7 +180,6 @@ describe('Integration Capture', () => {
184180 expect ( testEvent . data . custom_flags [ 'GoogleEnhancedConversions.Gclid' ] , 'Google Enhanced Conversions Gclid' ) . to . equal ( '234' ) ;
185181 expect ( testEvent . data . custom_flags [ 'GoogleEnhancedConversions.Gbraid' ] , 'Google Enhanced Conversions Gbraid' ) . to . equal ( '6574' ) ;
186182 expect ( testEvent . data . custom_flags [ 'GoogleEnhancedConversions.Wbraid' ] , 'Google Enhanced Conversions Wbraid' ) . to . equal ( '1234111' ) ;
187- expect ( testEvent . data . custom_flags [ 'Rokt.ClickId' ] , 'Rokt Click Id' ) . to . equal ( '45670808' ) ;
188183 } ) ;
189184
190185 it ( 'should add captured integrations to commerce event custom flags, prioritizing passed in flags' , async ( ) => {
@@ -222,7 +217,6 @@ describe('Integration Capture', () => {
222217 expect ( testEvent . data . custom_flags [ 'GoogleEnhancedConversions.Gclid' ] , 'Google Enhanced Conversions Gclid' ) . to . equal ( '234' ) ;
223218 expect ( testEvent . data . custom_flags [ 'GoogleEnhancedConversions.Gbraid' ] , 'Google Enhanced Conversions Gbraid' ) . to . equal ( '6574' ) ;
224219 expect ( testEvent . data . custom_flags [ 'GoogleEnhancedConversions.Wbraid' ] , 'Google Enhanced Conversions Wbraid' ) . to . equal ( '1234111' ) ;
225- expect ( testEvent . data . custom_flags [ 'Rokt.ClickId' ] , 'Rokt Click Id' ) . to . equal ( '45670808' ) ;
226220 } ) ;
227221
228222 it ( 'should add captured integrations to commerce event custom flags' , async ( ) => {
@@ -260,7 +254,6 @@ describe('Integration Capture', () => {
260254 expect ( testEvent . data . custom_flags [ 'GoogleEnhancedConversions.Gclid' ] , 'Google Enhanced Conversions Gclid' ) . to . equal ( '234' ) ;
261255 expect ( testEvent . data . custom_flags [ 'GoogleEnhancedConversions.Gbraid' ] , 'Google Enhanced Conversions Gbraid' ) . to . equal ( '6574' ) ;
262256 expect ( testEvent . data . custom_flags [ 'GoogleEnhancedConversions.Wbraid' ] , 'Google Enhanced Conversions Wbraid' ) . to . equal ( '1234111' ) ;
263- expect ( testEvent . data . custom_flags [ 'Rokt.ClickId' ] , 'Rokt Click Id' ) . to . equal ( '45670808' ) ;
264257 } ) ;
265258
266259 it ( 'should add captured integrations to commerce event custom flags, prioritizing passed in flags' , async ( ) => {
@@ -298,10 +291,9 @@ describe('Integration Capture', () => {
298291 expect ( testEvent . data . custom_flags [ 'GoogleEnhancedConversions.Gclid' ] , 'Google Enhanced Conversions Gclid' ) . to . equal ( '234' ) ;
299292 expect ( testEvent . data . custom_flags [ 'GoogleEnhancedConversions.Gbraid' ] , 'Google Enhanced Conversions Gbraid' ) . to . equal ( '6574' ) ;
300293 expect ( testEvent . data . custom_flags [ 'GoogleEnhancedConversions.Wbraid' ] , 'Google Enhanced Conversions Wbraid' ) . to . equal ( '1234111' ) ;
301- expect ( testEvent . data . custom_flags [ 'Rokt.ClickId' ] , 'Rokt Click Id' ) . to . equal ( '45670808' ) ;
302294 } ) ;
303295
304- it ( 'should add captured integrations to batch partner identities' , async ( ) => {
296+ it ( 'should add captured integrations to batch as partner identities' , async ( ) => {
305297 await waitForCondition ( hasIdentityCallInflightReturned ) ;
306298
307299 window . mParticle . logEvent ( 'Test Event 1' ) ;
@@ -321,4 +313,75 @@ describe('Integration Capture', () => {
321313 } ) ;
322314
323315 } ) ;
316+
317+ it ( 'should add captured integrations to batch as integration attributes' , async ( ) => {
318+ await waitForCondition ( hasIdentityCallInflightReturned ) ;
319+
320+ window . mParticle . logEvent ( 'Test Event 1' ) ;
321+ window . mParticle . logEvent ( 'Test Event 2' ) ;
322+ window . mParticle . logEvent ( 'Test Event 3' ) ;
323+
324+ window . mParticle . upload ( ) ;
325+
326+ expect ( fetchMock . calls ( ) . length ) . to . greaterThan ( 1 ) ;
327+
328+ const lastCall = fetchMock . lastCall ( ) ;
329+ const batch = JSON . parse ( lastCall [ 1 ] . body as string ) ;
330+
331+ expect ( batch ) . to . have . property ( 'integration_attributes' ) ;
332+ expect ( batch . integration_attributes [ '1277' ] ) . to . deep . equal ( {
333+ 'rokt_id' : '45670808' ,
334+ } ) ;
335+ } ) ;
336+
337+ it ( 'should add captured integrations to batch as integration attributes without colliding with set integration attributes' , async ( ) => {
338+ await waitForCondition ( hasIdentityCallInflightReturned ) ;
339+
340+ window . mParticle . setIntegrationAttribute ( 160 , { 'client_id' : '12354' } ) ;
341+
342+ window . mParticle . logEvent ( 'Test Event 1' ) ;
343+ window . mParticle . logEvent ( 'Test Event 2' ) ;
344+ window . mParticle . logEvent ( 'Test Event 3' ) ;
345+
346+ window . mParticle . upload ( ) ;
347+
348+ expect ( fetchMock . calls ( ) . length ) . to . greaterThan ( 1 ) ;
349+
350+ const lastCall = fetchMock . lastCall ( ) ;
351+ const batch = JSON . parse ( lastCall [ 1 ] . body as string ) ;
352+
353+ expect ( batch ) . to . have . property ( 'integration_attributes' ) ;
354+ expect ( batch . integration_attributes ) . to . have . property ( '1277' ) ;
355+ expect ( batch . integration_attributes ) . to . have . property ( '160' ) ;
356+ expect ( batch . integration_attributes [ '1277' ] ) . to . deep . equal ( {
357+ 'rokt_id' : '45670808' ,
358+ } ) ;
359+ expect ( batch . integration_attributes [ '160' ] ) . to . deep . equal ( {
360+ 'client_id' : '12354' ,
361+ } ) ;
362+
363+ } ) ;
364+
365+ it ( 'should add captured integrations to batch as integration attributes, prioritizing passed in integration attributes' , async ( ) => {
366+ await waitForCondition ( hasIdentityCallInflightReturned ) ;
367+
368+ window . mParticle . setIntegrationAttribute ( 1277 , { 'rokt_id' : 'passed-in' } ) ;
369+ window . mParticle . setIntegrationAttribute ( 160 , { 'client_id' : '12354' } ) ;
370+
371+ window . mParticle . logEvent ( 'Test Event 1' ) ;
372+ window . mParticle . logEvent ( 'Test Event 2' ) ;
373+ window . mParticle . logEvent ( 'Test Event 3' ) ;
374+
375+ window . mParticle . upload ( ) ;
376+
377+ expect ( fetchMock . calls ( ) . length ) . to . greaterThan ( 1 ) ;
378+
379+ const lastCall = fetchMock . lastCall ( ) ;
380+ const batch = JSON . parse ( lastCall [ 1 ] . body as string ) ;
381+
382+ expect ( batch ) . to . have . property ( 'integration_attributes' ) ;
383+ expect ( batch . integration_attributes [ '1277' ] ) . to . deep . equal ( {
384+ 'rokt_id' : 'passed-in' ,
385+ } ) ;
386+ } ) ;
324387} ) ;
0 commit comments