This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Commit 680bcfe committed Jul 16, 2024 · 7 / 9
1 parent 0b06a90 commit 680bcfe Copy full SHA for 680bcfe
File tree 1 file changed +49
-0
lines changed
packages/analytics-js-integrations/__tests__/integrations/XPixel
1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -121,4 +121,53 @@ describe('XPixel Track event', () => {
121
121
} ,
122
122
] ) ;
123
123
} ) ;
124
+
125
+ test ( 'Testing Track product_added with no content_type in payload' , ( ) => {
126
+ xPixel = new XPixel ( basicConfig , { loglevel : 'DEBUG' } ) ;
127
+ xPixel . init ( ) ;
128
+ window . twq . track = jest . fn ( ) ;
129
+ xPixel . track ( {
130
+ message : {
131
+ context : { } ,
132
+ event : 'product_added' ,
133
+ properties : {
134
+ customProp : 'testProp' ,
135
+ event_id : 'purchaseId' ,
136
+ order_id : 'transactionId' ,
137
+ value : 35.0 ,
138
+ currency : 'GBP' ,
139
+ products : [
140
+ {
141
+ customPropProd : 'testPropProd' ,
142
+ product_id : 'abc' ,
143
+ category : 'Merch' ,
144
+ name : 'Food' ,
145
+ price : 3.0 ,
146
+ quantity : 2 ,
147
+ currency : 'GBP' ,
148
+ position : 1 ,
149
+ value : 6.0 ,
150
+ typeOfProduct : 'Food' ,
151
+ } ,
152
+ ] ,
153
+ } ,
154
+ } ,
155
+ } ) ;
156
+ expect ( window . twq . mock . calls [ 0 ] ) . toEqual ( [ 'config' , '12567839' ] ) ;
157
+ } ) ;
158
+
159
+ test ( 'Test for empty properties' , ( ) => {
160
+ xPixel = new XPixel ( basicConfig , { loglevel : 'DEBUG' } ) ;
161
+ xPixel . init ( ) ;
162
+ window . twq . track = jest . fn ( ) ;
163
+ xPixel . track ( {
164
+ message : {
165
+ type : 'track' ,
166
+ context : { } ,
167
+ event : 'Sign Up' ,
168
+ properties : { } ,
169
+ } ,
170
+ } ) ;
171
+ expect ( window . twq . mock . calls [ 1 ] ) . toEqual ( [ 'event' , '123' , { } ] ) ;
172
+ } ) ;
124
173
} ) ;
You can’t perform that action at this time.
0 commit comments