@@ -695,7 +695,7 @@ describe('Facebook Forwarder', function () {
695695 window . fbqObj . params . should . have . property ( 'eventAttr1' , 'value1' ) ;
696696 window . fbqObj . params . should . have . property ( 'eventAttr2' , 'value2' ) ;
697697 window . fbqObj . eventData . should . have . property ( 'eventID' , SOURCE_MESSAGE_ID ) ;
698- window . fbqObj . params . should . not . have . property ( 'order_id' ) ;
698+ window . fbqObj . params . should . have . property ( 'order_id' , 123 ) ;
699699 window . fbqObj . params . should . not . have . property ( 'contents' ) ;
700700
701701 done ( ) ;
@@ -744,7 +744,7 @@ describe('Facebook Forwarder', function () {
744744 window . fbqObj . params . should . have . property ( 'eventAttr1' , 'value1' ) ;
745745 window . fbqObj . params . should . have . property ( 'eventAttr2' , 'value2' ) ;
746746 window . fbqObj . eventData . should . have . property ( 'eventID' , SOURCE_MESSAGE_ID ) ;
747- window . fbqObj . params . should . not . have . property ( 'order_id' ) ;
747+ window . fbqObj . params . should . have . property ( 'order_id' , 123 ) ;
748748 window . fbqObj . params . should . not . have . property ( 'contents' ) ;
749749
750750 done ( ) ;
@@ -792,7 +792,7 @@ describe('Facebook Forwarder', function () {
792792 window . fbqObj . params . should . have . property ( 'eventAttr1' , 'value1' ) ;
793793 window . fbqObj . params . should . have . property ( 'eventAttr2' , 'value2' ) ;
794794 window . fbqObj . eventData . should . have . property ( 'eventID' , SOURCE_MESSAGE_ID ) ;
795- window . fbqObj . params . should . not . have . property ( 'order_id' ) ;
795+ window . fbqObj . params . should . have . property ( 'order_id' , 123 ) ;
796796 window . fbqObj . params . should . not . have . property ( 'contents' ) ;
797797
798798 done ( ) ;
@@ -840,7 +840,7 @@ describe('Facebook Forwarder', function () {
840840 window . fbqObj . params . should . have . property ( 'eventAttr1' , 'value1' ) ;
841841 window . fbqObj . params . should . have . property ( 'eventAttr2' , 'value2' ) ;
842842 window . fbqObj . eventData . should . have . property ( 'eventID' , SOURCE_MESSAGE_ID ) ;
843- window . fbqObj . params . should . not . have . property ( 'order_id' ) ;
843+ window . fbqObj . params . should . have . property ( 'order_id' , 123 ) ;
844844 window . fbqObj . params . should . not . have . property ( 'contents' ) ;
845845
846846 done ( ) ;
@@ -1357,6 +1357,90 @@ describe('Facebook Forwarder', function () {
13571357 window . fbqObj . params . should . have . property ( 'checkout_step' , 1 ) ;
13581358 window . fbqObj . eventData . should . have . property ( 'eventID' , SOURCE_MESSAGE_ID ) ;
13591359
1360+ done ( ) ;
1361+ } ) ;
1362+
1363+ it ( 'should log AddToWishlist event with product names as contents' , function ( done ) {
1364+ mParticle . forwarder . init ( {
1365+ pixelCode : 'test-pixel-code' ,
1366+ sendProductNamesasContents : true
1367+ } , reportService . cb , true ) ;
1368+
1369+ mParticle . forwarder . process ( {
1370+ EventName : 'eCommerce - AddToWishlist' ,
1371+ EventCategory : CommerceEventType . ProductAddToWishlist ,
1372+ EventDataType : MessageType . Commerce ,
1373+ ProductAction : {
1374+ ProductActionType : ProductActionType . AddToWishlist ,
1375+ ProductList : [
1376+ {
1377+ Sku : 'sku-111' ,
1378+ Name : 'Laptop' ,
1379+ Category : 'Electronics' ,
1380+ Brand : 'Dell' ,
1381+ Price : 1200 ,
1382+ Quantity : 1
1383+ } ,
1384+ {
1385+ Sku : 'sku-222' ,
1386+ Name : 'Mouse' ,
1387+ Category : 'Accessories' ,
1388+ Brand : 'Logitech' ,
1389+ Price : 50 ,
1390+ Quantity : 1
1391+ }
1392+ ] ,
1393+ TransactionId : 456
1394+ } ,
1395+ CurrencyCode : 'USD' ,
1396+ SourceMessageId : SOURCE_MESSAGE_ID ,
1397+ } ) ;
1398+
1399+ checkBasicProperties ( 'track' ) ;
1400+ window . fbqObj . should . have . property ( 'eventName' , 'AddToWishlist' ) ;
1401+ window . fbqObj . params . should . have . property ( 'content_name' , [ 'Laptop' , 'Mouse' ] ) ;
1402+ window . fbqObj . params . should . have . property ( 'order_id' , 456 ) ;
1403+ window . fbqObj . params . should . have . property ( 'content_ids' , [ 'sku-111' , 'sku-222' ] ) ;
1404+ window . fbqObj . params . should . not . have . property ( 'contents' ) ;
1405+ window . fbqObj . eventData . should . have . property ( 'eventID' , SOURCE_MESSAGE_ID ) ;
1406+ done ( ) ;
1407+ } ) ;
1408+
1409+ it ( 'should log ViewDetail event with product names as contents' , function ( done ) {
1410+ mParticle . forwarder . init ( {
1411+ pixelCode : 'test-pixel-code' ,
1412+ sendProductNamesasContents : true
1413+ } , reportService . cb , true ) ;
1414+
1415+ mParticle . forwarder . process ( {
1416+ EventName : 'eCommerce - ViewDetail' ,
1417+ EventCategory : CommerceEventType . ProductViewDetail ,
1418+ EventDataType : MessageType . Commerce ,
1419+ ProductAction : {
1420+ ProductActionType : ProductActionType . ViewDetail ,
1421+ ProductList : [
1422+ {
1423+ Sku : 'sku-999' ,
1424+ Name : 'Tablet' ,
1425+ Category : 'Electronics' ,
1426+ Brand : 'Samsung' ,
1427+ Price : 800 ,
1428+ Quantity : 1
1429+ }
1430+ ] ,
1431+ TransactionId : 789
1432+ } ,
1433+ CurrencyCode : 'USD' ,
1434+ SourceMessageId : SOURCE_MESSAGE_ID ,
1435+ } ) ;
1436+
1437+ checkBasicProperties ( 'track' ) ;
1438+ window . fbqObj . should . have . property ( 'eventName' , 'ViewContent' ) ;
1439+ window . fbqObj . params . should . have . property ( 'content_name' , [ 'Tablet' ] ) ;
1440+ window . fbqObj . params . should . have . property ( 'order_id' , 789 ) ;
1441+ window . fbqObj . params . should . have . property ( 'content_ids' , [ 'sku-999' ] ) ;
1442+ window . fbqObj . params . should . not . have . property ( 'contents' ) ;
1443+ window . fbqObj . eventData . should . have . property ( 'eventID' , SOURCE_MESSAGE_ID ) ;
13601444 done ( ) ;
13611445 } ) ;
13621446 } ) ;
0 commit comments