@@ -41,8 +41,6 @@ describe('Intercom', function() {
4141 . global ( 'Intercom' )
4242 . option ( 'activator' , '#IntercomDefaultWidget' )
4343 . option ( 'appId' , '' )
44- . option ( 'blacklisted' , { } )
45- . option ( 'defaultMethod' , 'flatten' )
4644 . option ( 'richLinkProperties' , [ ] )
4745 . tag ( '<script src="https://widget.intercom.io/widget/{{ appId }}">' ) ) ;
4846 } ) ;
@@ -173,7 +171,7 @@ describe('Intercom', function() {
173171 } ) ;
174172 } ) ;
175173
176- it ( 'should selectively stringify, flatten, or drop traits' , function ( ) {
174+ it ( 'should drop arrays or objects in traits' , function ( ) {
177175 analytics . identify ( 'id' , {
178176 dropMe : { foo : 'bar' , ahoy : { okay : 'hello' } } ,
179177 stringifyMe : [ { a : 'b' } ] ,
@@ -182,82 +180,6 @@ describe('Intercom', function() {
182180 analytics . called ( window . Intercom , 'boot' , {
183181 app_id : options . appId ,
184182 user_id : 'id' ,
185- stringifyMe : '[{\"a\":\"b\"}]' ,
186- 'flattenMe.pizza' : 'cheese' ,
187- 'flattenMe.spongebob.patrick' : 'star' ,
188- id : 'id'
189- } ) ;
190- } ) ;
191-
192- it ( 'should let you set flatten as a default method for handling nested objects' , function ( ) {
193- intercom . options . defaultMethod = 'flatten' ;
194-
195- analytics . identify ( 'id' , {
196- dropMe : { foo : 'bar' , ahoy : { okay : 'hello' } } ,
197- stringifyMe : [ { a : 'b' } ] ,
198- flattenMe : { pizza : 'cheese' , spongebob : { patrick : 'star' } } ,
199- array : [ 'food' , { nom : 'avocados' } ] ,
200- song : 'Starboy' ,
201- artist : { singer : 'the weekend' , beats : 'daft punk' }
202- } ) ;
203- analytics . called ( window . Intercom , 'boot' , {
204- app_id : options . appId ,
205- user_id : 'id' ,
206- stringifyMe : '[{\"a\":\"b\"}]' ,
207- 'flattenMe.pizza' : 'cheese' ,
208- 'flattenMe.spongebob.patrick' : 'star' ,
209- song : 'Starboy' ,
210- 'artist.singer' : 'the weekend' ,
211- 'artist.beats' : 'daft punk' ,
212- 'array.0' : 'food' ,
213- 'array.1.nom' : 'avocados' ,
214- id : 'id'
215- } ) ;
216- } ) ;
217-
218- it ( 'should let you set stringify as a default method for handling nested objects' , function ( ) {
219- intercom . options . defaultMethod = 'stringify' ;
220-
221- analytics . identify ( 'id' , {
222- dropMe : { foo : 'bar' , ahoy : { okay : 'hello' } } ,
223- stringifyMe : [ { a : 'b' } ] ,
224- flattenMe : { pizza : 'cheese' , spongebob : { patrick : 'star' } } ,
225- array : [ 'food' , { nom : 'avocados' } ] ,
226- song : 'Starboy' ,
227- artist : { singer : 'the weekend' , beats : 'daft punk' }
228- } ) ;
229- analytics . called ( window . Intercom , 'boot' , {
230- app_id : options . appId ,
231- user_id : 'id' ,
232- stringifyMe : '[{\"a\":\"b\"}]' ,
233- 'flattenMe.pizza' : 'cheese' ,
234- 'flattenMe.spongebob.patrick' : 'star' ,
235- song : 'Starboy' ,
236- array : '[\"food\",{\"nom\":\"avocados\"}]' ,
237- artist : '{\"singer\":\"the weekend\",\"beats\":\"daft punk\"}' ,
238- id : 'id'
239- } ) ;
240- } ) ;
241-
242-
243- it ( 'should let you set drop as a default method for handling nested objects' , function ( ) {
244- intercom . options . defaultMethod = 'drop' ;
245-
246- analytics . identify ( 'id' , {
247- dropMe : { foo : 'bar' , ahoy : { okay : 'hello' } } ,
248- stringifyMe : [ { a : 'b' } ] ,
249- flattenMe : { pizza : 'cheese' , spongebob : { patrick : 'star' } } ,
250- array : [ 'food' , { nom : 'avocados' } ] ,
251- song : 'Starboy' ,
252- artist : { singer : 'the weekend' , beats : 'daft punk' }
253- } ) ;
254- analytics . called ( window . Intercom , 'boot' , {
255- app_id : options . appId ,
256- user_id : 'id' ,
257- stringifyMe : '[{\"a\":\"b\"}]' ,
258- 'flattenMe.pizza' : 'cheese' ,
259- 'flattenMe.spongebob.patrick' : 'star' ,
260- song : 'Starboy' ,
261183 id : 'id'
262184 } ) ;
263185 } ) ;
@@ -457,22 +379,19 @@ describe('Intercom', function() {
457379 analytics . called ( window . Intercom , 'update' , {
458380 company : {
459381 album : 'Starboy' ,
460- id : 'id'
382+ id : 'id'
461383 }
462384 } ) ;
463385 } ) ;
464386
465- it ( 'should selectively stringify, flatten, or drop traits' , function ( ) {
387+ it ( 'should drop arrays or objects in traits' , function ( ) {
466388 analytics . group ( 'id' , {
467389 dropMe : { foo : 'bar' , ahoy : { okay : 'hello' } } ,
468390 stringifyMe : [ { a : 'b' } ] ,
469391 flattenMe : { pizza : 'cheese' , spongebob : { patrick : 'star' } }
470392 } ) ;
471- analytics . called ( window . Intercom , 'update' , {
393+ analytics . called ( window . Intercom , 'update' , {
472394 company : {
473- stringifyMe : '[{\"a\":\"b\"}]' ,
474- 'flattenMe.pizza' : 'cheese' ,
475- 'flattenMe.spongebob.patrick' : 'star' ,
476395 id : 'id'
477396 }
478397 } ) ;
@@ -501,23 +420,22 @@ describe('Intercom', function() {
501420 } ) ;
502421 } ) ;
503422
504- it ( 'should selectively stringify, flatten, or drop traits ' , function ( ) {
423+ it ( 'should drop arrays or objects in properties ' , function ( ) {
505424 analytics . track ( 'event' , {
506425 dropMe : { foo : 'bar' , ahoy : { okay : 'hello' } } ,
507426 stringifyMe : [ { a : 'b' } ] ,
508- flattenMe : { pizza : 'cheese' , spongebob : { patrick : 'star' } }
427+ flattenMe : { pizza : 'cheese' , spongebob : { patrick : 'star' } } ,
428+ suh : 'dude'
509429 } ) ;
510- analytics . called ( window . Intercom , 'trackEvent' , 'event' , {
511- stringifyMe : '[{\"a\":\"b\"}]' ,
512- 'flattenMe.pizza' : 'cheese' ,
513- 'flattenMe.spongebob.patrick' : 'star'
430+ analytics . called ( window . Intercom , 'trackEvent' , 'event' , {
431+ suh : 'dude'
514432 } ) ;
515433 } ) ;
516434
517435 it ( 'should send Rich Link as nested object' , function ( ) {
518436 intercom . options . richLinkProperties = [ 'article' , 'orderNumber' ] ;
519437
520- analytics . track ( 'event' , {
438+ analytics . track ( 'event' , {
521439 article : {
522440 url : 'www.suh.com' ,
523441 value : 'suh dude'
@@ -539,18 +457,18 @@ describe('Intercom', function() {
539457
540458 it ( 'page: should set hide_default_launcher if integration setting exists for it' , function ( ) {
541459 var integrationSettings = {
542- Intercom : { hideDefaultLauncher : true }
460+ Intercom : { hideDefaultLauncher : true }
543461 } ;
544462 analytics . page ( { } , integrationSettings ) ;
545463 analytics . called ( window . Intercom , 'boot' , {
546464 app_id : options . appId ,
547465 hide_default_launcher : true
548466 } ) ;
549- } ) ;
467+ } ) ;
550468
551469 it ( 'identify: should set hide_default_launcher if integration setting exists for it' , function ( ) {
552470 var integrationSettings = {
553- Intercom : { hideDefaultLauncher : true }
471+ Intercom : { hideDefaultLauncher : true }
554472 } ;
555473 analytics . identify ( 'id' , { } , integrationSettings ) ;
556474 analytics . called ( window . Intercom , 'boot' , {
@@ -559,18 +477,18 @@ describe('Intercom', function() {
559477 id : 'id' ,
560478 hide_default_launcher : true
561479 } ) ;
562- } ) ;
480+ } ) ;
563481
564482 it ( 'group: should set hide_default_launcher if integration setting exists for it' , function ( ) {
565483 var integrationSettings = {
566- Intercom : { hideDefaultLauncher : true }
484+ Intercom : { hideDefaultLauncher : true }
567485 } ;
568486 analytics . group ( 'id' , { } , integrationSettings ) ;
569487 analytics . called ( window . Intercom , 'update' , {
570488 company : { id : 'id' } ,
571489 hide_default_launcher : true
572490 } ) ;
573- } ) ;
491+ } ) ;
574492 } ) ;
575493 } ) ;
576494} ) ;
0 commit comments