@@ -166,6 +166,192 @@ describe('LinkedinConversions.streamConversion', () => {
166166 ) . resolves . not . toThrowError ( )
167167 } )
168168
169+ it ( 'should successfully send the event with externalIds field as an array' , async ( ) => {
170+ nock ( `${ BASE_URL } /conversionEvents` )
171+ . post ( '' , {
172+ conversion : 'urn:lla:llaPartnerConversion:789123' ,
173+ conversionHappenedAt : currentTimestamp ,
174+ conversionValue : {
175+ currencyCode : 'USD' ,
176+ amount : '100'
177+ } ,
178+ user : {
179+ userIds : [
180+ {
181+ idType : 'SHA256_EMAIL' ,
182+ idValue : '584c4423c421df49955759498a71495aba49b8780eb9387dff333b6f0982c777'
183+ }
184+ ] ,
185+ userInfo : {
186+ firstName : 'mike' ,
187+ lastName : 'smith' ,
188+ title : 'software engineer' ,
189+ companyName : 'microsoft' ,
190+ countryCode : 'US'
191+ } ,
192+ externalIds : [ 'external_id_12345' ]
193+ }
194+ } )
195+ . reply ( 201 )
196+
197+ await expect (
198+ testDestination . testAction ( 'streamConversion' , {
199+ event,
200+ settings,
201+ mapping : {
202+ email : { '@path' : '$.context.traits.email' } ,
203+ conversionHappenedAt : {
204+ '@path' : '$.timestamp'
205+ } ,
206+ conversionValue : {
207+ currencyCode : 'USD' ,
208+ amount : { '@path' : '$.context.traits.value' }
209+ } ,
210+ userInfo : {
211+ firstName : { '@path' : '$.context.traits.first_name' } ,
212+ lastName : { '@path' : '$.context.traits.last_name' } ,
213+ title : { '@path' : '$.context.traits.title' } ,
214+ companyName : { '@path' : '$.context.traits.companyName' } ,
215+ countryCode : { '@path' : '$.context.traits.countryCode' }
216+ } ,
217+ externalIds : [ 'external_id_12345' ] ,
218+ onMappingSave : {
219+ inputs : { } ,
220+ outputs : {
221+ id : payload . conversionId
222+ }
223+ } ,
224+ enable_batching : true ,
225+ batch_size : 5000
226+ }
227+ } )
228+ ) . resolves . not . toThrowError ( )
229+ } )
230+
231+ it ( 'should successfully send the event with externalIds field as a string' , async ( ) => {
232+ nock ( `${ BASE_URL } /conversionEvents` )
233+ . post ( '' , {
234+ conversion : 'urn:lla:llaPartnerConversion:789123' ,
235+ conversionHappenedAt : currentTimestamp ,
236+ conversionValue : {
237+ currencyCode : 'USD' ,
238+ amount : '100'
239+ } ,
240+ user : {
241+ userIds : [
242+ {
243+ idType : 'SHA256_EMAIL' ,
244+ idValue : '584c4423c421df49955759498a71495aba49b8780eb9387dff333b6f0982c777'
245+ }
246+ ] ,
247+ userInfo : {
248+ firstName : 'mike' ,
249+ lastName : 'smith' ,
250+ title : 'software engineer' ,
251+ companyName : 'microsoft' ,
252+ countryCode : 'US'
253+ } ,
254+ externalIds : [ 'external_id_12345' ]
255+ }
256+ } )
257+ . reply ( 201 )
258+
259+ await expect (
260+ testDestination . testAction ( 'streamConversion' , {
261+ event,
262+ settings,
263+ mapping : {
264+ email : { '@path' : '$.context.traits.email' } ,
265+ conversionHappenedAt : {
266+ '@path' : '$.timestamp'
267+ } ,
268+ conversionValue : {
269+ currencyCode : 'USD' ,
270+ amount : { '@path' : '$.context.traits.value' }
271+ } ,
272+ userInfo : {
273+ firstName : { '@path' : '$.context.traits.first_name' } ,
274+ lastName : { '@path' : '$.context.traits.last_name' } ,
275+ title : { '@path' : '$.context.traits.title' } ,
276+ companyName : { '@path' : '$.context.traits.companyName' } ,
277+ countryCode : { '@path' : '$.context.traits.countryCode' }
278+ } ,
279+ externalIds : 'external_id_12345' ,
280+ onMappingSave : {
281+ inputs : { } ,
282+ outputs : {
283+ id : payload . conversionId
284+ }
285+ } ,
286+ enable_batching : true ,
287+ batch_size : 5000
288+ }
289+ } )
290+ ) . resolves . not . toThrowError ( )
291+ } )
292+
293+ it ( 'should successfully send the event when externalIds array contains more than 1 item' , async ( ) => {
294+ nock ( `${ BASE_URL } /conversionEvents` )
295+ . post ( '' , {
296+ conversion : 'urn:lla:llaPartnerConversion:789123' ,
297+ conversionHappenedAt : currentTimestamp ,
298+ conversionValue : {
299+ currencyCode : 'USD' ,
300+ amount : '100'
301+ } ,
302+ user : {
303+ userIds : [
304+ {
305+ idType : 'SHA256_EMAIL' ,
306+ idValue : '584c4423c421df49955759498a71495aba49b8780eb9387dff333b6f0982c777'
307+ }
308+ ] ,
309+ userInfo : {
310+ firstName : 'mike' ,
311+ lastName : 'smith' ,
312+ title : 'software engineer' ,
313+ companyName : 'microsoft' ,
314+ countryCode : 'US'
315+ } ,
316+ externalIds : [ 'external_id_12345' ]
317+ }
318+ } )
319+ . reply ( 201 )
320+
321+ await expect (
322+ testDestination . testAction ( 'streamConversion' , {
323+ event,
324+ settings,
325+ mapping : {
326+ email : { '@path' : '$.context.traits.email' } ,
327+ conversionHappenedAt : {
328+ '@path' : '$.timestamp'
329+ } ,
330+ conversionValue : {
331+ currencyCode : 'USD' ,
332+ amount : { '@path' : '$.context.traits.value' }
333+ } ,
334+ userInfo : {
335+ firstName : { '@path' : '$.context.traits.first_name' } ,
336+ lastName : { '@path' : '$.context.traits.last_name' } ,
337+ title : { '@path' : '$.context.traits.title' } ,
338+ companyName : { '@path' : '$.context.traits.companyName' } ,
339+ countryCode : { '@path' : '$.context.traits.countryCode' }
340+ } ,
341+ externalIds : [ 'external_id_12345' , 'external_id_67890' ] , // second item will be dropped
342+ onMappingSave : {
343+ inputs : { } ,
344+ outputs : {
345+ id : payload . conversionId
346+ }
347+ } ,
348+ enable_batching : true ,
349+ batch_size : 5000
350+ }
351+ } )
352+ ) . resolves . not . toThrowError ( )
353+ } )
354+
169355 it ( 'should successfully send a batch request with all fields' , async ( ) => {
170356 nock ( `${ BASE_URL } /conversionEvents` )
171357 . post ( '' , {
0 commit comments